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
d12573a1a9d235bbe38de70a99a0453bc7c1264c
[ "self.x, self.h_dim, self.z_dim, self.activation, self.distribution = (x, h_dim, z_dim, activation, distribution)\nself.rescale_sph_latent = rescale_sph_latent\nself.z_mean, self.z_var = self._encoder(self.x)\nif distribution == 'normal':\n self.q_z = tf.distributions.Normal(self.z_mean, self.z_var)\nelif distri...
<|body_start_0|> self.x, self.h_dim, self.z_dim, self.activation, self.distribution = (x, h_dim, z_dim, activation, distribution) self.rescale_sph_latent = rescale_sph_latent self.z_mean, self.z_var = self._encoder(self.x) if distribution == 'normal': self.q_z = tf.distributi...
ExplicitAE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExplicitAE: def __init__(self, x, h_dim, z_dim, activation=tf.nn.relu, distribution='normal', rescale_sph_latent=False): """:param x: placeholder for input :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activa...
stack_v2_sparse_classes_75kplus_train_066700
10,826
no_license
[ { "docstring": ":param x: placeholder for input :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activation function :param distribution: string either `normal` or `vmf`, indicates which distribution to use", "name": "__init__", ...
3
null
Implement the Python class `ExplicitAE` described below. Class description: Implement the ExplicitAE class. Method signatures and docstrings: - def __init__(self, x, h_dim, z_dim, activation=tf.nn.relu, distribution='normal', rescale_sph_latent=False): :param x: placeholder for input :param h_dim: dimension of the hi...
Implement the Python class `ExplicitAE` described below. Class description: Implement the ExplicitAE class. Method signatures and docstrings: - def __init__(self, x, h_dim, z_dim, activation=tf.nn.relu, distribution='normal', rescale_sph_latent=False): :param x: placeholder for input :param h_dim: dimension of the hi...
cbbd645d40f8f7b90322585f9e1bf319a7882324
<|skeleton|> class ExplicitAE: def __init__(self, x, h_dim, z_dim, activation=tf.nn.relu, distribution='normal', rescale_sph_latent=False): """:param x: placeholder for input :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExplicitAE: def __init__(self, x, h_dim, z_dim, activation=tf.nn.relu, distribution='normal', rescale_sph_latent=False): """:param x: placeholder for input :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activation function ...
the_stack_v2_python_sparse
src/models.py
thu-ml/wmvl
train
3
b01864fd04d1a67d9c6e09a956c610c5e47537ff
[ "rospy.init_node('sound_recorder', anonymous=True)\nself.pub = rospy.Publisher('sound_recorder', String, queue_size=10)\nself.path = '/home/jonas/recorded_sounds/'\nrospy.loginfo('Created recorder')", "app = qi.Application(['SoundProcessingModule', '--qi-url=' + 'tcp://' + ip + ':' + str(port)])\napp.start()\nses...
<|body_start_0|> rospy.init_node('sound_recorder', anonymous=True) self.pub = rospy.Publisher('sound_recorder', String, queue_size=10) self.path = '/home/jonas/recorded_sounds/' rospy.loginfo('Created recorder') <|end_body_0|> <|body_start_1|> app = qi.Application(['SoundProcess...
SoundRecorderPublisher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoundRecorderPublisher: def __init__(self): """This node will record audio clips of 10 seconds""" <|body_0|> def start_recording_bot(self, ip, port): """Method for recording from the mic of the robot @param ip: ip adress of the robot @param port: the port to connect ...
stack_v2_sparse_classes_75kplus_train_066701
2,773
no_license
[ { "docstring": "This node will record audio clips of 10 seconds", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method for recording from the mic of the robot @param ip: ip adress of the robot @param port: the port to connect to the robot", "name": "start_recording...
3
null
Implement the Python class `SoundRecorderPublisher` described below. Class description: Implement the SoundRecorderPublisher class. Method signatures and docstrings: - def __init__(self): This node will record audio clips of 10 seconds - def start_recording_bot(self, ip, port): Method for recording from the mic of th...
Implement the Python class `SoundRecorderPublisher` described below. Class description: Implement the SoundRecorderPublisher class. Method signatures and docstrings: - def __init__(self): This node will record audio clips of 10 seconds - def start_recording_bot(self, ip, port): Method for recording from the mic of th...
132c126005451349a045fb46823611caebe74c72
<|skeleton|> class SoundRecorderPublisher: def __init__(self): """This node will record audio clips of 10 seconds""" <|body_0|> def start_recording_bot(self, ip, port): """Method for recording from the mic of the robot @param ip: ip adress of the robot @param port: the port to connect ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SoundRecorderPublisher: def __init__(self): """This node will record audio clips of 10 seconds""" rospy.init_node('sound_recorder', anonymous=True) self.pub = rospy.Publisher('sound_recorder', String, queue_size=10) self.path = '/home/jonas/recorded_sounds/' rospy.login...
the_stack_v2_python_sparse
src/sound_recorder/src/sound_recorder_publisher.py
jonascuypers/spontaneous-robot-reactions
train
0
42eaa465a6e4d010e0e90eab0a216a3628419bba
[ "self.radius = radius\nself.max_neighbors = int(max_neighbors)\nself.step = step", "from pymatgen import Structure\ns = Structure.from_dict(struct)\nfeatures = self._get_structure_graph_features(s)\nfeatures = np.array(features)\nreturn features", "atom_features = np.array([site.specie.Z for site in struct], dt...
<|body_start_0|> self.radius = radius self.max_neighbors = int(max_neighbors) self.step = step <|end_body_0|> <|body_start_1|> from pymatgen import Structure s = Structure.from_dict(struct) features = self._get_structure_graph_features(s) features = np.array(feat...
Calculate structure graph features for crystals. Based on the implementation in Crystal Graph Convolutional Neural Networks (CGCNN). The method constructs a crystal graph representation including atom features (atomic numbers) and bond features (neighbor distances). Neighbors are determined by searching in a sphere aro...
StructureGraphFeaturizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructureGraphFeaturizer: """Calculate structure graph features for crystals. Based on the implementation in Crystal Graph Convolutional Neural Networks (CGCNN). The method constructs a crystal graph representation including atom features (atomic numbers) and bond features (neighbor distances). N...
stack_v2_sparse_classes_75kplus_train_066702
8,595
permissive
[ { "docstring": "Parameters ---------- radius : float (default 8.0) Radius of sphere for finding neighbors of atoms in unit cell. max_neighbors : int (default 12) Maximum number of neighbors to consider when constructing graph. step : float (default 0.2) Step size for Gaussian filter.", "name": "__init__", ...
4
stack_v2_sparse_classes_30k_train_045227
Implement the Python class `StructureGraphFeaturizer` described below. Class description: Calculate structure graph features for crystals. Based on the implementation in Crystal Graph Convolutional Neural Networks (CGCNN). The method constructs a crystal graph representation including atom features (atomic numbers) an...
Implement the Python class `StructureGraphFeaturizer` described below. Class description: Calculate structure graph features for crystals. Based on the implementation in Crystal Graph Convolutional Neural Networks (CGCNN). The method constructs a crystal graph representation including atom features (atomic numbers) an...
c9eaf1b64b6969cec692893288ca92439f9b6dda
<|skeleton|> class StructureGraphFeaturizer: """Calculate structure graph features for crystals. Based on the implementation in Crystal Graph Convolutional Neural Networks (CGCNN). The method constructs a crystal graph representation including atom features (atomic numbers) and bond features (neighbor distances). N...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StructureGraphFeaturizer: """Calculate structure graph features for crystals. Based on the implementation in Crystal Graph Convolutional Neural Networks (CGCNN). The method constructs a crystal graph representation including atom features (atomic numbers) and bond features (neighbor distances). Neighbors are ...
the_stack_v2_python_sparse
deepchem/feat/materials_featurizers.py
borisdayma/deepchem
train
1
ca46f1f046cc1644899a6929cf0829185b1bef34
[ "_, [ax1, ax2] = plt.subplots(nrows=1, ncols=2, figsize=(8, 5))\nloc, scale = (series.mean(), series.std())\n_ = stats.probplot(series, sparams=(loc, scale), plot=ax1)\nsns.distplot(series, fit=stats.norm, hist_kws={'edgecolor': 'k'}, ax=ax2)\nax2.legend(ax1.lines, ['kde', 'norm'])", "_, [ax1, ax2] = plt.subplots...
<|body_start_0|> _, [ax1, ax2] = plt.subplots(nrows=1, ncols=2, figsize=(8, 5)) loc, scale = (series.mean(), series.std()) _ = stats.probplot(series, sparams=(loc, scale), plot=ax1) sns.distplot(series, fit=stats.norm, hist_kws={'edgecolor': 'k'}, ax=ax2) ax2.legend(ax1.lines, ['...
NumTransform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumTransform: def qqplot(self, series): """绘制QQ图,查看序列是否符合正态分布""" <|body_0|> def yeojohnson(self, series): """Yeojohnson变换""" <|body_1|> def boxcox(self, series): """Box-Cox变换""" <|body_2|> <|end_skeleton|> <|body_start_0|> _, [a...
stack_v2_sparse_classes_75kplus_train_066703
8,243
no_license
[ { "docstring": "绘制QQ图,查看序列是否符合正态分布", "name": "qqplot", "signature": "def qqplot(self, series)" }, { "docstring": "Yeojohnson变换", "name": "yeojohnson", "signature": "def yeojohnson(self, series)" }, { "docstring": "Box-Cox变换", "name": "boxcox", "signature": "def boxcox(sel...
3
stack_v2_sparse_classes_30k_val_000938
Implement the Python class `NumTransform` described below. Class description: Implement the NumTransform class. Method signatures and docstrings: - def qqplot(self, series): 绘制QQ图,查看序列是否符合正态分布 - def yeojohnson(self, series): Yeojohnson变换 - def boxcox(self, series): Box-Cox变换
Implement the Python class `NumTransform` described below. Class description: Implement the NumTransform class. Method signatures and docstrings: - def qqplot(self, series): 绘制QQ图,查看序列是否符合正态分布 - def yeojohnson(self, series): Yeojohnson变换 - def boxcox(self, series): Box-Cox变换 <|skeleton|> class NumTransform: def...
823184005a3a2ed70a32b37c0afc2066e6e8907a
<|skeleton|> class NumTransform: def qqplot(self, series): """绘制QQ图,查看序列是否符合正态分布""" <|body_0|> def yeojohnson(self, series): """Yeojohnson变换""" <|body_1|> def boxcox(self, series): """Box-Cox变换""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumTransform: def qqplot(self, series): """绘制QQ图,查看序列是否符合正态分布""" _, [ax1, ax2] = plt.subplots(nrows=1, ncols=2, figsize=(8, 5)) loc, scale = (series.mean(), series.std()) _ = stats.probplot(series, sparams=(loc, scale), plot=ax1) sns.distplot(series, fit=stats.norm, his...
the_stack_v2_python_sparse
WorkCode/Models/ModelFunc/Exploratory/Numerical.py
johngolt/gitln
train
1
9fbbf612ce4490e22d97d3f35767763cac33a2d5
[ "super().__init__(path)\ntry:\n self._rfile = open(self._path, 'r')\n self._reader = csv.DictReader(self._rfile, delimiter=CSVWriter.DELIMITER_CHAR, quotechar=CSVWriter.QUOTE_CHAR, restval=CSVWriter.NONE_VALUE)\nexcept (FileNotFoundError, IOError):\n CSVReader.logger.error('Cannot read workload from path %...
<|body_start_0|> super().__init__(path) try: self._rfile = open(self._path, 'r') self._reader = csv.DictReader(self._rfile, delimiter=CSVWriter.DELIMITER_CHAR, quotechar=CSVWriter.QUOTE_CHAR, restval=CSVWriter.NONE_VALUE) except (FileNotFoundError, IOError): C...
This class reads CSV workload files. These files MUST contain all of the fields of the Task class, with their order and name specified in the first row of the file.
CSVReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVReader: """This class reads CSV workload files. These files MUST contain all of the fields of the Task class, with their order and name specified in the first row of the file.""" def __init__(self, path): """Constructor for the class :param path: Path of the workload file""" ...
stack_v2_sparse_classes_75kplus_train_066704
6,474
permissive
[ { "docstring": "Constructor for the class :param path: Path of the workload file", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Reads one Task entry from the CSV file :return: a Task object", "name": "read_entry", "signature": "def read_entry(self)" },...
3
stack_v2_sparse_classes_30k_train_000955
Implement the Python class `CSVReader` described below. Class description: This class reads CSV workload files. These files MUST contain all of the fields of the Task class, with their order and name specified in the first row of the file. Method signatures and docstrings: - def __init__(self, path): Constructor for ...
Implement the Python class `CSVReader` described below. Class description: This class reads CSV workload files. These files MUST contain all of the fields of the Task class, with their order and name specified in the first row of the file. Method signatures and docstrings: - def __init__(self, path): Constructor for ...
787b3b060d6a431810c1a29279251cbe9292351b
<|skeleton|> class CSVReader: """This class reads CSV workload files. These files MUST contain all of the fields of the Task class, with their order and name specified in the first row of the file.""" def __init__(self, path): """Constructor for the class :param path: Path of the workload file""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CSVReader: """This class reads CSV workload files. These files MUST contain all of the fields of the Task class, with their order and name specified in the first row of the file.""" def __init__(self, path): """Constructor for the class :param path: Path of the workload file""" super().__...
the_stack_v2_python_sparse
fault_injector/io/reader.py
igabriel85/fault_injector
train
0
a9c8bbc16480868e604581bb4ae6ad4a1ac24346
[ "self.data = data\nself.parent = parent\nself.left = left\nself.right = right", "node = self\nwhile node:\n if node.data == sought:\n return node\n elif node.data < sought:\n node = node.left\n elif node.data > sought:\n node = node.right\nreturn None", "node = self\nif node.data =...
<|body_start_0|> self.data = data self.parent = parent self.left = left self.right = right <|end_body_0|> <|body_start_1|> node = self while node: if node.data == sought: return node elif node.data < sought: node = ...
Node in a binary search tree.
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: """Node in a binary search tree.""" def __init__(self, data, parent=None, left=None, right=None): """Initialize node in binary search tree with given data.""" <|body_0|> def find_node(self, sought): """Find node with given data in a binary search tree.""" ...
stack_v2_sparse_classes_75kplus_train_066705
4,185
no_license
[ { "docstring": "Initialize node in binary search tree with given data.", "name": "__init__", "signature": "def __init__(self, data, parent=None, left=None, right=None)" }, { "docstring": "Find node with given data in a binary search tree.", "name": "find_node", "signature": "def find_nod...
4
stack_v2_sparse_classes_30k_train_024927
Implement the Python class `Node` described below. Class description: Node in a binary search tree. Method signatures and docstrings: - def __init__(self, data, parent=None, left=None, right=None): Initialize node in binary search tree with given data. - def find_node(self, sought): Find node with given data in a bin...
Implement the Python class `Node` described below. Class description: Node in a binary search tree. Method signatures and docstrings: - def __init__(self, data, parent=None, left=None, right=None): Initialize node in binary search tree with given data. - def find_node(self, sought): Find node with given data in a bin...
5f5b419b8ab8da22984df5b12c3627b9b1a49be8
<|skeleton|> class Node: """Node in a binary search tree.""" def __init__(self, data, parent=None, left=None, right=None): """Initialize node in binary search tree with given data.""" <|body_0|> def find_node(self, sought): """Find node with given data in a binary search tree.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Node: """Node in a binary search tree.""" def __init__(self, data, parent=None, left=None, right=None): """Initialize node in binary search tree with given data.""" self.data = data self.parent = parent self.left = left self.right = right def find_node(self, s...
the_stack_v2_python_sparse
find-dist-two-nodes/find_distance_btw_nodes.py
eileenconner/whiteboarding
train
1
df8de9c85a93c2338de6fdd722ede1ea0a1f74cd
[ "self_dc = Idc.get_local_dc()\nself.clients = []\nfor dc, client in clients.iteritems():\n if self_dc == dc:\n self.clients.insert(0, client)\n else:\n self.clients.append(client)\nself.local_cmds = set(self.READ_CMDS)\nself.local_cmds.update(local_update_cmds)", "def wrap(*args, **kwargs):\n ...
<|body_start_0|> self_dc = Idc.get_local_dc() self.clients = [] for dc, client in clients.iteritems(): if self_dc == dc: self.clients.insert(0, client) else: self.clients.append(client) self.local_cmds = set(self.READ_CMDS) ...
MultiClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiClient: def __init__(self, clients, local_update_cmds=[]): """:param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to a...
stack_v2_sparse_classes_75kplus_train_066706
1,545
no_license
[ { "docstring": ":param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to all clients, except that listed in local_update_cmds :return:", "name": ...
2
stack_v2_sparse_classes_30k_train_001821
Implement the Python class `MultiClient` described below. Class description: Implement the MultiClient class. Method signatures and docstrings: - def __init__(self, clients, local_update_cmds=[]): :param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pyp...
Implement the Python class `MultiClient` described below. Class description: Implement the MultiClient class. Method signatures and docstrings: - def __init__(self, clients, local_update_cmds=[]): :param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pyp...
c592d879fd79da4e0816a4f909e5725e385b6160
<|skeleton|> class MultiClient: def __init__(self, clients, local_update_cmds=[]): """:param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiClient: def __init__(self, clients, local_update_cmds=[]): """:param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to all clients, ex...
the_stack_v2_python_sparse
leetcode/venv/lib/python2.7/site-packages/pyutil/memcache/multi_client.py
KqSMea8/PycharmProjects
train
0
7ba3ba42d8ef91ebaabb1d2b603567fa242de561
[ "super(Discriminator, self).__init__(data_dim=data_dim, latent_dim=latent_dim, network_architecture=network_architecture, name='Standard Discriminator')\ndiscriminator_model = get_network_by_name['discriminator'][network_architecture](self.data_dim, self.latent_dim)\nprior_distribution = self.prior_sampler(self.dat...
<|body_start_0|> super(Discriminator, self).__init__(data_dim=data_dim, latent_dim=latent_dim, network_architecture=network_architecture, name='Standard Discriminator') discriminator_model = get_network_by_name['discriminator'][network_architecture](self.data_dim, self.latent_dim) prior_distribu...
Discriminator model is adversarially trained against the encoder in order to account for a D_KL(q(z|x) || p(z)) term in the variational loss (see AVB paper, page 3). The discriminator architecture takes as input samples from the joint probability distribution of the data `x` and a approximate posterior `z` and from the...
Discriminator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: """Discriminator model is adversarially trained against the encoder in order to account for a D_KL(q(z|x) || p(z)) term in the variational loss (see AVB paper, page 3). The discriminator architecture takes as input samples from the joint probability distribution of the data `x` and...
stack_v2_sparse_classes_75kplus_train_066707
12,274
permissive
[ { "docstring": "Args: data_dim: int, the flattened dimensionality of the data space latent_dim: int, the flattened dimensionality of the latent space network_architecture: str, the architecture name for the body of the Discriminator model", "name": "__init__", "signature": "def __init__(self, data_dim, ...
2
stack_v2_sparse_classes_30k_train_053145
Implement the Python class `Discriminator` described below. Class description: Discriminator model is adversarially trained against the encoder in order to account for a D_KL(q(z|x) || p(z)) term in the variational loss (see AVB paper, page 3). The discriminator architecture takes as input samples from the joint proba...
Implement the Python class `Discriminator` described below. Class description: Discriminator model is adversarially trained against the encoder in order to account for a D_KL(q(z|x) || p(z)) term in the variational loss (see AVB paper, page 3). The discriminator architecture takes as input samples from the joint proba...
545e4993c90622f05b5b7ba0183bc07d5972371e
<|skeleton|> class Discriminator: """Discriminator model is adversarially trained against the encoder in order to account for a D_KL(q(z|x) || p(z)) term in the variational loss (see AVB paper, page 3). The discriminator architecture takes as input samples from the joint probability distribution of the data `x` and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Discriminator: """Discriminator model is adversarially trained against the encoder in order to account for a D_KL(q(z|x) || p(z)) term in the variational loss (see AVB paper, page 3). The discriminator architecture takes as input samples from the joint probability distribution of the data `x` and a approximat...
the_stack_v2_python_sparse
playground/models/networks/discriminator.py
gdikov/vae-playground
train
1
62f0e5f0804d4a2d8ec1dc49608e0436dfb8251b
[ "parameters = dict()\nparameters['page'] = GraphQLParam(page, 'PageInput', False)\nparameters['filter'] = GraphQLParam(lun_filter, 'LUNFilter', False)\nparameters['sort'] = GraphQLParam(sort, 'LUNSort', False)\nresponse = self._query(name='getLUNs', params=parameters, fields=LUNList.fields())\nreturn LUNList(respon...
<|body_start_0|> parameters = dict() parameters['page'] = GraphQLParam(page, 'PageInput', False) parameters['filter'] = GraphQLParam(lun_filter, 'LUNFilter', False) parameters['sort'] = GraphQLParam(sort, 'LUNSort', False) response = self._query(name='getLUNs', params=parameters,...
Mixin to add LUN related methods to the GraphQL client
LUNsMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LUNsMixin: """Mixin to add LUN related methods to the GraphQL client""" def get_luns(self, page: PageInput=None, lun_filter: LUNFilter=None, sort: LUNSort=None) -> LUNList: """Retrieves a list of LUN objects :param page: The requested page from the server. This is an optional argumen...
stack_v2_sparse_classes_75kplus_train_066708
20,047
permissive
[ { "docstring": "Retrieves a list of LUN objects :param page: The requested page from the server. This is an optional argument and if omitted the server will default to returning the first page with a maximum of ``100`` items. :type page: PageInput, optional :param lun_filter: A filter object to filter the LUNs ...
4
stack_v2_sparse_classes_30k_train_016343
Implement the Python class `LUNsMixin` described below. Class description: Mixin to add LUN related methods to the GraphQL client Method signatures and docstrings: - def get_luns(self, page: PageInput=None, lun_filter: LUNFilter=None, sort: LUNSort=None) -> LUNList: Retrieves a list of LUN objects :param page: The re...
Implement the Python class `LUNsMixin` described below. Class description: Mixin to add LUN related methods to the GraphQL client Method signatures and docstrings: - def get_luns(self, page: PageInput=None, lun_filter: LUNFilter=None, sort: LUNSort=None) -> LUNList: Retrieves a list of LUN objects :param page: The re...
8ea044096bd18aaccbfb81eca4e26ec29895a18c
<|skeleton|> class LUNsMixin: """Mixin to add LUN related methods to the GraphQL client""" def get_luns(self, page: PageInput=None, lun_filter: LUNFilter=None, sort: LUNSort=None) -> LUNList: """Retrieves a list of LUN objects :param page: The requested page from the server. This is an optional argumen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LUNsMixin: """Mixin to add LUN related methods to the GraphQL client""" def get_luns(self, page: PageInput=None, lun_filter: LUNFilter=None, sort: LUNSort=None) -> LUNList: """Retrieves a list of LUN objects :param page: The requested page from the server. This is an optional argument and if omit...
the_stack_v2_python_sparse
nebpyclient/api/luns.py
firefly707/nebpyclient
train
0
7ae96ec5e9f00e2d40052dcf6c9b5fc6ba2c2d8a
[ "self.limit = limit\nself.order = DoublyLinkedList()\nself.storage = dict()", "if key not in self.storage:\n return None\nelse:\n node = self.storage[key]\n self.order.move_to_end(node)\n return node.value[1]", "if key in self.storage:\n node = self.storage[key]\n node.value = (key, value)\n ...
<|body_start_0|> self.limit = limit self.order = DoublyLinkedList() self.storage = dict() <|end_body_0|> <|body_start_1|> if key not in self.storage: return None else: node = self.storage[key] self.order.move_to_end(node) return no...
LRUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, limit=10): """The LRUCache class keeps track of the max number of nodes it can hold, the current number of nodes it is holding, a doubly- linked list that holds the key-value entries in the correct order, as well as a storage dict that provides fast access to...
stack_v2_sparse_classes_75kplus_train_066709
2,732
permissive
[ { "docstring": "The LRUCache class keeps track of the max number of nodes it can hold, the current number of nodes it is holding, a doubly- linked list that holds the key-value entries in the correct order, as well as a storage dict that provides fast access to every node stored in the cache.", "name": "__i...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, limit=10): The LRUCache class keeps track of the max number of nodes it can hold, the current number of nodes it is holding, a doubly- linked list that holds t...
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, limit=10): The LRUCache class keeps track of the max number of nodes it can hold, the current number of nodes it is holding, a doubly- linked list that holds t...
b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82
<|skeleton|> class LRUCache: def __init__(self, limit=10): """The LRUCache class keeps track of the max number of nodes it can hold, the current number of nodes it is holding, a doubly- linked list that holds the key-value entries in the correct order, as well as a storage dict that provides fast access to...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, limit=10): """The LRUCache class keeps track of the max number of nodes it can hold, the current number of nodes it is holding, a doubly- linked list that holds the key-value entries in the correct order, as well as a storage dict that provides fast access to every node st...
the_stack_v2_python_sparse
cs/lambda_cs/03_data_structures/notes/lru_cache_brian.py
tobias-fyi/vela
train
0
4a6140482800f2cbd8cdaaae6ba27380c109f1bd
[ "self.cap = size\nself.sum = 0\nself.queue = []", "self.queue.append(val)\nself.sum += val\nif self.cap > 0:\n self.cap -= 1\nelse:\n self.sum -= self.queue.pop(0)\nreturn self.sum * 1.0 / len(self.queue)" ]
<|body_start_0|> self.cap = size self.sum = 0 self.queue = [] <|end_body_0|> <|body_start_1|> self.queue.append(val) self.sum += val if self.cap > 0: self.cap -= 1 else: self.sum -= self.queue.pop(0) return self.sum * 1.0 / len(sel...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.cap = size self.sum = 0 ...
stack_v2_sparse_classes_75kplus_train_066710
527
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
null
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
88a822c48ef50187507d0f75ce65ecc39e849839
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.cap = size self.sum = 0 self.queue = [] def next(self, val): """:type val: int :rtype: float""" self.queue.append(val) self.sum += val i...
the_stack_v2_python_sparse
bwu/array/346-moving-average-from-data-stream.py
captainhcg/leetcode-in-py-and-go
train
1
aa6315cde5225b333231221329300b4bf45634c7
[ "title_menu = 'Tournament : {}'.format(tournament.name)\nView.add_title_menu(title_menu)\ntab_t_players = []\nt_players = tournament_service.TournamentService.tournament_players_list(tournament)\nfor player in t_players:\n tab_t_players.append(GetModelService.get_serialized('PlayerModel', player.id))\nTableServi...
<|body_start_0|> title_menu = 'Tournament : {}'.format(tournament.name) View.add_title_menu(title_menu) tab_t_players = [] t_players = tournament_service.TournamentService.tournament_players_list(tournament) for player in t_players: tab_t_players.append(GetModelServic...
Class for round service
RoundService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoundService: """Class for round service""" def round_table(cls, tournament, rounds): """method of creating round tables""" <|body_0|> def create_rounds(cls, tournament): """round creation method""" <|body_1|> <|end_skeleton|> <|body_start_0|> t...
stack_v2_sparse_classes_75kplus_train_066711
1,986
no_license
[ { "docstring": "method of creating round tables", "name": "round_table", "signature": "def round_table(cls, tournament, rounds)" }, { "docstring": "round creation method", "name": "create_rounds", "signature": "def create_rounds(cls, tournament)" } ]
2
stack_v2_sparse_classes_30k_train_017881
Implement the Python class `RoundService` described below. Class description: Class for round service Method signatures and docstrings: - def round_table(cls, tournament, rounds): method of creating round tables - def create_rounds(cls, tournament): round creation method
Implement the Python class `RoundService` described below. Class description: Class for round service Method signatures and docstrings: - def round_table(cls, tournament, rounds): method of creating round tables - def create_rounds(cls, tournament): round creation method <|skeleton|> class RoundService: """Class...
0e906ee6d94372b8ff2acc0067008c7ace9eb51a
<|skeleton|> class RoundService: """Class for round service""" def round_table(cls, tournament, rounds): """method of creating round tables""" <|body_0|> def create_rounds(cls, tournament): """round creation method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RoundService: """Class for round service""" def round_table(cls, tournament, rounds): """method of creating round tables""" title_menu = 'Tournament : {}'.format(tournament.name) View.add_title_menu(title_menu) tab_t_players = [] t_players = tournament_service.Tour...
the_stack_v2_python_sparse
app/services/round_service.py
Arnaud290/OC_P4
train
0
ac6d01f79ac1ceb96e82dae11c3fd1a1b6c4041f
[ "epsilon = sigma * np.random.randn(n)\nx3 = np.random.randn(n)\ny = np.exp(x3 + epsilon)\nx = cbrt(x3)\nreturn (y, x)", "x = np.random.normal(0, 1, 2 * n).reshape((n, 2))\nnoise = np.random.standard_normal(n)\ny = x[:, 0] + x[:, 1] * noise\nreturn (y, x)", "x = np.vstack((np.random.random(n) * 2.0 - 1.0 for j i...
<|body_start_0|> epsilon = sigma * np.random.randn(n) x3 = np.random.randn(n) y = np.exp(x3 + epsilon) x = cbrt(x3) return (y, x) <|end_body_0|> <|body_start_1|> x = np.random.normal(0, 1, 2 * n).reshape((n, 2)) noise = np.random.standard_normal(n) y = x[...
DataSimulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSimulator: def SimData_Breiman1(n, sigma=1): """Breiman 1 model This is a 1-d model. y = exp(x^3 + \\epsilon) \\epsilon ~ N(0,1) x^3 ~ N(0,1) :param n: sample size :param sigma: :return:""" <|body_0|> def SimData_MultiplyNoise(n): """Y = X1 + X2 * eps :param n: :...
stack_v2_sparse_classes_75kplus_train_066712
2,345
no_license
[ { "docstring": "Breiman 1 model This is a 1-d model. y = exp(x^3 + \\\\epsilon) \\\\epsilon ~ N(0,1) x^3 ~ N(0,1) :param n: sample size :param sigma: :return:", "name": "SimData_Breiman1", "signature": "def SimData_Breiman1(n, sigma=1)" }, { "docstring": "Y = X1 + X2 * eps :param n: :return:", ...
4
null
Implement the Python class `DataSimulator` described below. Class description: Implement the DataSimulator class. Method signatures and docstrings: - def SimData_Breiman1(n, sigma=1): Breiman 1 model This is a 1-d model. y = exp(x^3 + \\epsilon) \\epsilon ~ N(0,1) x^3 ~ N(0,1) :param n: sample size :param sigma: :ret...
Implement the Python class `DataSimulator` described below. Class description: Implement the DataSimulator class. Method signatures and docstrings: - def SimData_Breiman1(n, sigma=1): Breiman 1 model This is a 1-d model. y = exp(x^3 + \\epsilon) \\epsilon ~ N(0,1) x^3 ~ N(0,1) :param n: sample size :param sigma: :ret...
066595d8b4d96b8ad6b3fe48ef941412b355ca67
<|skeleton|> class DataSimulator: def SimData_Breiman1(n, sigma=1): """Breiman 1 model This is a 1-d model. y = exp(x^3 + \\epsilon) \\epsilon ~ N(0,1) x^3 ~ N(0,1) :param n: sample size :param sigma: :return:""" <|body_0|> def SimData_MultiplyNoise(n): """Y = X1 + X2 * eps :param n: :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataSimulator: def SimData_Breiman1(n, sigma=1): """Breiman 1 model This is a 1-d model. y = exp(x^3 + \\epsilon) \\epsilon ~ N(0,1) x^3 ~ N(0,1) :param n: sample size :param sigma: :return:""" epsilon = sigma * np.random.randn(n) x3 = np.random.randn(n) y = np.exp(x3 + epsilon...
the_stack_v2_python_sparse
build/lib/okgtreg/DataSimulator.py
pancodia/OKGTreg
train
0
bbd9d12c80d38497ecdc27c6d45cda2400f2eb61
[ "target = []\ni = 0\nwhile i < len(nums):\n if index[i] == i:\n target.append(nums[i])\n else:\n self.insert(target, index[i], nums[i])\n i += 1\nreturn target", "i = 0\nnumInsert = num\nwhile i < len(target) - index:\n temp = target[index + i]\n target[index + i] = numInsert\n num...
<|body_start_0|> target = [] i = 0 while i < len(nums): if index[i] == i: target.append(nums[i]) else: self.insert(target, index[i], nums[i]) i += 1 return target <|end_body_0|> <|body_start_1|> i = 0 nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: """Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)""" <|body_0|> def insert(self, target: List[int], index: int, num: int) -> None: """Time: O(n), where n = len(...
stack_v2_sparse_classes_75kplus_train_066713
1,002
no_license
[ { "docstring": "Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)", "name": "createTargetArray", "signature": "def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]" }, { "docstring": "Time: O(n), where n = len(nums) Space: O(n), where n = len(nums)", "...
2
stack_v2_sparse_classes_30k_val_000808
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums) - def insert(self, target: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums) - def insert(self, target: List[in...
b68f8a7b3cab871e86e58c7c9b49a7bf74453b53
<|skeleton|> class Solution: def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: """Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)""" <|body_0|> def insert(self, target: List[int], index: int, num: int) -> None: """Time: O(n), where n = len(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: """Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)""" target = [] i = 0 while i < len(nums): if index[i] == i: target.append(nums[i]) ...
the_stack_v2_python_sparse
Python Solutions/Easy/1389.py
rajpatel5/LeetCode
train
0
ed92b882459bb173298447219338286e8d89f537
[ "self._bytes_per_callback = start_bytes_per_callback\nself._callback_func = callback_func\nself._calls_per_exponent = calls_per_exponent\nself._max_bytes_per_callback = max_bytes_per_callback\nself._total_size = total_size\nself._bytes_processed_since_callback = 0\nself._callbacks_made = 0\nself._total_bytes_proces...
<|body_start_0|> self._bytes_per_callback = start_bytes_per_callback self._callback_func = callback_func self._calls_per_exponent = calls_per_exponent self._max_bytes_per_callback = max_bytes_per_callback self._total_size = total_size self._bytes_processed_since_callback ...
Makes progress callbacks with exponential backoff to a maximum value. This prevents excessive log message output.
ProgressCallbackWithBackoff
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressCallbackWithBackoff: """Makes progress callbacks with exponential backoff to a maximum value. This prevents excessive log message output.""" def __init__(self, total_size, callback_func, start_bytes_per_callback=_START_BYTES_PER_CALLBACK, max_bytes_per_callback=_MAX_BYTES_PER_CALLBAC...
stack_v2_sparse_classes_75kplus_train_066714
7,111
permissive
[ { "docstring": "Initializes the callback with backoff. Args: total_size: Total bytes to process. If this is None, size is not known at the outset. callback_func: Func of (int: processed_so_far, int: total_bytes) used to make callbacks. start_bytes_per_callback: Lower bound of bytes per callback. max_bytes_per_c...
2
stack_v2_sparse_classes_30k_train_001401
Implement the Python class `ProgressCallbackWithBackoff` described below. Class description: Makes progress callbacks with exponential backoff to a maximum value. This prevents excessive log message output. Method signatures and docstrings: - def __init__(self, total_size, callback_func, start_bytes_per_callback=_STA...
Implement the Python class `ProgressCallbackWithBackoff` described below. Class description: Makes progress callbacks with exponential backoff to a maximum value. This prevents excessive log message output. Method signatures and docstrings: - def __init__(self, total_size, callback_func, start_bytes_per_callback=_STA...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ProgressCallbackWithBackoff: """Makes progress callbacks with exponential backoff to a maximum value. This prevents excessive log message output.""" def __init__(self, total_size, callback_func, start_bytes_per_callback=_START_BYTES_PER_CALLBACK, max_bytes_per_callback=_MAX_BYTES_PER_CALLBAC...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProgressCallbackWithBackoff: """Makes progress callbacks with exponential backoff to a maximum value. This prevents excessive log message output.""" def __init__(self, total_size, callback_func, start_bytes_per_callback=_START_BYTES_PER_CALLBACK, max_bytes_per_callback=_MAX_BYTES_PER_CALLBACK, calls_per_...
the_stack_v2_python_sparse
third_party/catapult/third_party/gsutil/gslib/progress_callback.py
metux/chromium-suckless
train
5
ca326243096efbf50fe57d8770a0b69eea608422
[ "infra_proto = InfraProto()\nfor infra_object in self.infra_objects:\n infra_object_proto = infra_object.to_infra_object_proto()\n infra_proto.infra_objects.append(infra_object_proto)\nreturn infra_proto", "infra = cls()\ninfra.infra_objects += [InfraObject.from_infra_object_proto(infra_object_proto) for in...
<|body_start_0|> infra_proto = InfraProto() for infra_object in self.infra_objects: infra_object_proto = infra_object.to_infra_object_proto() infra_proto.infra_objects.append(infra_object_proto) return infra_proto <|end_body_0|> <|body_start_1|> infra = cls() ...
Represents the set of infrastructure managed by Feast. Args: infra_objects: A list of InfraObjects, each representing one infrastructure object.
Infra
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Infra: """Represents the set of infrastructure managed by Feast. Args: infra_objects: A list of InfraObjects, each representing one infrastructure object.""" def to_proto(self) -> InfraProto: """Converts Infra to its protobuf representation. Returns: An InfraProto protobuf.""" ...
stack_v2_sparse_classes_75kplus_train_066715
5,391
permissive
[ { "docstring": "Converts Infra to its protobuf representation. Returns: An InfraProto protobuf.", "name": "to_proto", "signature": "def to_proto(self) -> InfraProto" }, { "docstring": "Returns an Infra object created from a protobuf representation.", "name": "from_proto", "signature": "d...
2
null
Implement the Python class `Infra` described below. Class description: Represents the set of infrastructure managed by Feast. Args: infra_objects: A list of InfraObjects, each representing one infrastructure object. Method signatures and docstrings: - def to_proto(self) -> InfraProto: Converts Infra to its protobuf r...
Implement the Python class `Infra` described below. Class description: Represents the set of infrastructure managed by Feast. Args: infra_objects: A list of InfraObjects, each representing one infrastructure object. Method signatures and docstrings: - def to_proto(self) -> InfraProto: Converts Infra to its protobuf r...
58aff346832ebde1695a47cf724da3d65a4a8c53
<|skeleton|> class Infra: """Represents the set of infrastructure managed by Feast. Args: infra_objects: A list of InfraObjects, each representing one infrastructure object.""" def to_proto(self) -> InfraProto: """Converts Infra to its protobuf representation. Returns: An InfraProto protobuf.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Infra: """Represents the set of infrastructure managed by Feast. Args: infra_objects: A list of InfraObjects, each representing one infrastructure object.""" def to_proto(self) -> InfraProto: """Converts Infra to its protobuf representation. Returns: An InfraProto protobuf.""" infra_proto...
the_stack_v2_python_sparse
sdk/python/feast/infra/infra_object.py
feast-dev/feast
train
3,956
8c0cef3be3ccf9ea2e4f9f929f838e303d108e63
[ "self.head, self.tail = (None, None)\nself.capacity, self.count = (capacity, 0)\nself.cache = {}", "if not key in self.cache:\n return -1\nself.unlink_node(self.cache[key])\nself.update_tail(self.cache[key])\nreturn self.cache[key].val", "if not self.head:\n self.head = self.tail = ListNode(key, value)\n ...
<|body_start_0|> self.head, self.tail = (None, None) self.capacity, self.count = (capacity, 0) self.cache = {} <|end_body_0|> <|body_start_1|> if not key in self.cache: return -1 self.unlink_node(self.cache[key]) self.update_tail(self.cache[key]) retu...
Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache.
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: """Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache.""" def __init__(self, capacity): """Initialization method Args: capacity(int):""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_066716
3,173
no_license
[ { "docstring": "Initialization method Args: capacity(int):", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": "Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1 Args: key(int): Returns:", "name": "get", ...
5
stack_v2_sparse_classes_30k_train_037467
Implement the Python class `LRUCache` described below. Class description: Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache. Method signatures and docstrings: - def __init__(self, capacity): Initializatio...
Implement the Python class `LRUCache` described below. Class description: Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache. Method signatures and docstrings: - def __init__(self, capacity): Initializatio...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class LRUCache: """Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache.""" def __init__(self, capacity): """Initialization method Args: capacity(int):""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: """Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache.""" def __init__(self, capacity): """Initialization method Args: capacity(int):""" self.head, self.tail = (None,...
the_stack_v2_python_sparse
LeetCode/146_lru_cache.py
KKosukeee/CodingQuestions
train
1
4056743ea5fa42f82439e8c8c0ab8eb0d8410d83
[ "logger.debug('Get repo: %s/%s permissions for user %s', namespace_name, repository_name, username)\nperm = model.get_repo_permission_for_user(username, namespace_name, repository_name)\nreturn perm.to_dict()", "new_permission = request.get_json()\nlogger.debug('Setting permission to: %s for user %s', new_permiss...
<|body_start_0|> logger.debug('Get repo: %s/%s permissions for user %s', namespace_name, repository_name, username) perm = model.get_repo_permission_for_user(username, namespace_name, repository_name) return perm.to_dict() <|end_body_0|> <|body_start_1|> new_permission = request.get_jso...
Resource for managing individual user permissions.
RepositoryUserPermission
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepositoryUserPermission: """Resource for managing individual user permissions.""" def get(self, namespace_name, repository_name, username): """Get the permission for the specified user.""" <|body_0|> def put(self, namespace_name, repository_name, username): """U...
stack_v2_sparse_classes_75kplus_train_066717
8,862
permissive
[ { "docstring": "Get the permission for the specified user.", "name": "get", "signature": "def get(self, namespace_name, repository_name, username)" }, { "docstring": "Update the perimssions for an existing repository.", "name": "put", "signature": "def put(self, namespace_name, repositor...
3
stack_v2_sparse_classes_30k_train_011086
Implement the Python class `RepositoryUserPermission` described below. Class description: Resource for managing individual user permissions. Method signatures and docstrings: - def get(self, namespace_name, repository_name, username): Get the permission for the specified user. - def put(self, namespace_name, reposito...
Implement the Python class `RepositoryUserPermission` described below. Class description: Resource for managing individual user permissions. Method signatures and docstrings: - def get(self, namespace_name, repository_name, username): Get the permission for the specified user. - def put(self, namespace_name, reposito...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class RepositoryUserPermission: """Resource for managing individual user permissions.""" def get(self, namespace_name, repository_name, username): """Get the permission for the specified user.""" <|body_0|> def put(self, namespace_name, repository_name, username): """U...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RepositoryUserPermission: """Resource for managing individual user permissions.""" def get(self, namespace_name, repository_name, username): """Get the permission for the specified user.""" logger.debug('Get repo: %s/%s permissions for user %s', namespace_name, repository_name, username) ...
the_stack_v2_python_sparse
endpoints/api/permission.py
quay/quay
train
2,363
d9b0202788216d0a3536f3d80b470c2da58c54d5
[ "self.settings = tools.getSettingsObject()\nlastBackup = int(self.settings['System']['Backup']['lastBackup'])\nnow = int(tools.makeDateStamp())\nself.doBackup()\nprojConf = tools.getProjectSettingsObject()\nprojConf['System']['Backup']['lastBackup'] = now\nprojConf.write()\nself.settings['System']['Backup']['lastBa...
<|body_start_0|> self.settings = tools.getSettingsObject() lastBackup = int(self.settings['System']['Backup']['lastBackup']) now = int(tools.makeDateStamp()) self.doBackup() projConf = tools.getProjectSettingsObject() projConf['System']['Backup']['lastBackup'] = now ...
BackupProject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupProject: def main(self): """Here we will manage the backup process.""" <|body_0|> def doBackup(self): """This is the main backup process.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.settings = tools.getSettingsObject() lastBac...
stack_v2_sparse_classes_75kplus_train_066718
2,572
no_license
[ { "docstring": "Here we will manage the backup process.", "name": "main", "signature": "def main(self)" }, { "docstring": "This is the main backup process.", "name": "doBackup", "signature": "def doBackup(self)" } ]
2
stack_v2_sparse_classes_30k_train_007525
Implement the Python class `BackupProject` described below. Class description: Implement the BackupProject class. Method signatures and docstrings: - def main(self): Here we will manage the backup process. - def doBackup(self): This is the main backup process.
Implement the Python class `BackupProject` described below. Class description: Implement the BackupProject class. Method signatures and docstrings: - def main(self): Here we will manage the backup process. - def doBackup(self): This is the main backup process. <|skeleton|> class BackupProject: def main(self): ...
315e2e7544e2001404b8d7dbfdd1ffbee5e389f8
<|skeleton|> class BackupProject: def main(self): """Here we will manage the backup process.""" <|body_0|> def doBackup(self): """This is the main backup process.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BackupProject: def main(self): """Here we will manage the backup process.""" self.settings = tools.getSettingsObject() lastBackup = int(self.settings['System']['Backup']['lastBackup']) now = int(tools.makeDateStamp()) self.doBackup() projConf = tools.getProjectS...
the_stack_v2_python_sparse
bin/python/lib_system/backup_project.py
sillsdevarchive/ptxplus
train
0
b2bce8850af308399e2bfc2b39316ef40cae35c0
[ "super().__init__()\nself.precisions: Optional[str] = None\nif data.get('precisions'):\n self.set_precisions(data.get('precisions'))\nself.op_wise = None\nif isinstance(data.get('op_wise'), dict):\n self.op_wise = data.get('op_wise', {})", "if isinstance(precisions, str):\n self.precisions = precisions.r...
<|body_start_0|> super().__init__() self.precisions: Optional[str] = None if data.get('precisions'): self.set_precisions(data.get('precisions')) self.op_wise = None if isinstance(data.get('op_wise'), dict): self.op_wise = data.get('op_wise', {}) <|end_body...
Configuration Graph Optimization class.
GraphOptimization
[ "MIT", "Intel", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphOptimization: """Configuration Graph Optimization class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Graph Optimization class.""" <|body_0|> def set_precisions(self, precisions: Union[str, List[str]]) -> None: """Updat...
stack_v2_sparse_classes_75kplus_train_066719
1,934
permissive
[ { "docstring": "Initialize Configuration Graph Optimization class.", "name": "__init__", "signature": "def __init__(self, data: Dict[str, Any]={}) -> None" }, { "docstring": "Update graph_optimization precisions in config.", "name": "set_precisions", "signature": "def set_precisions(self...
2
stack_v2_sparse_classes_30k_train_021641
Implement the Python class `GraphOptimization` described below. Class description: Configuration Graph Optimization class. Method signatures and docstrings: - def __init__(self, data: Dict[str, Any]={}) -> None: Initialize Configuration Graph Optimization class. - def set_precisions(self, precisions: Union[str, List[...
Implement the Python class `GraphOptimization` described below. Class description: Configuration Graph Optimization class. Method signatures and docstrings: - def __init__(self, data: Dict[str, Any]={}) -> None: Initialize Configuration Graph Optimization class. - def set_precisions(self, precisions: Union[str, List[...
3976edc4215398e69ce0213f87ec295f5dc96e0e
<|skeleton|> class GraphOptimization: """Configuration Graph Optimization class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Graph Optimization class.""" <|body_0|> def set_precisions(self, precisions: Union[str, List[str]]) -> None: """Updat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphOptimization: """Configuration Graph Optimization class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Graph Optimization class.""" super().__init__() self.precisions: Optional[str] = None if data.get('precisions'): se...
the_stack_v2_python_sparse
neural_compressor/ux/utils/workload/graph_optimization.py
Skp80/neural-compressor
train
0
c368fa9fa4591f43deb08a652ba2c835c5f9d9c1
[ "self.follow_map = defaultdict(set)\nself.followed_map = defaultdict(set)\nself.tweet_map = defaultdict(list)\nself.post_map = defaultdict(list)\nself.tweet_stamp = 0", "self.post_map[userId].append((self.tweet_stamp, tweetId))\nfor id in self.followed_map[userId]:\n insort(self.tweet_map[id], (self.tweet_stam...
<|body_start_0|> self.follow_map = defaultdict(set) self.followed_map = defaultdict(set) self.tweet_map = defaultdict(list) self.post_map = defaultdict(list) self.tweet_stamp = 0 <|end_body_0|> <|body_start_1|> self.post_map[userId].append((self.tweet_stamp, tweetId)) ...
Twitter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: None""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_75kplus_train_066720
3,247
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: None", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
stack_v2_sparse_classes_30k_train_012272
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: None - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: None - def getNew...
fc5b1744af7be93f4dd01d6ad58d2bd12f7ed33f
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: None""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Twitter: def __init__(self): """Initialize your data structure here.""" self.follow_map = defaultdict(set) self.followed_map = defaultdict(set) self.tweet_map = defaultdict(list) self.post_map = defaultdict(list) self.tweet_stamp = 0 def postTweet(self, use...
the_stack_v2_python_sparse
355.Design-Twitter.py
mickey0524/leetcode
train
27
72f8ba893736985521e157cf42d768137923168e
[ "if nnmodel is None:\n nnmodel = _construct_nn_model(input_size, hidden_size, n_layers, modeltype).to(torch.double)\nmodel = DFTXC(xcstr, nnmodel).to(device)\nself.xc = xcstr\nloss: Loss = L2Loss()\noutput_types = ['loss', 'predict']\nself.mode = mode\nsuper(XCModel, self).__init__(model, loss=loss, output_types...
<|body_start_0|> if nnmodel is None: nnmodel = _construct_nn_model(input_size, hidden_size, n_layers, modeltype).to(torch.double) model = DFTXC(xcstr, nnmodel).to(device) self.xc = xcstr loss: Loss = L2Loss() output_types = ['loss', 'predict'] self.mode = mode...
This class is used to initialize and run Differentiable Quantum Chemistry (i.e, DFT) calculations, using an exchange correlation functional that has been replaced by a neural network. This model is based on the paper "Learning the exchange-correlation functional from nature with fully differentiable density functional ...
XCModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XCModel: """This class is used to initialize and run Differentiable Quantum Chemistry (i.e, DFT) calculations, using an exchange correlation functional that has been replaced by a neural network. This model is based on the paper "Learning the exchange-correlation functional from nature with fully...
stack_v2_sparse_classes_75kplus_train_066721
9,553
permissive
[ { "docstring": "Parameters ---------- xcstr: str The choice of xc to use. nnmodel: torch.nn.Module the PyTorch model implementing the calculation input_size: int size of neural network input hidden_size: int size of the hidden layers ; the number of hidden layers is fixed in the default method. n_layers: int nu...
2
stack_v2_sparse_classes_30k_train_031462
Implement the Python class `XCModel` described below. Class description: This class is used to initialize and run Differentiable Quantum Chemistry (i.e, DFT) calculations, using an exchange correlation functional that has been replaced by a neural network. This model is based on the paper "Learning the exchange-correl...
Implement the Python class `XCModel` described below. Class description: This class is used to initialize and run Differentiable Quantum Chemistry (i.e, DFT) calculations, using an exchange correlation functional that has been replaced by a neural network. This model is based on the paper "Learning the exchange-correl...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class XCModel: """This class is used to initialize and run Differentiable Quantum Chemistry (i.e, DFT) calculations, using an exchange correlation functional that has been replaced by a neural network. This model is based on the paper "Learning the exchange-correlation functional from nature with fully...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XCModel: """This class is used to initialize and run Differentiable Quantum Chemistry (i.e, DFT) calculations, using an exchange correlation functional that has been replaced by a neural network. This model is based on the paper "Learning the exchange-correlation functional from nature with fully differentiab...
the_stack_v2_python_sparse
deepchem/models/dft/dftxc.py
deepchem/deepchem
train
4,876
d1279ace29b0dafbae6d435c48f2f39d1f7ae30b
[ "self.function = function\nself.f_min = function(function.x)\nself.steps = []\nself.steps.append(self.function.x[:])\nself.dim = self.function.dim", "_s = 0\ncount_steps = 1\nwhile count_steps <= max_step:\n _check = self.update(abs_tol, rel_tol)\n count_steps += 1\n if _check < 1:\n _s += 1\n ...
<|body_start_0|> self.function = function self.f_min = function(function.x) self.steps = [] self.steps.append(self.function.x[:]) self.dim = self.function.dim <|end_body_0|> <|body_start_1|> _s = 0 count_steps = 1 while count_steps <= max_step: ...
GradientDescent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientDescent: def __init__(self, function): """function: instance of Function""" <|body_0|> def run(self, abs_tol=1e-05, rel_tol=0.001, step_break=100, max_step=5000): """abs_tol, rel_tol, step_break: stop when _check<1 (_check is what update should return) for st...
stack_v2_sparse_classes_75kplus_train_066722
1,892
permissive
[ { "docstring": "function: instance of Function", "name": "__init__", "signature": "def __init__(self, function)" }, { "docstring": "abs_tol, rel_tol, step_break: stop when _check<1 (_check is what update should return) for step_break consecutive steps max_step: maximum number of steps", "nam...
2
stack_v2_sparse_classes_30k_train_010052
Implement the Python class `GradientDescent` described below. Class description: Implement the GradientDescent class. Method signatures and docstrings: - def __init__(self, function): function: instance of Function - def run(self, abs_tol=1e-05, rel_tol=0.001, step_break=100, max_step=5000): abs_tol, rel_tol, step_br...
Implement the Python class `GradientDescent` described below. Class description: Implement the GradientDescent class. Method signatures and docstrings: - def __init__(self, function): function: instance of Function - def run(self, abs_tol=1e-05, rel_tol=0.001, step_break=100, max_step=5000): abs_tol, rel_tol, step_br...
e12ea464e7845793c88adfff6da4c8454099c03b
<|skeleton|> class GradientDescent: def __init__(self, function): """function: instance of Function""" <|body_0|> def run(self, abs_tol=1e-05, rel_tol=0.001, step_break=100, max_step=5000): """abs_tol, rel_tol, step_break: stop when _check<1 (_check is what update should return) for st...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GradientDescent: def __init__(self, function): """function: instance of Function""" self.function = function self.f_min = function(function.x) self.steps = [] self.steps.append(self.function.x[:]) self.dim = self.function.dim def run(self, abs_tol=1e-05, re...
the_stack_v2_python_sparse
Optimization/Minimization/Gradient-Descent/python/GD/GradientDescent.py
dkaramit/ASAP
train
2
ab7379a4c9a97f98b95ce3f1338bd27c9e10e034
[ "self.min_loss = float('inf')\nself.max_acc = -float('inf')\nself.min_delta = min_delta\nself.model_name = model_name\nself.path = str(os.path.join(model_dir, self.model_name + '.pth'))\nself.count = 0\nself.first_run = True\nself.best_model = None", "print(f'Loss to beat: {self.min_loss - self.min_delta:.4f}')\n...
<|body_start_0|> self.min_loss = float('inf') self.max_acc = -float('inf') self.min_delta = min_delta self.model_name = model_name self.path = str(os.path.join(model_dir, self.model_name + '.pth')) self.count = 0 self.first_run = True self.best_model = Non...
EarlyStopping
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EarlyStopping: def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): """Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representin...
stack_v2_sparse_classes_75kplus_train_066723
29,312
permissive
[ { "docstring": "Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing the current fold. `min_delta` : `int`, `optional` Smallest number the given metric needs to change in...
2
stack_v2_sparse_classes_30k_train_010416
Implement the Python class `EarlyStopping` described below. Class description: Implement the EarlyStopping class. Method signatures and docstrings: - def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ----...
Implement the Python class `EarlyStopping` described below. Class description: Implement the EarlyStopping class. Method signatures and docstrings: - def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ----...
d0ee019e5a573bf9b8e232786a9051cd54904487
<|skeleton|> class EarlyStopping: def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): """Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EarlyStopping: def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): """Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing the current ...
the_stack_v2_python_sparse
pytorch_vision_utils/TrainingUtilities.py
nclgbd/PyTorch-Utilities
train
0
4622c1a5c2e40cf57298b5f0f6a15c2fc60b69b5
[ "if not self.klass:\n self.klass = str(klass)\nelse:\n parts = self.klass.split() + [str(klass)]\n seen = {}\n unique = []\n for item in parts:\n if item in seen:\n continue\n seen[item] = 1\n unique.append(item)\n self.klass = ' '.join(unique)", "super().update()...
<|body_start_0|> if not self.klass: self.klass = str(klass) else: parts = self.klass.split() + [str(klass)] seen = {} unique = [] for item in parts: if item in seen: continue seen[item] = 1 ...
HTML form element
HTMLFormElement
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTMLFormElement: """HTML form element""" def add_class(self, klass): """See IHTMLFormElement""" <|body_0|> def update(self): """See z3c.form.IWidget""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not self.klass: self.klass = str(...
stack_v2_sparse_classes_75kplus_train_066724
8,027
permissive
[ { "docstring": "See IHTMLFormElement", "name": "add_class", "signature": "def add_class(self, klass)" }, { "docstring": "See z3c.form.IWidget", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_011814
Implement the Python class `HTMLFormElement` described below. Class description: HTML form element Method signatures and docstrings: - def add_class(self, klass): See IHTMLFormElement - def update(self): See z3c.form.IWidget
Implement the Python class `HTMLFormElement` described below. Class description: HTML form element Method signatures and docstrings: - def add_class(self, klass): See IHTMLFormElement - def update(self): See z3c.form.IWidget <|skeleton|> class HTMLFormElement: """HTML form element""" def add_class(self, kla...
e83e2ce314355f98eaf66e90ad6feccbda7934f9
<|skeleton|> class HTMLFormElement: """HTML form element""" def add_class(self, klass): """See IHTMLFormElement""" <|body_0|> def update(self): """See z3c.form.IWidget""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HTMLFormElement: """HTML form element""" def add_class(self, klass): """See IHTMLFormElement""" if not self.klass: self.klass = str(klass) else: parts = self.klass.split() + [str(klass)] seen = {} unique = [] for item in ...
the_stack_v2_python_sparse
src/pyams_form/browser/widget.py
Py-AMS/pyams-form
train
0
8b21e392f5d54b43ece8cebe847f55c82b16b411
[ "self.head = None\nself.tail = None\nself.capacity = capacity\nself.map = {}", "if key in self.map:\n node = self.map[key]\n if self.tail == node:\n return node.val\n if self.head == node:\n q = node.next\n self.head = q\n q.prev = None\n node.next = None\n node....
<|body_start_0|> self.head = None self.tail = None self.capacity = capacity self.map = {} <|end_body_0|> <|body_start_1|> if key in self.map: node = self.map[key] if self.tail == node: return node.val if self.head == node: ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_066725
2,729
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_040991
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
1d8821da01c9c200732a6b7037b8631689e2f7e7
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.head = None self.tail = None self.capacity = capacity self.map = {} def get(self, key): """:type key: int :rtype: int""" if key in self.map: node = self.map[key] ...
the_stack_v2_python_sparse
Leetcode0146.py
xiaojinghu/Leetcode
train
0
c0e22ab8e22635b2397d9884cb859849663e7459
[ "self.white_circle = pygame.Surface((screen_size_x, screen_size_y), flags=pygame.SRCALPHA)\nself.white_circle.fill((255, 255, 255))\ndist_from_center = numpy.zeros((screen_size_x, screen_size_y), dtype='i4')\nsemi_size_x = screen_size_x // 2\nsemi_size_y = screen_size_y // 2\nfor x in range(screen_size_x):\n for...
<|body_start_0|> self.white_circle = pygame.Surface((screen_size_x, screen_size_y), flags=pygame.SRCALPHA) self.white_circle.fill((255, 255, 255)) dist_from_center = numpy.zeros((screen_size_x, screen_size_y), dtype='i4') semi_size_x = screen_size_x // 2 semi_size_y = screen_size...
Animation Object affichant à la fin de l'animation un cercle blanc qui grandit progressivement. À la fin, le cercle prend tout l'écran, et on ne voit plus que du blanc à l'écran. Les images représentant ce cercle sont entièrement de la couleur blanche. Ce qui varie, c'est la transparence. Certains pixels sont transpare...
WhiteCircleAtEnd
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WhiteCircleAtEnd: """Animation Object affichant à la fin de l'animation un cercle blanc qui grandit progressivement. À la fin, le cercle prend tout l'écran, et on ne voit plus que du blanc à l'écran. Les images représentant ce cercle sont entièrement de la couleur blanche. Ce qui varie, c'est la ...
stack_v2_sparse_classes_75kplus_train_066726
9,002
permissive
[ { "docstring": "Pré-calcul des cercles. Cette fonction définit deux variables membres : self.white_circle : objet pygame.Surface ayant la taille de l'écran, et entièrement constitué de pixels blancs. Cette Surface possède une transparence (alpha channel), mais celle-ci n'est pas prédéfinie dans la Surface. self...
2
null
Implement the Python class `WhiteCircleAtEnd` described below. Class description: Animation Object affichant à la fin de l'animation un cercle blanc qui grandit progressivement. À la fin, le cercle prend tout l'écran, et on ne voit plus que du blanc à l'écran. Les images représentant ce cercle sont entièrement de la c...
Implement the Python class `WhiteCircleAtEnd` described below. Class description: Animation Object affichant à la fin de l'animation un cercle blanc qui grandit progressivement. À la fin, le cercle prend tout l'écran, et on ne voit plus que du blanc à l'écran. Les images représentant ce cercle sont entièrement de la c...
afbd141186e6bced8b7ceda52170a10741175111
<|skeleton|> class WhiteCircleAtEnd: """Animation Object affichant à la fin de l'animation un cercle blanc qui grandit progressivement. À la fin, le cercle prend tout l'écran, et on ne voit plus que du blanc à l'écran. Les images représentant ce cercle sont entièrement de la couleur blanche. Ce qui varie, c'est la ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WhiteCircleAtEnd: """Animation Object affichant à la fin de l'animation un cercle blanc qui grandit progressivement. À la fin, le cercle prend tout l'écran, et on ne voit plus que du blanc à l'écran. Les images représentant ce cercle sont entièrement de la couleur blanche. Ce qui varie, c'est la transparence....
the_stack_v2_python_sparse
code/white_circle_at_end.py
darkrecher/anim-tunnel-utbm
train
0
3111a3e3fe013fa15418adbdc9e47df1f519ea4e
[ "self.isKey = False\nself.val = 0\nself.kids = dict()", "current_node = self\nfor idx, letter in enumerate(key):\n if letter not in current_node.kids:\n current_node.kids[letter] = MapSum()\n current_node = current_node.kids[letter]\n if idx == len(key) - 1:\n current_node.val = val\n ...
<|body_start_0|> self.isKey = False self.val = 0 self.kids = dict() <|end_body_0|> <|body_start_1|> current_node = self for idx, letter in enumerate(key): if letter not in current_node.kids: current_node.kids[letter] = MapSum() current_nod...
MapSum
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapSum: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, key, val): """:type key: str :type val: int :rtype: void""" <|body_1|> def sum(self, prefix): """:type prefix: str :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_066727
1,659
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type key: str :type val: int :rtype: void", "name": "insert", "signature": "def insert(self, key, val)" }, { "docstring": ":type prefix: str :rtype: in...
3
stack_v2_sparse_classes_30k_train_040063
Implement the Python class `MapSum` described below. Class description: Implement the MapSum class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, key, val): :type key: str :type val: int :rtype: void - def sum(self, prefix): :type prefix: str :rtype: i...
Implement the Python class `MapSum` described below. Class description: Implement the MapSum class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, key, val): :type key: str :type val: int :rtype: void - def sum(self, prefix): :type prefix: str :rtype: i...
f462b66ae849f4332a4b150f206dd49c7519e83b
<|skeleton|> class MapSum: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, key, val): """:type key: str :type val: int :rtype: void""" <|body_1|> def sum(self, prefix): """:type prefix: str :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MapSum: def __init__(self): """Initialize your data structure here.""" self.isKey = False self.val = 0 self.kids = dict() def insert(self, key, val): """:type key: str :type val: int :rtype: void""" current_node = self for idx, letter in enumerate(k...
the_stack_v2_python_sparse
LeetCode/DataStructure/trie/map_sum.py
hooyao/Coding-Py3
train
0
76ae62fd546e7ad5cd4844054e9dbb6b390f2e62
[ "self.index_map = copy.deepcopy(index_map)\nself.index_weights = numpy.array([(self.index_map == X).sum() for X in range(0, 1 + self.index_map.max())])\nself.pseudocount_mask = pseudocount_array > 0\nPseudocountTransitionEstimator.__init__(self, pseudocount_array)", "A_raw = sum(reduced_data)\nA_sum = A_raw.sum()...
<|body_start_0|> self.index_map = copy.deepcopy(index_map) self.index_weights = numpy.array([(self.index_map == X).sum() for X in range(0, 1 + self.index_map.max())]) self.pseudocount_mask = pseudocount_array > 0 PseudocountTransitionEstimator.__init__(self, pseudocount_array) <|end_body...
Estimate state prior probabilities, but tying (pooling data for and then jointly estimating) comparable states (e.g. all single states, all compound states).
TiedTransitionEstimator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TiedTransitionEstimator: """Estimate state prior probabilities, but tying (pooling data for and then jointly estimating) comparable states (e.g. all single states, all compound states).""" def __init__(self, pseudocount_array, index_map): """pseudocount_array : float or numpy.ndarray...
stack_v2_sparse_classes_75kplus_train_066728
35,700
permissive
[ { "docstring": "pseudocount_array : float or numpy.ndarray Scalar (if evenly applying pseudocounts) or numpy array (if assymetrically weighting pseudocounts) pseudocounts to apply during estimation. index_map : numpy.ndarray a `NUM_STATES x NUM_STATES` table vector in which cells containing identical integer va...
2
null
Implement the Python class `TiedTransitionEstimator` described below. Class description: Estimate state prior probabilities, but tying (pooling data for and then jointly estimating) comparable states (e.g. all single states, all compound states). Method signatures and docstrings: - def __init__(self, pseudocount_arra...
Implement the Python class `TiedTransitionEstimator` described below. Class description: Estimate state prior probabilities, but tying (pooling data for and then jointly estimating) comparable states (e.g. all single states, all compound states). Method signatures and docstrings: - def __init__(self, pseudocount_arra...
f0adf48f0d68a2bd35a8eb092fb976915bfdd2f3
<|skeleton|> class TiedTransitionEstimator: """Estimate state prior probabilities, but tying (pooling data for and then jointly estimating) comparable states (e.g. all single states, all compound states).""" def __init__(self, pseudocount_array, index_map): """pseudocount_array : float or numpy.ndarray...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TiedTransitionEstimator: """Estimate state prior probabilities, but tying (pooling data for and then jointly estimating) comparable states (e.g. all single states, all compound states).""" def __init__(self, pseudocount_array, index_map): """pseudocount_array : float or numpy.ndarray Scalar (if e...
the_stack_v2_python_sparse
minihmm/estimators.py
joshuagryphon/minihmm
train
0
458e34f8f79c683f40167f7823de342cdcfeb9c4
[ "self.stretchFromDistanceOverExtrusionWidth = preferences.FloatPreference().getFromValue('Stretch From Distance Over Extrusion Width (ratio):', 2.0)\nself.stretchOverHalfExtrusionWidth = preferences.FloatPreference().getFromValue('Maximum Stretch Over Half Extrusion Width (ratio):', 0.3)\nself.travelOverExtrusionSt...
<|body_start_0|> self.stretchFromDistanceOverExtrusionWidth = preferences.FloatPreference().getFromValue('Stretch From Distance Over Extrusion Width (ratio):', 2.0) self.stretchOverHalfExtrusionWidth = preferences.FloatPreference().getFromValue('Maximum Stretch Over Half Extrusion Width (ratio):', 0.3) ...
A class to handle the stretch preferences.
StretchPreferences
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StretchPreferences: """A class to handle the stretch preferences.""" def __init__(self): """Set the default preferences, execute title & preferences filename.""" <|body_0|> def execute(self): """Stretch button has been clicked.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_066729
15,799
no_license
[ { "docstring": "Set the default preferences, execute title & preferences filename.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Stretch button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
null
Implement the Python class `StretchPreferences` described below. Class description: A class to handle the stretch preferences. Method signatures and docstrings: - def __init__(self): Set the default preferences, execute title & preferences filename. - def execute(self): Stretch button has been clicked.
Implement the Python class `StretchPreferences` described below. Class description: A class to handle the stretch preferences. Method signatures and docstrings: - def __init__(self): Set the default preferences, execute title & preferences filename. - def execute(self): Stretch button has been clicked. <|skeleton|> ...
e9c79463de7d4230a440f2ab1700dd89411db0e9
<|skeleton|> class StretchPreferences: """A class to handle the stretch preferences.""" def __init__(self): """Set the default preferences, execute title & preferences filename.""" <|body_0|> def execute(self): """Stretch button has been clicked.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StretchPreferences: """A class to handle the stretch preferences.""" def __init__(self): """Set the default preferences, execute title & preferences filename.""" self.stretchFromDistanceOverExtrusionWidth = preferences.FloatPreference().getFromValue('Stretch From Distance Over Extrusion W...
the_stack_v2_python_sparse
Toolchain/stretch.py
dmstan/linuxCNC_to_3DPrinter
train
0
4c0312dc8f3ee2d4a6cb3382855135b44d47f9c6
[ "head = 0\nlongest = 0\ndic = {}\nfor i in range(len(s)):\n if s[i] not in dic:\n dic[s[i]] = i\n else:\n if dic[s[i]] >= head:\n head = dic[s[i]] + 1\n dic[s[i]] = i\n longest = i - head + 1 if i - head + 1 > longest else longest\nreturn longest", "head = 0\nlongest = 0\n...
<|body_start_0|> head = 0 longest = 0 dic = {} for i in range(len(s)): if s[i] not in dic: dic[s[i]] = i else: if dic[s[i]] >= head: head = dic[s[i]] + 1 dic[s[i]] = i longest = i - he...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> head = 0 longest = 0 dic =...
stack_v2_sparse_classes_75kplus_train_066730
2,425
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring1", "signature": "def lengthOfLongestSubstring1(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_029984
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring(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 lengthOfLongestSubstring1(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOf...
4012c16ccedeebc7852fda707a2399ecb0b5b60a
<|skeleton|> class Solution: def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring(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 lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" head = 0 longest = 0 dic = {} for i in range(len(s)): if s[i] not in dic: dic[s[i]] = i else: if dic[s[i]] >= head: ...
the_stack_v2_python_sparse
py/3.py
XMK233/Leetcode-Journey
train
0
1c82a91fe2104ddc274843561154d95fc7a4897c
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jyaang_robinliu106', 'jyaang_robinliu106')\ndayCamp_List = repo['jyaang_robinliu106.dayCamp']\ncityMap = Code('function () {\\n var cityList = {};\\n var name = this.name;\\n cityLis...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jyaang_robinliu106', 'jyaang_robinliu106') dayCamp_List = repo['jyaang_robinliu106.dayCamp'] cityMap = Code('function () {\n var cityList =...
dayCampsPerNeighborhood
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dayCampsPerNeighborhood: 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 ...
stack_v2_sparse_classes_75kplus_train_066731
4,227
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_val_001304
Implement the Python class `dayCampsPerNeighborhood` described below. Class description: Implement the dayCampsPerNeighborhood 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(...
Implement the Python class `dayCampsPerNeighborhood` described below. Class description: Implement the dayCampsPerNeighborhood 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(...
9cb0ad789b6ff265222cbd3ea3561ff553b4cdff
<|skeleton|> class dayCampsPerNeighborhood: 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 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class dayCampsPerNeighborhood: 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('jyaang_robinliu106', 'jyaan...
the_stack_v2_python_sparse
jyaang_robinliu/dayCampsPerNeighborhood.py
yinghang/course-2016-fal-proj
train
1
31f703f2a549654175eb638b6da5b5aa6ae96102
[ "self.fg = fg\nself.x0 = x0\nself.alpha = alpha\nself.x = x0.copy()\nself.accumulator = np.zeros_like(self.x)\nself.eps = np.finfo(x0.dtype).eps\nself.iter = 0", "f, g = self.fg(self.x)\nself.accumulator += g * g\nx = self.x\nself.x = x - self.alpha * g / (np.sqrt(self.accumulator) + self.eps)\nself.iter += 1\nre...
<|body_start_0|> self.fg = fg self.x0 = x0 self.alpha = alpha self.x = x0.copy() self.accumulator = np.zeros_like(self.x) self.eps = np.finfo(x0.dtype).eps self.iter = 0 <|end_body_0|> <|body_start_1|> f, g = self.fg(self.x) self.accumulator += g ...
Adaptive Gradient Descent optimization routine. Gradient Descent has the same step size for each parameter. Adagrad self- learns a unique step size for each parameter based on accumulation of the square of the gradient over the course of optimization. The update is: .. math:: s_k &= s_{k-1} + (g*g) \\\\ x_{k+1} &= x_k ...
AdaGrad
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaGrad: """Adaptive Gradient Descent optimization routine. Gradient Descent has the same step size for each parameter. Adagrad self- learns a unique step size for each parameter based on accumulation of the square of the gradient over the course of optimization. The update is: .. math:: s_k &= s...
stack_v2_sparse_classes_75kplus_train_066732
25,830
permissive
[ { "docstring": "Create a new AdaGrad optimizer. Parameters ---------- fg : callable a function which returns (f, g) where f is the scalar cost, and g is the vector gradient. x0 : callable the parameter vector immediately prior to optimization alpha : float the step size", "name": "__init__", "signature"...
2
stack_v2_sparse_classes_30k_train_036152
Implement the Python class `AdaGrad` described below. Class description: Adaptive Gradient Descent optimization routine. Gradient Descent has the same step size for each parameter. Adagrad self- learns a unique step size for each parameter based on accumulation of the square of the gradient over the course of optimiza...
Implement the Python class `AdaGrad` described below. Class description: Adaptive Gradient Descent optimization routine. Gradient Descent has the same step size for each parameter. Adagrad self- learns a unique step size for each parameter based on accumulation of the square of the gradient over the course of optimiza...
af89c94d500a274eda664188ddb97fcae30c6ac5
<|skeleton|> class AdaGrad: """Adaptive Gradient Descent optimization routine. Gradient Descent has the same step size for each parameter. Adagrad self- learns a unique step size for each parameter based on accumulation of the square of the gradient over the course of optimization. The update is: .. math:: s_k &= s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdaGrad: """Adaptive Gradient Descent optimization routine. Gradient Descent has the same step size for each parameter. Adagrad self- learns a unique step size for each parameter based on accumulation of the square of the gradient over the course of optimization. The update is: .. math:: s_k &= s_{k-1} + (g*g...
the_stack_v2_python_sparse
prysm/x/optym/optimizers.py
brandondube/prysm
train
192
ed7deaf2e4593888b396e0885c5403d324b44d42
[ "data = self.env.copy()\nif cutoff is None:\n cutoff = 1 + len(data) // self.batch\npbar = tqdm(total=min(len(data) // self.batch * self.batch, cutoff * self.batch), position=pos, desc=name)\nagent = Agent(self.shape, self.batch, self.encode)\niteration = 0\nseen = {}\nevaluators = [(metric, eval(metric, environ...
<|body_start_0|> data = self.env.copy() if cutoff is None: cutoff = 1 + len(data) // self.batch pbar = tqdm(total=min(len(data) // self.batch * self.batch, cutoff * self.batch), position=pos, desc=name) agent = Agent(self.shape, self.batch, self.encode) iteration = 0 ...
Stores labeled sequences, reserving some for validation, and runs agents on them. Should be extended with custom constructor to set up data.
_Env
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Env: """Stores labeled sequences, reserving some for validation, and runs agents on them. Should be extended with custom constructor to set up data.""" def run(self, Agent, cutoff, metrics, name=None, pos=0): """Run agent, getting batch-sized list of actions (sequences) to try, and ...
stack_v2_sparse_classes_75kplus_train_066733
11,447
no_license
[ { "docstring": "Run agent, getting batch-sized list of actions (sequences) to try, and calling observe with the labeled sequences until all sequences have been tried (or the batch number specified by the cutoff parameter has been reached). Returns a dictionary mapping each metric in metrics to its evaluation at...
2
stack_v2_sparse_classes_30k_train_037594
Implement the Python class `_Env` described below. Class description: Stores labeled sequences, reserving some for validation, and runs agents on them. Should be extended with custom constructor to set up data. Method signatures and docstrings: - def run(self, Agent, cutoff, metrics, name=None, pos=0): Run agent, get...
Implement the Python class `_Env` described below. Class description: Stores labeled sequences, reserving some for validation, and runs agents on them. Should be extended with custom constructor to set up data. Method signatures and docstrings: - def run(self, Agent, cutoff, metrics, name=None, pos=0): Run agent, get...
ab7f75f619c7c4a9cab06759f868137b43ab0b08
<|skeleton|> class _Env: """Stores labeled sequences, reserving some for validation, and runs agents on them. Should be extended with custom constructor to set up data.""" def run(self, Agent, cutoff, metrics, name=None, pos=0): """Run agent, getting batch-sized list of actions (sequences) to try, and ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Env: """Stores labeled sequences, reserving some for validation, and runs agents on them. Should be extended with custom constructor to set up data.""" def run(self, Agent, cutoff, metrics, name=None, pos=0): """Run agent, getting batch-sized list of actions (sequences) to try, and calling obser...
the_stack_v2_python_sparse
gym_batgirl/gym_batgirl/utils/env.py
vivekmyers/batgirl-sequence-optimization
train
1
23f1b8647cce82f9a5b7fe535fc1eddb37fbf8b9
[ "self.file_path = file_path\nself.skus = dsc_set(allowed_classes=[definition, sku_id])\nself.components = dsc_dict(allowed_key_classes=[dsc_section_type], allowed_value_classes=[component, definition])\nself.libraries = dsc_dict(allowed_key_classes=[dsc_section_type], allowed_value_classes=[library, definition])\ns...
<|body_start_0|> self.file_path = file_path self.skus = dsc_set(allowed_classes=[definition, sku_id]) self.components = dsc_dict(allowed_key_classes=[dsc_section_type], allowed_value_classes=[component, definition]) self.libraries = dsc_dict(allowed_key_classes=[dsc_section_type], allowe...
Class representing a DSC.
dsc
[ "BSD-2-Clause-Patent" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dsc: """Class representing a DSC.""" def __init__(self, file_path=None): """Inits dsc type.""" <|body_0|> def __eq__(self, other): """Enables equality comparisons (a == b). Warning: This doesn't check for a perfect copy of everything this is mainly focused on doe...
stack_v2_sparse_classes_75kplus_train_066734
25,923
permissive
[ { "docstring": "Inits dsc type.", "name": "__init__", "signature": "def __init__(self, file_path=None)" }, { "docstring": "Enables equality comparisons (a == b). Warning: This doesn't check for a perfect copy of everything this is mainly focused on does it define the same things", "name": "_...
2
null
Implement the Python class `dsc` described below. Class description: Class representing a DSC. Method signatures and docstrings: - def __init__(self, file_path=None): Inits dsc type. - def __eq__(self, other): Enables equality comparisons (a == b). Warning: This doesn't check for a perfect copy of everything this is ...
Implement the Python class `dsc` described below. Class description: Class representing a DSC. Method signatures and docstrings: - def __init__(self, file_path=None): Inits dsc type. - def __eq__(self, other): Enables equality comparisons (a == b). Warning: This doesn't check for a perfect copy of everything this is ...
78295929b37af62a8cfc4c28eab72ed0c468f350
<|skeleton|> class dsc: """Class representing a DSC.""" def __init__(self, file_path=None): """Inits dsc type.""" <|body_0|> def __eq__(self, other): """Enables equality comparisons (a == b). Warning: This doesn't check for a perfect copy of everything this is mainly focused on doe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class dsc: """Class representing a DSC.""" def __init__(self, file_path=None): """Inits dsc type.""" self.file_path = file_path self.skus = dsc_set(allowed_classes=[definition, sku_id]) self.components = dsc_dict(allowed_key_classes=[dsc_section_type], allowed_value_classes=[com...
the_stack_v2_python_sparse
edk2toollib/uefi/edk2/build_objects/dsc.py
tianocore/edk2-pytool-library
train
47
12a492986c55e3ab2fec5c015c5bb84bee15386a
[ "super(VGGNet, self).__init__()\nself.vgg = models.vgg19_bn(pretrained=True)\nself.vgg_features = self.vgg.features\nself.fc_features = nn.Sequential(*list(self.vgg.classifier.children())[:-2])", "features = self.vgg_features(x).view(x.shape[0], -1)\nfeatures = self.fc_features(features)\nreturn features" ]
<|body_start_0|> super(VGGNet, self).__init__() self.vgg = models.vgg19_bn(pretrained=True) self.vgg_features = self.vgg.features self.fc_features = nn.Sequential(*list(self.vgg.classifier.children())[:-2]) <|end_body_0|> <|body_start_1|> features = self.vgg_features(x).view(x.s...
VGGNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VGGNet: def __init__(self): """Select conv1_1 ~ conv5_1 activation maps.""" <|body_0|> def forward(self, x): """Extract multiple convolutional feature maps.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(VGGNet, self).__init__() self....
stack_v2_sparse_classes_75kplus_train_066735
3,516
no_license
[ { "docstring": "Select conv1_1 ~ conv5_1 activation maps.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Extract multiple convolutional feature maps.", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `VGGNet` described below. Class description: Implement the VGGNet class. Method signatures and docstrings: - def __init__(self): Select conv1_1 ~ conv5_1 activation maps. - def forward(self, x): Extract multiple convolutional feature maps.
Implement the Python class `VGGNet` described below. Class description: Implement the VGGNet class. Method signatures and docstrings: - def __init__(self): Select conv1_1 ~ conv5_1 activation maps. - def forward(self, x): Extract multiple convolutional feature maps. <|skeleton|> class VGGNet: def __init__(self)...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class VGGNet: def __init__(self): """Select conv1_1 ~ conv5_1 activation maps.""" <|body_0|> def forward(self, x): """Extract multiple convolutional feature maps.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VGGNet: def __init__(self): """Select conv1_1 ~ conv5_1 activation maps.""" super(VGGNet, self).__init__() self.vgg = models.vgg19_bn(pretrained=True) self.vgg_features = self.vgg.features self.fc_features = nn.Sequential(*list(self.vgg.classifier.children())[:-2]) ...
the_stack_v2_python_sparse
generated/test_penghu_cs_DSCMR.py
jansel/pytorch-jit-paritybench
train
35
a30dc668ed4919bd8a22cc3bec519de812a774a5
[ "print('Inside __init__()')\nself.arg1 = arg1\nself.arg2 = arg2\nself.arg3 = arg3", "print('Inside __call__()')\n\ndef wrapped_f(*args):\n print('Inside wrapped_f()')\n print('Decorator arguments:', self.arg1, self.arg2, self.arg3)\n f(*args)\n print('After f(*args)')\nreturn wrapped_f" ]
<|body_start_0|> print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 <|end_body_0|> <|body_start_1|> print('Inside __call__()') def wrapped_f(*args): print('Inside wrapped_f()') print('Decorator arguments:', self.arg1, s...
DecoratorWithArguments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_75kplus_train_066736
2,861
no_license
[ { "docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!", "name": "__init__", "signature": "def __init__(self, arg1, arg2, arg3)" }, { "docstring": "If there are decorator arguments, __call__() is only called once, as part of the decoratio...
2
stack_v2_sparse_classes_30k_train_046399
Implement the Python class `DecoratorWithArguments` described below. Class description: Implement the DecoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
Implement the Python class `DecoratorWithArguments` described below. Class description: Implement the DecoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
d0b821a48a05f0ec28db73351b6e7a07b435b4a5
<|skeleton|> class DecoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DecoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 def __call__(self, f):...
the_stack_v2_python_sparse
src/main/python/lang/decorator_example.py
solma/com.sma
train
4
b1caf9569175fdab2b1fb78317c8efa1a91f47d6
[ "self.robocrys = robocrys\nself.robocrys_audio = robocrys_audio\nself.service_keyfile_path = service_keyfile_path\nself.kwargs = kwargs\nsuper().__init__(source=self.robocrys, target=self.robocrys_audio, ufn=self.get_audio, projection=['description'], **kwargs)", "os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = se...
<|body_start_0|> self.robocrys = robocrys self.robocrys_audio = robocrys_audio self.service_keyfile_path = service_keyfile_path self.kwargs = kwargs super().__init__(source=self.robocrys, target=self.robocrys_audio, ufn=self.get_audio, projection=['description'], **kwargs) <|end_...
TextToSpeech
[ "LicenseRef-scancode-hdf5", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextToSpeech: def __init__(self, robocrys, robocrys_audio, service_keyfile_path=None, **kwargs): """Calls Google Cloud Text-to-Speech API to build MP3 audio for robocrystallographer text descriptions. NOTE: This has been tested only informally and is not currently used to build audio on ...
stack_v2_sparse_classes_75kplus_train_066737
4,599
permissive
[ { "docstring": "Calls Google Cloud Text-to-Speech API to build MP3 audio for robocrystallographer text descriptions. NOTE: This has been tested only informally and is not currently used to build audio on the MP website. Rather, the `SpeechSynthesisUtterance` functionality native to modern web browsers is curren...
2
null
Implement the Python class `TextToSpeech` described below. Class description: Implement the TextToSpeech class. Method signatures and docstrings: - def __init__(self, robocrys, robocrys_audio, service_keyfile_path=None, **kwargs): Calls Google Cloud Text-to-Speech API to build MP3 audio for robocrystallographer text ...
Implement the Python class `TextToSpeech` described below. Class description: Implement the TextToSpeech class. Method signatures and docstrings: - def __init__(self, robocrys, robocrys_audio, service_keyfile_path=None, **kwargs): Calls Google Cloud Text-to-Speech API to build MP3 audio for robocrystallographer text ...
2540fd8f6905be7290ead1b8a9dadca84d5d03fa
<|skeleton|> class TextToSpeech: def __init__(self, robocrys, robocrys_audio, service_keyfile_path=None, **kwargs): """Calls Google Cloud Text-to-Speech API to build MP3 audio for robocrystallographer text descriptions. NOTE: This has been tested only informally and is not currently used to build audio on ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextToSpeech: def __init__(self, robocrys, robocrys_audio, service_keyfile_path=None, **kwargs): """Calls Google Cloud Text-to-Speech API to build MP3 audio for robocrystallographer text descriptions. NOTE: This has been tested only informally and is not currently used to build audio on the MP website...
the_stack_v2_python_sparse
emmet/materials/robocrys.py
jerrymlin/emmet
train
2
7fb406df0f4469af9f0184bcfe19b735b297057e
[ "self.activation = activation\nself.optimizer = optimizer\nself.weights = np.random.randn(output_size, input_size) * self.activation.heuristic(input_size)\nself.bias = np.ones((output_size, 1))", "self.input = input_data\nself.pre_activation = np.dot(self.weights, self.input) + self.bias\nself.activation_output =...
<|body_start_0|> self.activation = activation self.optimizer = optimizer self.weights = np.random.randn(output_size, input_size) * self.activation.heuristic(input_size) self.bias = np.ones((output_size, 1)) <|end_body_0|> <|body_start_1|> self.input = input_data self.pre...
This class contains everything related to FC Layer. Attributes: activation (object): Instance of the activation function of the layer. activation_output (array): Output of the activation function. bias (array): Bias of the layer, depends of the input and ouput size of the layer. dBias (array): Derivative of the bias. d...
FCLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FCLayer: """This class contains everything related to FC Layer. Attributes: activation (object): Instance of the activation function of the layer. activation_output (array): Output of the activation function. bias (array): Bias of the layer, depends of the input and ouput size of the layer. dBias...
stack_v2_sparse_classes_75kplus_train_066738
3,623
no_license
[ { "docstring": "Initialize our FC Layer. Args: input_size (int): Size of what comes into the layer. output_size (int): Size of what comes out of the layer. activation (object): Instance of the activation function class picked for this layer. optimizer (object): Instance of the optimizer class picked for the neu...
3
stack_v2_sparse_classes_30k_train_023999
Implement the Python class `FCLayer` described below. Class description: This class contains everything related to FC Layer. Attributes: activation (object): Instance of the activation function of the layer. activation_output (array): Output of the activation function. bias (array): Bias of the layer, depends of the i...
Implement the Python class `FCLayer` described below. Class description: This class contains everything related to FC Layer. Attributes: activation (object): Instance of the activation function of the layer. activation_output (array): Output of the activation function. bias (array): Bias of the layer, depends of the i...
d2243139fb4374e9716e7eaeb60f5de9d65fe367
<|skeleton|> class FCLayer: """This class contains everything related to FC Layer. Attributes: activation (object): Instance of the activation function of the layer. activation_output (array): Output of the activation function. bias (array): Bias of the layer, depends of the input and ouput size of the layer. dBias...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FCLayer: """This class contains everything related to FC Layer. Attributes: activation (object): Instance of the activation function of the layer. activation_output (array): Output of the activation function. bias (array): Bias of the layer, depends of the input and ouput size of the layer. dBias (array): Der...
the_stack_v2_python_sparse
layers/fc_layer.py
passion4energy/Elyane
train
0
dade4a359d421bd76494d53e10649ef2d7a32b09
[ "super(QFlowWidgetItem, self).__init__(widget)\nself.data = data\nself._cached_hint = QSize()\nself._cached_max = QSize()\nself._cached_min = QSize()", "if not self._cached_max.isValid():\n self._cached_max = super(QFlowWidgetItem, self).maximumSize()\nreturn self._cached_max", "if not self._cached_min.isVal...
<|body_start_0|> super(QFlowWidgetItem, self).__init__(widget) self.data = data self._cached_hint = QSize() self._cached_max = QSize() self._cached_min = QSize() <|end_body_0|> <|body_start_1|> if not self._cached_max.isValid(): self._cached_max = super(QFlow...
A custom QWidgetItem for use with the QFlowLayout.
QFlowWidgetItem
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QFlowWidgetItem: """A custom QWidgetItem for use with the QFlowLayout.""" def __init__(self, widget, data): """Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this i...
stack_v2_sparse_classes_75kplus_train_066739
39,042
permissive
[ { "docstring": "Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this item.", "name": "__init__", "signature": "def __init__(self, widget, data)" }, { "docstring": "Reimplemented...
6
stack_v2_sparse_classes_30k_test_002197
Implement the Python class `QFlowWidgetItem` described below. Class description: A custom QWidgetItem for use with the QFlowLayout. Method signatures and docstrings: - def __init__(self, widget, data): Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : Flo...
Implement the Python class `QFlowWidgetItem` described below. Class description: A custom QWidgetItem for use with the QFlowLayout. Method signatures and docstrings: - def __init__(self, widget, data): Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : Flo...
1544e7fb371b8f941cfa2fde682795e479380284
<|skeleton|> class QFlowWidgetItem: """A custom QWidgetItem for use with the QFlowLayout.""" def __init__(self, widget, data): """Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QFlowWidgetItem: """A custom QWidgetItem for use with the QFlowLayout.""" def __init__(self, widget, data): """Initialize a QFlowWidgetItem. Parameters ---------- widget : QWidget The widget to manage with this item. data : FlowLayoutData The layout data struct associated with this item.""" ...
the_stack_v2_python_sparse
enaml/qt/q_flow_layout.py
MatthieuDartiailh/enaml
train
26
7070cc41095830e70d06b89106844c1af000faf5
[ "for key in input_constraints:\n if key not in ['max_actions', 'max_subtransformer_actions']:\n raise ValueError(key + ' is an unrecognized constraint type')\n elif key == 'max_subtransformer_actions':\n if isinstance(input_constraints[key], list):\n if any(np.array(input_constraints[...
<|body_start_0|> for key in input_constraints: if key not in ['max_actions', 'max_subtransformer_actions']: raise ValueError(key + ' is an unrecognized constraint type') elif key == 'max_subtransformer_actions': if isinstance(input_constraints[key], list):...
BinaryTransformer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTransformer: def __init__(self, subtransformer_args, input_constraints={}, input_processer=None): """Initialize a `BinaryTransformer` object. :param subtransformer_list: The functions to be used to transform the input of a certain data type. :param input_constraints: The constraint...
stack_v2_sparse_classes_75kplus_train_066740
7,721
permissive
[ { "docstring": "Initialize a `BinaryTransformer` object. :param subtransformer_list: The functions to be used to transform the input of a certain data type. :param input_constraints: The constraints to enforce on the input after transformation. The possible enforcement values are: - max_actions: An int represen...
4
stack_v2_sparse_classes_30k_val_000056
Implement the Python class `BinaryTransformer` described below. Class description: Implement the BinaryTransformer class. Method signatures and docstrings: - def __init__(self, subtransformer_args, input_constraints={}, input_processer=None): Initialize a `BinaryTransformer` object. :param subtransformer_list: The fu...
Implement the Python class `BinaryTransformer` described below. Class description: Implement the BinaryTransformer class. Method signatures and docstrings: - def __init__(self, subtransformer_args, input_constraints={}, input_processer=None): Initialize a `BinaryTransformer` object. :param subtransformer_list: The fu...
14ec296603a3a0cbd0a0ff0dceebf4cd48e24de9
<|skeleton|> class BinaryTransformer: def __init__(self, subtransformer_args, input_constraints={}, input_processer=None): """Initialize a `BinaryTransformer` object. :param subtransformer_list: The functions to be used to transform the input of a certain data type. :param input_constraints: The constraint...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryTransformer: def __init__(self, subtransformer_args, input_constraints={}, input_processer=None): """Initialize a `BinaryTransformer` object. :param subtransformer_list: The functions to be used to transform the input of a certain data type. :param input_constraints: The constraints to enforce o...
the_stack_v2_python_sparse
URET/uret/transformers/binary/binary_transformer.py
shekoelnawawy/Ohio_13
train
0
f00defa699fd87c608a01f9856165bda5e4a0fc3
[ "TrainerMixin.__init__(self)\nself.estimator = estimator\nself.file_path = file_path\nself.k = k", "mask_kgb = y != -1\nX_kgb, y_kgb = (X[mask_kgb], y[mask_kgb])\nself.estimator.fit(X_kgb, y_kgb)\npred_cut = pd.qcut(self.estimator.predict_proba(X)[:, 1], self.k, labels=False)\nfor i in range(self.k):\n mask = ...
<|body_start_0|> TrainerMixin.__init__(self) self.estimator = estimator self.file_path = file_path self.k = k <|end_body_0|> <|body_start_1|> mask_kgb = y != -1 X_kgb, y_kgb = (X[mask_kgb], y[mask_kgb]) self.estimator.fit(X_kgb, y_kgb) pred_cut = pd.qcut(...
重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。
ReWeighting
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReWeighting: """重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。""" def __init__(self, estimator, file_path: str=None, k: int=10): """初始化函数 :param estimato...
stack_v2_sparse_classes_75kplus_train_066741
17,175
no_license
[ { "docstring": "初始化函数 :param estimator: 学习器 :param file_path: 最终建模使用样本输出路径 :param k: 分箱数量", "name": "__init__", "signature": "def __init__(self, estimator, file_path: str=None, k: int=10)" }, { "docstring": "拟合学习器 :param X: 包括通过样本和拒绝样本 :param y: -1代表拒绝样本,0,1代表通过样本 :return:", "name": "fit", ...
2
stack_v2_sparse_classes_30k_train_032651
Implement the Python class `ReWeighting` described below. Class description: 重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。 Method signatures and docstrings: - def __init__(self, estimato...
Implement the Python class `ReWeighting` described below. Class description: 重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。 Method signatures and docstrings: - def __init__(self, estimato...
1634ac69e8616f85c4233039e2d40246149a1617
<|skeleton|> class ReWeighting: """重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。""" def __init__(self, estimator, file_path: str=None, k: int=10): """初始化函数 :param estimato...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReWeighting: """重新加权法 step 1. 构建KGB模型,并对全量样本打分,得到P(bad)。 step 2. 将全量样本按P(bad)升序排列,分箱统计每箱中的放贷和拒绝样本数。 step 3. 计算每个分箱中放贷好坏样本的权重,weight = (reject + accept) / accept。 step 4. 引入样本权重,利用放贷好坏样本构建KGB模型。""" def __init__(self, estimator, file_path: str=None, k: int=10): """初始化函数 :param estimator: 学习器 :param...
the_stack_v2_python_sparse
model_training/RITrainer.py
pengliang1226/model_procedure
train
0
4547b82e8b54d1cfd5b58f4c091505c9a500ca65
[ "self.mode = mode\nsuper().__init__(p.pro_max_speed, envirogrid, Antagonist.image, startcoord)\np.allObjects.add(self)\np.antagonist.add(self)\nOdorSource(__name__, GroupSingle(self), p.ant_odor_intensity, p.ant_colour)\nself.max_health = 100.0\nself.health = self.max_health\nenvirogrid.trackObj(self, self.coord)",...
<|body_start_0|> self.mode = mode super().__init__(p.pro_max_speed, envirogrid, Antagonist.image, startcoord) p.allObjects.add(self) p.antagonist.add(self) OdorSource(__name__, GroupSingle(self), p.ant_odor_intensity, p.ant_colour) self.max_health = 100.0 self.hea...
RAWRRR!!!! all i want to do is eat the protagonist!! i will chase it forever!
Antagonist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Antagonist: """RAWRRR!!!! all i want to do is eat the protagonist!! i will chase it forever!""" def __init__(self, envirogrid, startcoord, mode): """Constructor""" <|body_0|> def update(self, mouse, grid): """put AI stuff here""" <|body_1|> def affec...
stack_v2_sparse_classes_75kplus_train_066742
2,391
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, envirogrid, startcoord, mode)" }, { "docstring": "put AI stuff here", "name": "update", "signature": "def update(self, mouse, grid)" }, { "docstring": "overridden to not die but instead gain health...
3
stack_v2_sparse_classes_30k_train_048516
Implement the Python class `Antagonist` described below. Class description: RAWRRR!!!! all i want to do is eat the protagonist!! i will chase it forever! Method signatures and docstrings: - def __init__(self, envirogrid, startcoord, mode): Constructor - def update(self, mouse, grid): put AI stuff here - def affectHea...
Implement the Python class `Antagonist` described below. Class description: RAWRRR!!!! all i want to do is eat the protagonist!! i will chase it forever! Method signatures and docstrings: - def __init__(self, envirogrid, startcoord, mode): Constructor - def update(self, mouse, grid): put AI stuff here - def affectHea...
b6db5ca1ae04035ebeb016dd0a5bc59bf6aaa24f
<|skeleton|> class Antagonist: """RAWRRR!!!! all i want to do is eat the protagonist!! i will chase it forever!""" def __init__(self, envirogrid, startcoord, mode): """Constructor""" <|body_0|> def update(self, mouse, grid): """put AI stuff here""" <|body_1|> def affec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Antagonist: """RAWRRR!!!! all i want to do is eat the protagonist!! i will chase it forever!""" def __init__(self, envirogrid, startcoord, mode): """Constructor""" self.mode = mode super().__init__(p.pro_max_speed, envirogrid, Antagonist.image, startcoord) p.allObjects.add...
the_stack_v2_python_sparse
p2_1184386/antagonist.py
touqir14/Nexus_Game
train
0
55df499f3a894abe9e7ebbb892d2afced08cc094
[ "self._display_width = display_size_mm[0]\nself._display_height = display_size_mm[1]\nself._display_x_resolution = display_res_pix[0]\nself._display_y_resolution = display_res_pix[1]\nself._eye_distance_mm = eye_distance_mm", "if self._eye_distance_mm is None and eye_distance_mm is None:\n raise ValueError('Th...
<|body_start_0|> self._display_width = display_size_mm[0] self._display_height = display_size_mm[1] self._display_x_resolution = display_res_pix[0] self._display_y_resolution = display_res_pix[1] self._eye_distance_mm = eye_distance_mm <|end_body_0|> <|body_start_1|> if ...
VisualAngleCalc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualAngleCalc: def __init__(self, display_size_mm, display_res_pix, eye_distance_mm=None): """Used to store calibrated area information and eye distance to screen data so that pixel data values can be converted to visual degree values. The pix2deg method is vectorized, meaning that is ...
stack_v2_sparse_classes_75kplus_train_066743
7,223
no_license
[ { "docstring": "Used to store calibrated area information and eye distance to screen data so that pixel data values can be converted to visual degree values. The pix2deg method is vectorized, meaning that is will perform the pixel to angle calculations on all elements of the provided pixel position numpy arrays...
2
stack_v2_sparse_classes_30k_train_006929
Implement the Python class `VisualAngleCalc` described below. Class description: Implement the VisualAngleCalc class. Method signatures and docstrings: - def __init__(self, display_size_mm, display_res_pix, eye_distance_mm=None): Used to store calibrated area information and eye distance to screen data so that pixel ...
Implement the Python class `VisualAngleCalc` described below. Class description: Implement the VisualAngleCalc class. Method signatures and docstrings: - def __init__(self, display_size_mm, display_res_pix, eye_distance_mm=None): Used to store calibrated area information and eye distance to screen data so that pixel ...
0ef5a2a618b30b87ecb390757c456681957b313c
<|skeleton|> class VisualAngleCalc: def __init__(self, display_size_mm, display_res_pix, eye_distance_mm=None): """Used to store calibrated area information and eye distance to screen data so that pixel data values can be converted to visual degree values. The pix2deg method is vectorized, meaning that is ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisualAngleCalc: def __init__(self, display_size_mm, display_res_pix, eye_distance_mm=None): """Used to store calibrated area information and eye distance to screen data so that pixel data values can be converted to visual degree values. The pix2deg method is vectorized, meaning that is will perform t...
the_stack_v2_python_sparse
References for PsychoPy/ECEM_Python_materials/python_source/data_visualization/common_workshop_functions.py
hejibo/Python-for-Psychologist
train
4
0d15a41e684c9ef3b962b106f147bbdf02c38bd6
[ "prev = None\ncur = head\nwhile cur:\n tmp = cur.next\n cur.next = prev\n prev = cur\n cur = tmp\nreturn prev", "fast = slow = head\nwhile fast and fast.next:\n slow = slow.next\n fast = fast.next.next\nslow = self.reverseList(slow)\ncur = head\nslow_cur = slow\nwhile slow_cur:\n if slow_cur....
<|body_start_0|> prev = None cur = head while cur: tmp = cur.next cur.next = prev prev = cur cur = tmp return prev <|end_body_0|> <|body_start_1|> fast = slow = head while fast and fast.next: slow = slow.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reorderList(self, head): """:type head: ListNode :rtype: void Do not return anything, modify head in-place instead.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_75kplus_train_066744
1,163
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: void Do not return anything, modify head in-place instead.", "name": "reorderList", "signature": "def reorderList(self...
2
stack_v2_sparse_classes_30k_train_035044
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reorderList(self, head): :type head: ListNode :rtype: void Do not return anything, modify head in-place i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reorderList(self, head): :type head: ListNode :rtype: void Do not return anything, modify head in-place i...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reorderList(self, head): """:type head: ListNode :rtype: void Do not return anything, modify head in-place instead.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" prev = None cur = head while cur: tmp = cur.next cur.next = prev prev = cur cur = tmp return prev def reorderList(self, head): ...
the_stack_v2_python_sparse
leetcode/reorderList-143.py
pittcat/Algorithm_Practice
train
0
c5fd1b577997ab14158787ed75b35152ac9ff12a
[ "if lstm_size is None and rnn_construction_fn is None:\n raise ValueError('Need to provide either custom rnn_construction_fn or lstm_size.')\nif lstm_size and rnn_construction_fn:\n raise ValueError('Cannot provide both custom rnn_construction_fn and lstm_size.')\nkernel_initializer = tf.compat.v1.variance_sc...
<|body_start_0|> if lstm_size is None and rnn_construction_fn is None: raise ValueError('Need to provide either custom rnn_construction_fn or lstm_size.') if lstm_size and rnn_construction_fn: raise ValueError('Cannot provide both custom rnn_construction_fn and lstm_size.') ...
Recurrent network.
LSTMEncodingNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMEncodingNetwork: """Recurrent network.""" def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_layer_params=(75, 40), activation_fn=tf.keras.activations.relu, rnn_co...
stack_v2_sparse_classes_75kplus_train_066745
9,710
permissive
[ { "docstring": "Creates an instance of `LSTMEncodingNetwork`. Input preprocessing is possible via `preprocessing_layers` and `preprocessing_combiner` Layers. If the `preprocessing_layers` nest is shallower than `input_tensor_spec`, then the layers will get the subnests. For example, if: ```python input_tensor_s...
2
stack_v2_sparse_classes_30k_train_049650
Implement the Python class `LSTMEncodingNetwork` described below. Class description: Recurrent network. Method signatures and docstrings: - def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_la...
Implement the Python class `LSTMEncodingNetwork` described below. Class description: Recurrent network. Method signatures and docstrings: - def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_la...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class LSTMEncodingNetwork: """Recurrent network.""" def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_layer_params=(75, 40), activation_fn=tf.keras.activations.relu, rnn_co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMEncodingNetwork: """Recurrent network.""" def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_layer_params=(75, 40), activation_fn=tf.keras.activations.relu, rnn_construction_fn...
the_stack_v2_python_sparse
tf_agents/networks/lstm_encoding_network.py
tensorflow/agents
train
2,755
ffe0928618cff1540f508fcba61d7a2de920ddd7
[ "super(ScatterVisualizer, self).__init__(ax=ax, features=features, classes=classes, color=color, colormap=colormap, **kwargs)\nself.x = x\nself.y = y\nself.alpha = alpha\nself.markers = itertools.cycle(kwargs.pop('markers', (',', '+', 'o', '*', 'v', 'h', 'd')))\nself.color = color\nself.colormap = colormap\nif self...
<|body_start_0|> super(ScatterVisualizer, self).__init__(ax=ax, features=features, classes=classes, color=color, colormap=colormap, **kwargs) self.x = x self.y = y self.alpha = alpha self.markers = itertools.cycle(kwargs.pop('markers', (',', '+', 'o', '*', 'v', 'h', 'd'))) ...
ScatterVisualizer is a bivariate feature data visualization algorithm that plots using the Cartesian coordinates of each point. Parameters ---------- ax : a matplotlib plot, default: None The axis to plot the figure on. x : string, default: None The feature name that corresponds to a column name or index postion in the...
ScatterVisualizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScatterVisualizer: """ScatterVisualizer is a bivariate feature data visualization algorithm that plots using the Cartesian coordinates of each point. Parameters ---------- ax : a matplotlib plot, default: None The axis to plot the figure on. x : string, default: None The feature name that corresp...
stack_v2_sparse_classes_75kplus_train_066746
11,862
permissive
[ { "docstring": "Initialize the base scatter with many of the options required in order to make the visualization work.", "name": "__init__", "signature": "def __init__(self, ax=None, x=None, y=None, features=None, classes=None, color=None, colormap=None, markers=None, alpha=1.0, **kwargs)" }, { ...
4
stack_v2_sparse_classes_30k_train_018700
Implement the Python class `ScatterVisualizer` described below. Class description: ScatterVisualizer is a bivariate feature data visualization algorithm that plots using the Cartesian coordinates of each point. Parameters ---------- ax : a matplotlib plot, default: None The axis to plot the figure on. x : string, defa...
Implement the Python class `ScatterVisualizer` described below. Class description: ScatterVisualizer is a bivariate feature data visualization algorithm that plots using the Cartesian coordinates of each point. Parameters ---------- ax : a matplotlib plot, default: None The axis to plot the figure on. x : string, defa...
f7a8e950bd31452ea2f5d402a1c5d519cd163fd5
<|skeleton|> class ScatterVisualizer: """ScatterVisualizer is a bivariate feature data visualization algorithm that plots using the Cartesian coordinates of each point. Parameters ---------- ax : a matplotlib plot, default: None The axis to plot the figure on. x : string, default: None The feature name that corresp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScatterVisualizer: """ScatterVisualizer is a bivariate feature data visualization algorithm that plots using the Cartesian coordinates of each point. Parameters ---------- ax : a matplotlib plot, default: None The axis to plot the figure on. x : string, default: None The feature name that corresponds to a col...
the_stack_v2_python_sparse
yellowbrick/contrib/scatter.py
DistrictDataLabs/yellowbrick
train
4,242
57294c24edc0c6c757c2bed018f47c25c43a1a7e
[ "super(ConvGRU, self).__init__()\nself.input_size = input_size\ninput_dim = self.input_size\ncell = ConvGRUCell(input_dim, hidden_size, kernel_size)\nself.cells = cell", "hidden = None\nupd_hidden = []\nN, T, C, H, W = x.size()\nfor tidx in range(T):\n hidden = self.cell(x[:, tidx, :, :, :], hidden)\n upd_h...
<|body_start_0|> super(ConvGRU, self).__init__() self.input_size = input_size input_dim = self.input_size cell = ConvGRUCell(input_dim, hidden_size, kernel_size) self.cells = cell <|end_body_0|> <|body_start_1|> hidden = None upd_hidden = [] N, T, C, H, W...
ConvGRU
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvGRU: def __init__(self, input_size, hidden_size, kernel_size): """Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dim...
stack_v2_sparse_classes_75kplus_train_066747
3,254
no_license
[ { "docstring": "Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dimensions of hidden state. kernel_size : integer. sizes of Conv2d gate kernels."...
2
stack_v2_sparse_classes_30k_train_016563
Implement the Python class `ConvGRU` described below. Class description: Implement the ConvGRU class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, kernel_size): Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ----...
Implement the Python class `ConvGRU` described below. Class description: Implement the ConvGRU class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, kernel_size): Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ----...
583d689d9347a719a62e5ba2887f3d5178c351fe
<|skeleton|> class ConvGRU: def __init__(self, input_size, hidden_size, kernel_size): """Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dim...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConvGRU: def __init__(self, input_size, hidden_size, kernel_size): """Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dimensions of hid...
the_stack_v2_python_sparse
models_STM/gru.py
0liliulei/Mem3D
train
20
357a930229e99fe3e630d7d30a5ffff6239ab924
[ "try:\n top, skip, expand_code, selects = parse_args(request.args)\n thing_list = Things.return_page_with_expand(top, skip, expand_code, selects)\n response = jsonify(thing_list)\n response.status_code = 200\nexcept Exception as e:\n logging.warning(e)\n response = jsonify({'message': 'error'})\n ...
<|body_start_0|> try: top, skip, expand_code, selects = parse_args(request.args) thing_list = Things.return_page_with_expand(top, skip, expand_code, selects) response = jsonify(thing_list) response.status_code = 200 except Exception as e: loggi...
ThingList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThingList: def get(self): """query data streams #TODO pagination""" <|body_0|> def post(self): """post new sensor""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: top, skip, expand_code, selects = parse_args(request.args) ...
stack_v2_sparse_classes_75kplus_train_066748
5,608
no_license
[ { "docstring": "query data streams #TODO pagination", "name": "get", "signature": "def get(self)" }, { "docstring": "post new sensor", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_020380
Implement the Python class `ThingList` described below. Class description: Implement the ThingList class. Method signatures and docstrings: - def get(self): query data streams #TODO pagination - def post(self): post new sensor
Implement the Python class `ThingList` described below. Class description: Implement the ThingList class. Method signatures and docstrings: - def get(self): query data streams #TODO pagination - def post(self): post new sensor <|skeleton|> class ThingList: def get(self): """query data streams #TODO pagi...
711ae2c664b3c2b3dfa3c42a2f5fb1def1fbb6fa
<|skeleton|> class ThingList: def get(self): """query data streams #TODO pagination""" <|body_0|> def post(self): """post new sensor""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThingList: def get(self): """query data streams #TODO pagination""" try: top, skip, expand_code, selects = parse_args(request.args) thing_list = Things.return_page_with_expand(top, skip, expand_code, selects) response = jsonify(thing_list) respon...
the_stack_v2_python_sparse
platform_out/app/resources/things.py
sheenacodes/fvh_sta_datastreams
train
0
a783ef82d421c255cec6f0a3fd9218bd1b9f5503
[ "self.aag_databases = aag_databases\nself.application_node = application_node\nself.databases = databases\nself.error_message = error_message\nself.unknown_host_name = unknown_host_name", "if dictionary is None:\n return None\naag_databases = None\nif dictionary.get('aagDatabases') != None:\n aag_databases ...
<|body_start_0|> self.aag_databases = aag_databases self.application_node = application_node self.databases = databases self.error_message = error_message self.unknown_host_name = unknown_host_name <|end_body_0|> <|body_start_1|> if dictionary is None: return...
Implementation of the 'SqlAagHostAndDatabases' model. Specifies AAGs and databases information on an SQL server. If AAGs exist on the server, specifies information about the AAG and databases in the group for each AAG found on the server. Attributes: aag_databases (list of AagAndDatabases): Specifies a list of AAGs and...
SqlAagHostAndDatabases
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlAagHostAndDatabases: """Implementation of the 'SqlAagHostAndDatabases' model. Specifies AAGs and databases information on an SQL server. If AAGs exist on the server, specifies information about the AAG and databases in the group for each AAG found on the server. Attributes: aag_databases (list...
stack_v2_sparse_classes_75kplus_train_066749
3,975
permissive
[ { "docstring": "Constructor for the SqlAagHostAndDatabases class", "name": "__init__", "signature": "def __init__(self, aag_databases=None, application_node=None, databases=None, error_message=None, unknown_host_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary A...
2
stack_v2_sparse_classes_30k_train_001244
Implement the Python class `SqlAagHostAndDatabases` described below. Class description: Implementation of the 'SqlAagHostAndDatabases' model. Specifies AAGs and databases information on an SQL server. If AAGs exist on the server, specifies information about the AAG and databases in the group for each AAG found on the ...
Implement the Python class `SqlAagHostAndDatabases` described below. Class description: Implementation of the 'SqlAagHostAndDatabases' model. Specifies AAGs and databases information on an SQL server. If AAGs exist on the server, specifies information about the AAG and databases in the group for each AAG found on the ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SqlAagHostAndDatabases: """Implementation of the 'SqlAagHostAndDatabases' model. Specifies AAGs and databases information on an SQL server. If AAGs exist on the server, specifies information about the AAG and databases in the group for each AAG found on the server. Attributes: aag_databases (list...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SqlAagHostAndDatabases: """Implementation of the 'SqlAagHostAndDatabases' model. Specifies AAGs and databases information on an SQL server. If AAGs exist on the server, specifies information about the AAG and databases in the group for each AAG found on the server. Attributes: aag_databases (list of AagAndDat...
the_stack_v2_python_sparse
cohesity_management_sdk/models/sql_aag_host_and_databases.py
cohesity/management-sdk-python
train
24
0c447ba4e6ed9b18da4726161099ed2380bf0f25
[ "super(TailLatestFile, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)\nself.directory = directory\nself.file_pattern = file_pattern\nself.ret_required = False\nself.time_for_failure = time_for_failure\nself._first_line_time = None\nself._check_failure_indication = T...
<|body_start_0|> super(TailLatestFile, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.directory = directory self.file_pattern = file_pattern self.ret_required = False self.time_for_failure = time_for_failure self._fir...
TailLatestFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TailLatestFile: def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): """Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param di...
stack_v2_sparse_classes_75kplus_train_066750
5,682
permissive
[ { "docstring": "Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param directory: path to directory to tail. :param file_pattern: pattern for files from directory. :param prompt: prompt (on system where command runs). :param newl...
4
stack_v2_sparse_classes_30k_train_033955
Implement the Python class `TailLatestFile` described below. Class description: Implement the TailLatestFile class. Method signatures and docstrings: - def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): Command for tail latest file from the...
Implement the Python class `TailLatestFile` described below. Class description: Implement the TailLatestFile class. Method signatures and docstrings: - def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): Command for tail latest file from the...
5a7bb06807b6e0124c77040367d0c20f42849a4c
<|skeleton|> class TailLatestFile: def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): """Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param di...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TailLatestFile: def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): """Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param directory: path ...
the_stack_v2_python_sparse
moler/cmd/unix/tail_latest_file.py
nokia/moler
train
60
1b6f047e9ae92ee4b46bf17206fa5402cbab9305
[ "self.signup('healer')\nresponse = self.rest_client.get(reverse('provider_setup_intro'))\nself.assertEqual(response.status_code, 200)\nresponse = self.rest_client.get(reverse('notes'))\nself.assertEqual(response.status_code, 302)", "self.signup()\nresponse = self.rest_client.get(reverse('provider_setup_intro'))\n...
<|body_start_0|> self.signup('healer') response = self.rest_client.get(reverse('provider_setup_intro')) self.assertEqual(response.status_code, 200) response = self.rest_client.get(reverse('notes')) self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> ...
SignupAccessTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignupAccessTest: def test_healer_not_confirmed(self): """Only setup should be available for healers without confirmed emails on signup.""" <|body_0|> def test_client_not_confirmed(self): """Clients should not login on signup if email is not confirmed.""" <|b...
stack_v2_sparse_classes_75kplus_train_066751
38,593
no_license
[ { "docstring": "Only setup should be available for healers without confirmed emails on signup.", "name": "test_healer_not_confirmed", "signature": "def test_healer_not_confirmed(self)" }, { "docstring": "Clients should not login on signup if email is not confirmed.", "name": "test_client_not...
2
stack_v2_sparse_classes_30k_train_016721
Implement the Python class `SignupAccessTest` described below. Class description: Implement the SignupAccessTest class. Method signatures and docstrings: - def test_healer_not_confirmed(self): Only setup should be available for healers without confirmed emails on signup. - def test_client_not_confirmed(self): Clients...
Implement the Python class `SignupAccessTest` described below. Class description: Implement the SignupAccessTest class. Method signatures and docstrings: - def test_healer_not_confirmed(self): Only setup should be available for healers without confirmed emails on signup. - def test_client_not_confirmed(self): Clients...
681ef09e4044879840f7f0c8bccc836c3cffec3c
<|skeleton|> class SignupAccessTest: def test_healer_not_confirmed(self): """Only setup should be available for healers without confirmed emails on signup.""" <|body_0|> def test_client_not_confirmed(self): """Clients should not login on signup if email is not confirmed.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignupAccessTest: def test_healer_not_confirmed(self): """Only setup should be available for healers without confirmed emails on signup.""" self.signup('healer') response = self.rest_client.get(reverse('provider_setup_intro')) self.assertEqual(response.status_code, 200) ...
the_stack_v2_python_sparse
apps/account_hs/tests.py
RumorIO/healersource
train
0
4bb66668cc271873d4d49bb92ea95ef7b70768ff
[ "super().__init__(config_entry)\nconfig = config_entry.options\nself._period = config.get(const.CONF_PERIOD)\nself._first_date: date | None\ntry:\n self._first_date = helpers.to_date(config.get(const.CONF_FIRST_DATE))\nexcept ValueError:\n self._first_date = None", "try:\n if (day1 - self._first_date).da...
<|body_start_0|> super().__init__(config_entry) config = config_entry.options self._period = config.get(const.CONF_PERIOD) self._first_date: date | None try: self._first_date = helpers.to_date(config.get(const.CONF_FIRST_DATE)) except ValueError: s...
Collection every n days.
DailyCollection
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DailyCollection: """Collection every n days.""" def __init__(self, config_entry: ConfigEntry) -> None: """Read parameters specific for Daily Collection Frequency.""" <|body_0|> def _find_candidate_date(self, day1: date) -> date | None: """Calculate possible date,...
stack_v2_sparse_classes_75kplus_train_066752
30,427
permissive
[ { "docstring": "Read parameters specific for Daily Collection Frequency.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry) -> None" }, { "docstring": "Calculate possible date, for every-n-days frequency.", "name": "_find_candidate_date", "signature": "def ...
2
null
Implement the Python class `DailyCollection` described below. Class description: Collection every n days. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Read parameters specific for Daily Collection Frequency. - def _find_candidate_date(self, day1: date) -> date | None: Cal...
Implement the Python class `DailyCollection` described below. Class description: Collection every n days. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Read parameters specific for Daily Collection Frequency. - def _find_candidate_date(self, day1: date) -> date | None: Cal...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class DailyCollection: """Collection every n days.""" def __init__(self, config_entry: ConfigEntry) -> None: """Read parameters specific for Daily Collection Frequency.""" <|body_0|> def _find_candidate_date(self, day1: date) -> date | None: """Calculate possible date,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DailyCollection: """Collection every n days.""" def __init__(self, config_entry: ConfigEntry) -> None: """Read parameters specific for Daily Collection Frequency.""" super().__init__(config_entry) config = config_entry.options self._period = config.get(const.CONF_PERIOD) ...
the_stack_v2_python_sparse
custom_components/garbage_collection/sensor.py
bacco007/HomeAssistantConfig
train
98
26e3ea839be755b2ac6179157df2ba3f0687b371
[ "\"\"\" embdim for embedder, dims is a list of dims for RNN\"\"\"\nsuper(FlatEncoder, self).__init__()\nself.emb = q.PartiallyPretrainedWordEmb(embdim, worddic=word_dic, gradfracs=(1.0, gfrac))\nself.lstm = q.FastestLSTMEncoder(embdim, *dims, bidir=bidir, dropout_in=dropout_in, dropout_rec=dropout_rec)", "embs, m...
<|body_start_0|> """ embdim for embedder, dims is a list of dims for RNN""" super(FlatEncoder, self).__init__() self.emb = q.PartiallyPretrainedWordEmb(embdim, worddic=word_dic, gradfracs=(1.0, gfrac)) self.lstm = q.FastestLSTMEncoder(embdim, *dims, bidir=bidir, dropout_in=dropout_in, dr...
FlatEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlatEncoder: def __init__(self, embdim, dims, word_dic, bidir=False, dropout_in=0.0, dropout_rec=0.0, gfrac=0.0): """:param word_dic: dictionary mapping words (strings) to ids as they occur in the input x to .forward() :param gfrac:""" <|body_0|> def forward(self, x): ...
stack_v2_sparse_classes_75kplus_train_066753
14,616
permissive
[ { "docstring": ":param word_dic: dictionary mapping words (strings) to ids as they occur in the input x to .forward() :param gfrac:", "name": "__init__", "signature": "def __init__(self, embdim, dims, word_dic, bidir=False, dropout_in=0.0, dropout_rec=0.0, gfrac=0.0)" }, { "docstring": ":param x...
2
stack_v2_sparse_classes_30k_train_052776
Implement the Python class `FlatEncoder` described below. Class description: Implement the FlatEncoder class. Method signatures and docstrings: - def __init__(self, embdim, dims, word_dic, bidir=False, dropout_in=0.0, dropout_rec=0.0, gfrac=0.0): :param word_dic: dictionary mapping words (strings) to ids as they occu...
Implement the Python class `FlatEncoder` described below. Class description: Implement the FlatEncoder class. Method signatures and docstrings: - def __init__(self, embdim, dims, word_dic, bidir=False, dropout_in=0.0, dropout_rec=0.0, gfrac=0.0): :param word_dic: dictionary mapping words (strings) to ids as they occu...
4ea8ff5fab92d41fefecf619fa1958f210216471
<|skeleton|> class FlatEncoder: def __init__(self, embdim, dims, word_dic, bidir=False, dropout_in=0.0, dropout_rec=0.0, gfrac=0.0): """:param word_dic: dictionary mapping words (strings) to ids as they occur in the input x to .forward() :param gfrac:""" <|body_0|> def forward(self, x): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlatEncoder: def __init__(self, embdim, dims, word_dic, bidir=False, dropout_in=0.0, dropout_rec=0.0, gfrac=0.0): """:param word_dic: dictionary mapping words (strings) to ids as they occur in the input x to .forward() :param gfrac:""" """ embdim for embedder, dims is a list of dims for RNN"""...
the_stack_v2_python_sparse
qelos_core/scripts/lcquad/corerank.py
SmartDataAnalytics/qelos-core
train
2
80defcad131187fce45fda91c267c396259dc706
[ "if isinstance(type, FasterRCNNType):\n type = type.value\nif FasterRCNNType.BASIC.value == type:\n return 'Basic'\nif FasterRCNNType.DEFORMABLE_CONV.value == type:\n return 'DeformConv'\nif FasterRCNNType.DEFORMABLE_ROI.value == type:\n return 'DeformRoI'\nif FasterRCNNType.DEFORMABLE_CONV_ROI.value ==...
<|body_start_0|> if isinstance(type, FasterRCNNType): type = type.value if FasterRCNNType.BASIC.value == type: return 'Basic' if FasterRCNNType.DEFORMABLE_CONV.value == type: return 'DeformConv' if FasterRCNNType.DEFORMABLE_ROI.value == type: ...
FasterRCNNType
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterRCNNType: def get_name(type): """Get the name of the requested model type. :param type: FasterRCNNType. The type of the model. :return: The name of the model type or raise an exception if unknown.""" <|body_0|> def get_type(name): """Get the type of the request...
stack_v2_sparse_classes_75kplus_train_066754
3,171
permissive
[ { "docstring": "Get the name of the requested model type. :param type: FasterRCNNType. The type of the model. :return: The name of the model type or raise an exception if unknown.", "name": "get_name", "signature": "def get_name(type)" }, { "docstring": "Get the type of the requested model name....
2
null
Implement the Python class `FasterRCNNType` described below. Class description: Implement the FasterRCNNType class. Method signatures and docstrings: - def get_name(type): Get the name of the requested model type. :param type: FasterRCNNType. The type of the model. :return: The name of the model type or raise an exce...
Implement the Python class `FasterRCNNType` described below. Class description: Implement the FasterRCNNType class. Method signatures and docstrings: - def get_name(type): Get the name of the requested model type. :param type: FasterRCNNType. The type of the model. :return: The name of the model type or raise an exce...
53e7ddcd6b3b8c7c38451cf08529d2792494c658
<|skeleton|> class FasterRCNNType: def get_name(type): """Get the name of the requested model type. :param type: FasterRCNNType. The type of the model. :return: The name of the model type or raise an exception if unknown.""" <|body_0|> def get_type(name): """Get the type of the request...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FasterRCNNType: def get_name(type): """Get the name of the requested model type. :param type: FasterRCNNType. The type of the model. :return: The name of the model type or raise an exception if unknown.""" if isinstance(type, FasterRCNNType): type = type.value if FasterRCNN...
the_stack_v2_python_sparse
src/models/faster_rcnn_models.py
FHellmann/Deformable_Dilated_Faster-RCNN
train
0
5c8c48b9a165fcae10294891be36963bf9797694
[ "self.port = 19234\ntcp_server = socket.socket()\ntcp_server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\ntcp_server.bind(('', self.port))\ntcp_server.listen(128)\nprint('服务器已开启。。')\nself.tcp_server = tcp_server", "while True:\n client_server, client_addr = self.tcp_server.accept()\n g1 = gevent.s...
<|body_start_0|> self.port = 19234 tcp_server = socket.socket() tcp_server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) tcp_server.bind(('', self.port)) tcp_server.listen(128) print('服务器已开启。。') self.tcp_server = tcp_server <|end_body_0|> <|body_start_1|>...
HTTP 服务器类
HTTPServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPServer: """HTTP 服务器类""" def __init__(self): """建立套接字""" <|body_0|> def start(self): """开启服务器""" <|body_1|> def client_handler(self, client_server): """处理客户端请求""" <|body_2|> def dynamic_resource(client_server, resource): ...
stack_v2_sparse_classes_75kplus_train_066755
3,071
permissive
[ { "docstring": "建立套接字", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "开启服务器", "name": "start", "signature": "def start(self)" }, { "docstring": "处理客户端请求", "name": "client_handler", "signature": "def client_handler(self, client_server)" }, { ...
5
stack_v2_sparse_classes_30k_train_023681
Implement the Python class `HTTPServer` described below. Class description: HTTP 服务器类 Method signatures and docstrings: - def __init__(self): 建立套接字 - def start(self): 开启服务器 - def client_handler(self, client_server): 处理客户端请求 - def dynamic_resource(client_server, resource): 处理动态资源请求 - def static_resource(resource, clie...
Implement the Python class `HTTPServer` described below. Class description: HTTP 服务器类 Method signatures and docstrings: - def __init__(self): 建立套接字 - def start(self): 开启服务器 - def client_handler(self, client_server): 处理客户端请求 - def dynamic_resource(client_server, resource): 处理动态资源请求 - def static_resource(resource, clie...
dd88b9a5619d38fb8d236c932ffa8429d24b28ae
<|skeleton|> class HTTPServer: """HTTP 服务器类""" def __init__(self): """建立套接字""" <|body_0|> def start(self): """开启服务器""" <|body_1|> def client_handler(self, client_server): """处理客户端请求""" <|body_2|> def dynamic_resource(client_server, resource): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HTTPServer: """HTTP 服务器类""" def __init__(self): """建立套接字""" self.port = 19234 tcp_server = socket.socket() tcp_server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) tcp_server.bind(('', self.port)) tcp_server.listen(128) print('服务器已开启。。') ...
the_stack_v2_python_sparse
07-Mini_Web/64-Web.py
ericson14/Small_project
train
0
a89486f1b62b3ba2fd79ce5f7319a23a9b843bf3
[ "self.offer_id = offer_id\nself.order_id = order_id\nself.products = products\nself.cc_expiration_date = cc_expiration_date\nself.delay = delay\nself.grand_total = grand_total\nself.has_shipping = has_shipping\nself.has_taxes = has_taxes\nself.shipping = shipping\nself.shipping_charge_reoccurring_orders = shipping_...
<|body_start_0|> self.offer_id = offer_id self.order_id = order_id self.products = products self.cc_expiration_date = cc_expiration_date self.delay = delay self.grand_total = grand_total self.has_shipping = has_shipping self.has_taxes = has_taxes s...
Implementation of the 'Offer' model. TODO: type model description here. Attributes: offer_id (int): This must be a valid Offer ID. order_id (int): This must be a valid Order ID. products (list of Product): TODO: type description here. cc_expiration_date (string): Credit card expiration date. delay (int): Days to delay ...
Offer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Offer: """Implementation of the 'Offer' model. TODO: type model description here. Attributes: offer_id (int): This must be a valid Offer ID. order_id (int): This must be a valid Order ID. products (list of Product): TODO: type description here. cc_expiration_date (string): Credit card expiration ...
stack_v2_sparse_classes_75kplus_train_066756
5,301
permissive
[ { "docstring": "Constructor for the Offer class", "name": "__init__", "signature": "def __init__(self, offer_id=None, order_id=None, products=None, cc_expiration_date=None, delay=None, grand_total=None, has_shipping=False, has_taxes=False, shipping=None, shipping_charge_reoccurring_orders=False, sub_tot...
2
stack_v2_sparse_classes_30k_train_051060
Implement the Python class `Offer` described below. Class description: Implementation of the 'Offer' model. TODO: type model description here. Attributes: offer_id (int): This must be a valid Offer ID. order_id (int): This must be a valid Order ID. products (list of Product): TODO: type description here. cc_expiration...
Implement the Python class `Offer` described below. Class description: Implementation of the 'Offer' model. TODO: type model description here. Attributes: offer_id (int): This must be a valid Offer ID. order_id (int): This must be a valid Order ID. products (list of Product): TODO: type description here. cc_expiration...
fb4834e89b897dce3475c89c7e6c34bf8756880e
<|skeleton|> class Offer: """Implementation of the 'Offer' model. TODO: type model description here. Attributes: offer_id (int): This must be a valid Offer ID. order_id (int): This must be a valid Order ID. products (list of Product): TODO: type description here. cc_expiration_date (string): Credit card expiration ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Offer: """Implementation of the 'Offer' model. TODO: type model description here. Attributes: offer_id (int): This must be a valid Offer ID. order_id (int): This must be a valid Order ID. products (list of Product): TODO: type description here. cc_expiration_date (string): Credit card expiration date. delay (...
the_stack_v2_python_sparse
ontraportlib/models/offer.py
LifePosts/ontraportlib
train
0
d87305f669ec3fa240e4fa1e74eaa0786c34507f
[ "recorder('DEBUG', 'manager setup start')\nif configer:\n for cpre, cls in COMPONENTS:\n components = configer.get_components(cpre)\n for name, value in components.items():\n config = configer.configs[name]\n com = cls(config)\n Manager._pools[value['object']] = com...
<|body_start_0|> recorder('DEBUG', 'manager setup start') if configer: for cpre, cls in COMPONENTS: components = configer.get_components(cpre) for name, value in components.items(): config = configer.configs[name] com = ...
管理器 fastweb.setting.default_component.COMPONENTS fastweb.setting.default_connection_component.SYNC_CONN_COMPONENTS fastweb.setting.default_connection_component.ASYN_CONN_COMPONENTS 存储组件名称及相应的组件类 _pools存储所有的组件 有多种不同的组件,可以复用的组件,在组件管理池中只有一个;不可以复用的组件,组件管理池中需要创建多个,并且存在组件状态 在取出时判断取出的方式
Manager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: """管理器 fastweb.setting.default_component.COMPONENTS fastweb.setting.default_connection_component.SYNC_CONN_COMPONENTS fastweb.setting.default_connection_component.ASYN_CONN_COMPONENTS 存储组件名称及相应的组件类 _pools存储所有的组件 有多种不同的组件,可以复用的组件,在组件管理池中只有一个;不可以复用的组件,组件管理池中需要创建多个,并且存在组件状态 在取出时判断取出的方式""" ...
stack_v2_sparse_classes_75kplus_train_066757
5,015
no_license
[ { "docstring": "安装组件", "name": "setup", "signature": "def setup(configer)" }, { "docstring": "通过manager获取组件 ManagerError:可能是配置文件错误或者程序错误,应该尽快进行处理,不应该再向下继续运行 :parameter: - `name`:组件名称", "name": "get_component", "signature": "def get_component(name, obj)" }, { "docstring": "归还组件 :p...
3
stack_v2_sparse_classes_30k_train_041680
Implement the Python class `Manager` described below. Class description: 管理器 fastweb.setting.default_component.COMPONENTS fastweb.setting.default_connection_component.SYNC_CONN_COMPONENTS fastweb.setting.default_connection_component.ASYN_CONN_COMPONENTS 存储组件名称及相应的组件类 _pools存储所有的组件 有多种不同的组件,可以复用的组件,在组件管理池中只有一个;不可以复用的组件...
Implement the Python class `Manager` described below. Class description: 管理器 fastweb.setting.default_component.COMPONENTS fastweb.setting.default_connection_component.SYNC_CONN_COMPONENTS fastweb.setting.default_connection_component.ASYN_CONN_COMPONENTS 存储组件名称及相应的组件类 _pools存储所有的组件 有多种不同的组件,可以复用的组件,在组件管理池中只有一个;不可以复用的组件...
c58a7ff1390da2d48b2e6383241e6939245d1cfc
<|skeleton|> class Manager: """管理器 fastweb.setting.default_component.COMPONENTS fastweb.setting.default_connection_component.SYNC_CONN_COMPONENTS fastweb.setting.default_connection_component.ASYN_CONN_COMPONENTS 存储组件名称及相应的组件类 _pools存储所有的组件 有多种不同的组件,可以复用的组件,在组件管理池中只有一个;不可以复用的组件,组件管理池中需要创建多个,并且存在组件状态 在取出时判断取出的方式""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Manager: """管理器 fastweb.setting.default_component.COMPONENTS fastweb.setting.default_connection_component.SYNC_CONN_COMPONENTS fastweb.setting.default_connection_component.ASYN_CONN_COMPONENTS 存储组件名称及相应的组件类 _pools存储所有的组件 有多种不同的组件,可以复用的组件,在组件管理池中只有一个;不可以复用的组件,组件管理池中需要创建多个,并且存在组件状态 在取出时判断取出的方式""" def setup...
the_stack_v2_python_sparse
fastweb/manager.py
sun3shines/fastweb
train
0
c91b5275a9fe06c4aea878982c9309ba23598782
[ "self.obj = obj\nfor arg in alias_names:\n self.register_key(arg)", "if isinstance(key, str):\n key = sys.intern(key)\nself[key] = self.obj" ]
<|body_start_0|> self.obj = obj for arg in alias_names: self.register_key(arg) <|end_body_0|> <|body_start_1|> if isinstance(key, str): key = sys.intern(key) self[key] = self.obj <|end_body_1|>
AliasDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliasDict: def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: """AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to""" ...
stack_v2_sparse_classes_75kplus_train_066758
1,034
no_license
[ { "docstring": "AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to", "name": "__init__", "signature": "def __init__(self, alias_names: Iterable[Hashable], obj: o...
2
stack_v2_sparse_classes_30k_train_022380
Implement the Python class `AliasDict` described below. Class description: Implement the AliasDict class. Method signatures and docstrings: - def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to...
Implement the Python class `AliasDict` described below. Class description: Implement the AliasDict class. Method signatures and docstrings: - def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to...
c8690379dd9ca383cf3257a281094e4851677faa
<|skeleton|> class AliasDict: def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: """AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AliasDict: def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: """AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to""" self.obj ...
the_stack_v2_python_sparse
pymethods/utils/alias_dict.py
IFF-0303/pymethods
train
0
bc6978c0db65919055b92d6c2f144093e4d7d600
[ "user = Instance(user_name)\nif user.k is True:\n if 'pswd' in kwargs:\n if Password.check_password(kwargs['pswd'], user.pswd) is True:\n session_id = codecs.encode(user_name, 'rot-13')\n session_key = Hashids().encode(int(uuid.uuid4()))\n prev_session = user.session\n ...
<|body_start_0|> user = Instance(user_name) if user.k is True: if 'pswd' in kwargs: if Password.check_password(kwargs['pswd'], user.pswd) is True: session_id = codecs.encode(user_name, 'rot-13') session_key = Hashids().encode(int(uuid.u...
Manages the User Session and exposes Login, Verify and Logout methods.
Session
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Session: """Manages the User Session and exposes Login, Verify and Logout methods.""" def login(user_name, **kwargs): """Logs in the user, and returns the Session Identification Information.""" <|body_0|> def logout(session_id, session_key): """Marks the existing...
stack_v2_sparse_classes_75kplus_train_066759
12,328
no_license
[ { "docstring": "Logs in the user, and returns the Session Identification Information.", "name": "login", "signature": "def login(user_name, **kwargs)" }, { "docstring": "Marks the existing session as inactive.", "name": "logout", "signature": "def logout(session_id, session_key)" }, ...
3
null
Implement the Python class `Session` described below. Class description: Manages the User Session and exposes Login, Verify and Logout methods. Method signatures and docstrings: - def login(user_name, **kwargs): Logs in the user, and returns the Session Identification Information. - def logout(session_id, session_key...
Implement the Python class `Session` described below. Class description: Manages the User Session and exposes Login, Verify and Logout methods. Method signatures and docstrings: - def login(user_name, **kwargs): Logs in the user, and returns the Session Identification Information. - def logout(session_id, session_key...
0d0e8f07d8dcbb94da8b28b1f321538d6150710d
<|skeleton|> class Session: """Manages the User Session and exposes Login, Verify and Logout methods.""" def login(user_name, **kwargs): """Logs in the user, and returns the Session Identification Information.""" <|body_0|> def logout(session_id, session_key): """Marks the existing...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Session: """Manages the User Session and exposes Login, Verify and Logout methods.""" def login(user_name, **kwargs): """Logs in the user, and returns the Session Identification Information.""" user = Instance(user_name) if user.k is True: if 'pswd' in kwargs: ...
the_stack_v2_python_sparse
deprecated/App/user/model.py
madhulikamukherjee/survaider-app
train
1
b4f70da76591db28efa93b379092294c8fd09fc5
[ "self._check_permission(Permissions.users_view)\nusers = await User.all()\nreturn ResponseUsers(users)", "self._check_permission(Permissions.users_edit)\ndata = await self.get_json()\nrequest_model = RequestUser(**data)\nkwargs = {}\nif request_model.password:\n kwargs['pass_hash'] = User.get_pass_hash(request...
<|body_start_0|> self._check_permission(Permissions.users_view) users = await User.all() return ResponseUsers(users) <|end_body_0|> <|body_start_1|> self._check_permission(Permissions.users_edit) data = await self.get_json() request_model = RequestUser(**data) kw...
UsersView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersView: async def get(self): """--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schem...
stack_v2_sparse_classes_75kplus_train_066760
5,428
no_license
[ { "docstring": "--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ResponseError' '401': description: Unaut...
2
stack_v2_sparse_classes_30k_train_012984
Implement the Python class `UsersView` described below. Class description: Implement the UsersView class. Method signatures and docstrings: - async def get(self): --- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseU...
Implement the Python class `UsersView` described below. Class description: Implement the UsersView class. Method signatures and docstrings: - async def get(self): --- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseU...
d4abeb5b87ab00c4b371d501f3d117feb5e4d72c
<|skeleton|> class UsersView: async def get(self): """--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schem...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UsersView: async def get(self): """--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ResponseErr...
the_stack_v2_python_sparse
app/services/web/views/users.py
Ravillatypov/asterisk-integration-api
train
2
7234e04a740059f08ef14b642f742f3363b721f8
[ "self.fmt = '%(asctime)s %(name)s %(lineno)d %(message)s'\nself.name = name\nself.level = level\nself.formatter = logging.Formatter(self.fmt)", "logger = logging.getLogger(self.name)\nlogger.setLevel(self.level)\nreturn logger", "time_stamp = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))\nfile_writ...
<|body_start_0|> self.fmt = '%(asctime)s %(name)s %(lineno)d %(message)s' self.name = name self.level = level self.formatter = logging.Formatter(self.fmt) <|end_body_0|> <|body_start_1|> logger = logging.getLogger(self.name) logger.setLevel(self.level) return log...
封装后的logging
CommonLog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonLog: """封装后的logging""" def __init__(self, name='common_log', level: logging=logging.DEBUG): """实例化logging :param name: 该日志名称 :param level: 该日志级别""" <|body_0|> def create_logger(self): """创建一个logger,并设置日志级别 :return:""" <|body_1|> def create_hand...
stack_v2_sparse_classes_75kplus_train_066761
1,992
no_license
[ { "docstring": "实例化logging :param name: 该日志名称 :param level: 该日志级别", "name": "__init__", "signature": "def __init__(self, name='common_log', level: logging=logging.DEBUG)" }, { "docstring": "创建一个logger,并设置日志级别 :return:", "name": "create_logger", "signature": "def create_logger(self)" },...
4
null
Implement the Python class `CommonLog` described below. Class description: 封装后的logging Method signatures and docstrings: - def __init__(self, name='common_log', level: logging=logging.DEBUG): 实例化logging :param name: 该日志名称 :param level: 该日志级别 - def create_logger(self): 创建一个logger,并设置日志级别 :return: - def create_handle(s...
Implement the Python class `CommonLog` described below. Class description: 封装后的logging Method signatures and docstrings: - def __init__(self, name='common_log', level: logging=logging.DEBUG): 实例化logging :param name: 该日志名称 :param level: 该日志级别 - def create_logger(self): 创建一个logger,并设置日志级别 :return: - def create_handle(s...
086190edc90c6102b4860764e8cc3db5933db728
<|skeleton|> class CommonLog: """封装后的logging""" def __init__(self, name='common_log', level: logging=logging.DEBUG): """实例化logging :param name: 该日志名称 :param level: 该日志级别""" <|body_0|> def create_logger(self): """创建一个logger,并设置日志级别 :return:""" <|body_1|> def create_hand...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommonLog: """封装后的logging""" def __init__(self, name='common_log', level: logging=logging.DEBUG): """实例化logging :param name: 该日志名称 :param level: 该日志级别""" self.fmt = '%(asctime)s %(name)s %(lineno)d %(message)s' self.name = name self.level = level self.formatter = l...
the_stack_v2_python_sparse
appium_demo/common/log_handle.py
AoeRunner/HGWZLG6
train
0
b3fb0e835b27e810a82e9cb4ee1f0171c9cfb498
[ "appointment = db.session.query(Appointment).filter(User.public_id == public_id, Event.url == event_url, Appointment.start == parser.isoparse(iso_start)).first()\nif appointment is None:\n raise AppointmentNotFoundError\nelse:\n response = appointment\n code = 200\nreturn (response, code)", "appointment ...
<|body_start_0|> appointment = db.session.query(Appointment).filter(User.public_id == public_id, Event.url == event_url, Appointment.start == parser.isoparse(iso_start)).first() if appointment is None: raise AppointmentNotFoundError else: response = appointment ...
AppointmentDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppointmentDetail: def get(self, public_id, event_url, iso_start): """Returns the details for a specific appointment.""" <|body_0|> def patch(self, public_id, event_url, iso_start): """Modifies the specific appointment.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_75kplus_train_066762
17,135
no_license
[ { "docstring": "Returns the details for a specific appointment.", "name": "get", "signature": "def get(self, public_id, event_url, iso_start)" }, { "docstring": "Modifies the specific appointment.", "name": "patch", "signature": "def patch(self, public_id, event_url, iso_start)" } ]
2
stack_v2_sparse_classes_30k_train_036961
Implement the Python class `AppointmentDetail` described below. Class description: Implement the AppointmentDetail class. Method signatures and docstrings: - def get(self, public_id, event_url, iso_start): Returns the details for a specific appointment. - def patch(self, public_id, event_url, iso_start): Modifies the...
Implement the Python class `AppointmentDetail` described below. Class description: Implement the AppointmentDetail class. Method signatures and docstrings: - def get(self, public_id, event_url, iso_start): Returns the details for a specific appointment. - def patch(self, public_id, event_url, iso_start): Modifies the...
0e3de8c653a77756c81c4a8fe49146718326b02d
<|skeleton|> class AppointmentDetail: def get(self, public_id, event_url, iso_start): """Returns the details for a specific appointment.""" <|body_0|> def patch(self, public_id, event_url, iso_start): """Modifies the specific appointment.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AppointmentDetail: def get(self, public_id, event_url, iso_start): """Returns the details for a specific appointment.""" appointment = db.session.query(Appointment).filter(User.public_id == public_id, Event.url == event_url, Appointment.start == parser.isoparse(iso_start)).first() if a...
the_stack_v2_python_sparse
server/project/api/appointment_handler.py
hatchways/team-matcha
train
10
ce855f0de12008d3b6ea3c69c441b9fe1dfea18f
[ "res = ListNode(0)\ntemp = res\ncarry = 0\nwhile l1 or l2 or carry:\n val1 = l1.val if l1 else 0\n val2 = l2.val if l2 else 0\n lsum = carry + val1 + val2\n carry = 1 if lsum >= 10 else 0\n lsum = lsum if lsum < 10 else lsum % 10\n temp.next = ListNode(lsum)\n temp = temp.next\n l1 = l1.next...
<|body_start_0|> res = ListNode(0) temp = res carry = 0 while l1 or l2 or carry: val1 = l1.val if l1 else 0 val2 = l2.val if l2 else 0 lsum = carry + val1 + val2 carry = 1 if lsum >= 10 else 0 lsum = lsum if lsum < 10 else lsum ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sum_lists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def sum_lists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> res...
stack_v2_sparse_classes_75kplus_train_066763
2,169
permissive
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "sum_lists", "signature": "def sum_lists(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "sum_lists", "signature": "def sum_lists(self, l1, l2)" } ]
2
stack_v2_sparse_classes_30k_train_045731
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sum_lists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def sum_lists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sum_lists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def sum_lists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode <|skele...
8788bde5349f326aac0267531f39ac7a2a708ee6
<|skeleton|> class Solution: def sum_lists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def sum_lists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sum_lists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" res = ListNode(0) temp = res carry = 0 while l1 or l2 or carry: val1 = l1.val if l1 else 0 val2 = l2.val if l2 else 0 lsum = carry + v...
the_stack_v2_python_sparse
CTCI/chapter-2/2.5-sum-lists.py
MiKueen/Data-Structures-and-Algorithms
train
0
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nif validate_token(self.request, data['token'], allow_test=True):\n self.success_url = reverse('questions', kwargs={'course': data['course'].id})\n return super().form_valid(form)\nmessages.warning(self.request, 'Invalid Token. Please try again. Note: Tokens are caSE SensITive')\nret...
<|body_start_0|> data = form.cleaned_data if validate_token(self.request, data['token'], allow_test=True): self.success_url = reverse('questions', kwargs={'course': data['course'].id}) return super().form_valid(form) messages.warning(self.request, 'Invalid Token. Please t...
This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, they're redirected to the Home Page.
ChooseQuestionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChooseQuestionView: """This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, t...
stack_v2_sparse_classes_75kplus_train_066764
29,759
no_license
[ { "docstring": "Validate exam Token and other requirements.", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_012522
Implement the Python class `ChooseQuestionView` described below. Class description: This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for correcti...
Implement the Python class `ChooseQuestionView` described below. Class description: This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for correcti...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ChooseQuestionView: """This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChooseQuestionView: """This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, they're redire...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
eca70dbc7a701aa9346ba4cef8df950a66a7942f
[ "name = ''\nfor i in CertConf.CERT_FROM:\n if from_id == i['id']:\n name = i['name']\n break\nreturn name", "name = ''\nfor i in CertConf.CERT_STATUS:\n if status_id == i['id']:\n name = i['name']\n break\nreturn name" ]
<|body_start_0|> name = '' for i in CertConf.CERT_FROM: if from_id == i['id']: name = i['name'] break return name <|end_body_0|> <|body_start_1|> name = '' for i in CertConf.CERT_STATUS: if status_id == i['id']: ...
证书配置
CertConf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CertConf: """证书配置""" def cert_from_name(from_id): """来源名称""" <|body_0|> def cert_status_name(status_id): """状态名称""" <|body_1|> <|end_skeleton|> <|body_start_0|> name = '' for i in CertConf.CERT_FROM: if from_id == i['id']: ...
stack_v2_sparse_classes_75kplus_train_066765
43,003
no_license
[ { "docstring": "来源名称", "name": "cert_from_name", "signature": "def cert_from_name(from_id)" }, { "docstring": "状态名称", "name": "cert_status_name", "signature": "def cert_status_name(status_id)" } ]
2
null
Implement the Python class `CertConf` described below. Class description: 证书配置 Method signatures and docstrings: - def cert_from_name(from_id): 来源名称 - def cert_status_name(status_id): 状态名称
Implement the Python class `CertConf` described below. Class description: 证书配置 Method signatures and docstrings: - def cert_from_name(from_id): 来源名称 - def cert_status_name(status_id): 状态名称 <|skeleton|> class CertConf: """证书配置""" def cert_from_name(from_id): """来源名称""" <|body_0|> def cer...
a6902af1265f9059137c369be009c49c7afdde45
<|skeleton|> class CertConf: """证书配置""" def cert_from_name(from_id): """来源名称""" <|body_0|> def cert_status_name(status_id): """状态名称""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CertConf: """证书配置""" def cert_from_name(from_id): """来源名称""" name = '' for i in CertConf.CERT_FROM: if from_id == i['id']: name = i['name'] break return name def cert_status_name(status_id): """状态名称""" name =...
the_stack_v2_python_sparse
common/feed.py
jy02383505/portal
train
0
fadc2499712f508f346f313829dbfbd408c0d380
[ "hashmap = db_api.get_instance()\nmapping_list = []\nmappings_uuid_list = hashmap.list_mappings(group_uuid=group_id)\nfor mapping_uuid in mappings_uuid_list:\n mapping_db = hashmap.get_mapping(uuid=mapping_uuid)\n mapping_list.append(mapping_models.Mapping(**mapping_db.export_model()))\nres = mapping_models.M...
<|body_start_0|> hashmap = db_api.get_instance() mapping_list = [] mappings_uuid_list = hashmap.list_mappings(group_uuid=group_id) for mapping_uuid in mappings_uuid_list: mapping_db = hashmap.get_mapping(uuid=mapping_uuid) mapping_list.append(mapping_models.Mappin...
Controller responsible of groups management.
HashMapGroupsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashMapGroupsController: """Controller responsible of groups management.""" def mappings(self, group_id): """Get the mappings attached to the group. :param group_id: UUID of the group to filter on.""" <|body_0|> def thresholds(self, group_id): """Get the threshol...
stack_v2_sparse_classes_75kplus_train_066766
5,120
permissive
[ { "docstring": "Get the mappings attached to the group. :param group_id: UUID of the group to filter on.", "name": "mappings", "signature": "def mappings(self, group_id)" }, { "docstring": "Get the thresholds attached to the group. :param group_id: UUID of the group to filter on.", "name": "...
6
stack_v2_sparse_classes_30k_train_040180
Implement the Python class `HashMapGroupsController` described below. Class description: Controller responsible of groups management. Method signatures and docstrings: - def mappings(self, group_id): Get the mappings attached to the group. :param group_id: UUID of the group to filter on. - def thresholds(self, group_...
Implement the Python class `HashMapGroupsController` described below. Class description: Controller responsible of groups management. Method signatures and docstrings: - def mappings(self, group_id): Get the mappings attached to the group. :param group_id: UUID of the group to filter on. - def thresholds(self, group_...
94630b97cd1fb4bdd9a638070ffbbe3625de8aa2
<|skeleton|> class HashMapGroupsController: """Controller responsible of groups management.""" def mappings(self, group_id): """Get the mappings attached to the group. :param group_id: UUID of the group to filter on.""" <|body_0|> def thresholds(self, group_id): """Get the threshol...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HashMapGroupsController: """Controller responsible of groups management.""" def mappings(self, group_id): """Get the mappings attached to the group. :param group_id: UUID of the group to filter on.""" hashmap = db_api.get_instance() mapping_list = [] mappings_uuid_list = h...
the_stack_v2_python_sparse
cloudkitty/rating/hash/controllers/group.py
openstack/cloudkitty
train
103
2dab49d929719f3f3a35cc9a0529ca4f9b4b24c8
[ "s = CustomerSubmitApplicationSerializer(data=request.data)\ns.is_valid(raise_exception=True)\npay_from = s.validated_data['pay_from']\nname = s.validated_data['name']\ntel = s.validated_data['tel']\nid_number = s.validated_data['id_number']\nid_card_back = s.validated_data.get('id_card_back')\nid_card_front = s.va...
<|body_start_0|> s = CustomerSubmitApplicationSerializer(data=request.data) s.is_valid(raise_exception=True) pay_from = s.validated_data['pay_from'] name = s.validated_data['name'] tel = s.validated_data['tel'] id_number = s.validated_data['id_number'] id_card_bac...
CustomerSubjectermViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerSubjectermViewSet: def create_alipay_order(self, request, pk=None): """提交报名""" <|body_0|> def create_wechat_order(self, request, pk=None): """提交报名""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = CustomerSubmitApplicationSerializer(data=r...
stack_v2_sparse_classes_75kplus_train_066767
11,615
no_license
[ { "docstring": "提交报名", "name": "create_alipay_order", "signature": "def create_alipay_order(self, request, pk=None)" }, { "docstring": "提交报名", "name": "create_wechat_order", "signature": "def create_wechat_order(self, request, pk=None)" } ]
2
stack_v2_sparse_classes_30k_train_023033
Implement the Python class `CustomerSubjectermViewSet` described below. Class description: Implement the CustomerSubjectermViewSet class. Method signatures and docstrings: - def create_alipay_order(self, request, pk=None): 提交报名 - def create_wechat_order(self, request, pk=None): 提交报名
Implement the Python class `CustomerSubjectermViewSet` described below. Class description: Implement the CustomerSubjectermViewSet class. Method signatures and docstrings: - def create_alipay_order(self, request, pk=None): 提交报名 - def create_wechat_order(self, request, pk=None): 提交报名 <|skeleton|> class CustomerSubjec...
53cda7937ff628538ecfcee1edf8d9ef03edee81
<|skeleton|> class CustomerSubjectermViewSet: def create_alipay_order(self, request, pk=None): """提交报名""" <|body_0|> def create_wechat_order(self, request, pk=None): """提交报名""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomerSubjectermViewSet: def create_alipay_order(self, request, pk=None): """提交报名""" s = CustomerSubmitApplicationSerializer(data=request.data) s.is_valid(raise_exception=True) pay_from = s.validated_data['pay_from'] name = s.validated_data['name'] tel = s.val...
the_stack_v2_python_sparse
apps/customer/subjects/viewsets.py
largerbigsuper/Building_Knowledge_Stack
train
0
8be088dda6bf281c0a914a1d9b5ca899b01e3fc0
[ "self.k = k\nself.hash_func = hash_func\nself.elements = {}\nself.advice_obj = advice_obj\nself.func_of_freq = lambda x: x ** p", "sorted_elements = sorted(self.elements.items(), key=lambda x: x[1][0])\nfor i in range(self.k, len(sorted_elements)):\n del self.elements[sorted_elements[i][0]]", "if key in self...
<|body_start_0|> self.k = k self.hash_func = hash_func self.elements = {} self.advice_obj = advice_obj self.func_of_freq = lambda x: x ** p <|end_body_0|> <|body_start_1|> sorted_elements = sorted(self.elements.items(), key=lambda x: x[1][0]) for i in range(self....
Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always contains the k keys with lowest seed. For each key x...
MomentEstimatorSketch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MomentEstimatorSketch: """Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always con...
stack_v2_sparse_classes_75kplus_train_066768
24,996
permissive
[ { "docstring": "Initializes an empty sketch/sample of specified size. Args: k: Sample size hash_func: The randomness used for the sample (a hash function that maps each key into a supposedly independent exponential random variable with parameter 1) p: The moment estimated by the sketch advice_obj: An object tha...
4
stack_v2_sparse_classes_30k_train_016187
Implement the Python class `MomentEstimatorSketch` described below. Class description: Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of element...
Implement the Python class `MomentEstimatorSketch` described below. Class description: Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of element...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class MomentEstimatorSketch: """Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MomentEstimatorSketch: """Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always contains the k k...
the_stack_v2_python_sparse
moment_advice/moment_advice.py
Ayoob7/google-research
train
2
ccff04e26f54c2d02d1e79406183782ee2e736d6
[ "self.totalSize = len(v1) + len(v2)\nself.index = 0\nself.data = []\nsmaller = min(len(v1), len(v2))\nfor i in range(smaller):\n self.data.append(v1[i])\n self.data.append(v2[i])\nif len(v1) > len(v2):\n self.data.extend(v1[smaller:])\nelse:\n self.data.extend(v2[smaller:])", "val = self.data[self.ind...
<|body_start_0|> self.totalSize = len(v1) + len(v2) self.index = 0 self.data = [] smaller = min(len(v1), len(v2)) for i in range(smaller): self.data.append(v1[i]) self.data.append(v2[i]) if len(v1) > len(v2): self.data.extend(v1[smaller...
ZigzagIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_75kplus_train_066769
1,053
no_license
[ { "docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]", "name": "__init__", "signature": "def __init__(self, v1, v2)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name"...
3
stack_v2_sparse_classes_30k_train_013762
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
9a827352ab8939cb6ed205fc2bda9284459a489c
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" self.totalSize = len(v1) + len(v2) self.index = 0 self.data = [] smaller = min(len(v1), len(v2)) for i in range(smaller): s...
the_stack_v2_python_sparse
281.py
kirtivr/leetcode
train
0
6cb4a91d6321b5c8c8afef1b4e6a38efd08d42a3
[ "pipeline_path = PipelineFactory.getPipelinePath(config['pipeline'])\nlogger.info('PipelineFactory: creating a pipeline from path: %s' % pipeline_path)\npython_version = sys.version.split(' ')[0]\nlogger.info('python_version: %s' % python_version)\nif pipeline_path.startswith('.'):\n file_path = os.path.abspath(...
<|body_start_0|> pipeline_path = PipelineFactory.getPipelinePath(config['pipeline']) logger.info('PipelineFactory: creating a pipeline from path: %s' % pipeline_path) python_version = sys.version.split(' ')[0] logger.info('python_version: %s' % python_version) if pipeline_path.st...
PipelineFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineFactory: def createPipeline(config): """Return a class instance from a pipeline string""" <|body_0|> def getPipelinePath(pipeline): """Mapping from keywords to the pipeline module/class""" <|body_1|> <|end_skeleton|> <|body_start_0|> pipelin...
stack_v2_sparse_classes_75kplus_train_066770
2,330
permissive
[ { "docstring": "Return a class instance from a pipeline string", "name": "createPipeline", "signature": "def createPipeline(config)" }, { "docstring": "Mapping from keywords to the pipeline module/class", "name": "getPipelinePath", "signature": "def getPipelinePath(pipeline)" } ]
2
null
Implement the Python class `PipelineFactory` described below. Class description: Implement the PipelineFactory class. Method signatures and docstrings: - def createPipeline(config): Return a class instance from a pipeline string - def getPipelinePath(pipeline): Mapping from keywords to the pipeline module/class
Implement the Python class `PipelineFactory` described below. Class description: Implement the PipelineFactory class. Method signatures and docstrings: - def createPipeline(config): Return a class instance from a pipeline string - def getPipelinePath(pipeline): Mapping from keywords to the pipeline module/class <|sk...
09525140b4d080e647be2a1a830233318634db8d
<|skeleton|> class PipelineFactory: def createPipeline(config): """Return a class instance from a pipeline string""" <|body_0|> def getPipelinePath(pipeline): """Mapping from keywords to the pipeline module/class""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PipelineFactory: def createPipeline(config): """Return a class instance from a pipeline string""" pipeline_path = PipelineFactory.getPipelinePath(config['pipeline']) logger.info('PipelineFactory: creating a pipeline from path: %s' % pipeline_path) python_version = sys.version.s...
the_stack_v2_python_sparse
awstreamer/gst_pipeline/pipeline_factory.py
intergavg/aws-streamer
train
0
a641068d5f9e8ca74fd8f9104c54ace603bef430
[ "for i in range(len(array)):\n for j in range(i + 1, len(array)):\n if target == array[i] + array[j]:\n return True\nreturn False", "record = {}\nfor i in range(len(array)):\n if array[i] in record:\n return True\n else:\n record[target - array[i]] = True\nreturn False", ...
<|body_start_0|> for i in range(len(array)): for j in range(i + 1, len(array)): if target == array[i] + array[j]: return True return False <|end_body_0|> <|body_start_1|> record = {} for i in range(len(array)): if array[i] in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def existSum(self, array, target): """input: int[] array, int target return: boolean""" <|body_0|> def existSum_2(self, array, target): """input: int[] array, int target return: boolean""" <|body_1|> def existSum_3(self, array, target): ...
stack_v2_sparse_classes_75kplus_train_066771
1,734
no_license
[ { "docstring": "input: int[] array, int target return: boolean", "name": "existSum", "signature": "def existSum(self, array, target)" }, { "docstring": "input: int[] array, int target return: boolean", "name": "existSum_2", "signature": "def existSum_2(self, array, target)" }, { ...
3
stack_v2_sparse_classes_30k_train_029127
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def existSum(self, array, target): input: int[] array, int target return: boolean - def existSum_2(self, array, target): input: int[] array, int target return: boolean - def exis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def existSum(self, array, target): input: int[] array, int target return: boolean - def existSum_2(self, array, target): input: int[] array, int target return: boolean - def exis...
8d9eb98fa5e897602eae9c37b47fd8abae72b1dc
<|skeleton|> class Solution: def existSum(self, array, target): """input: int[] array, int target return: boolean""" <|body_0|> def existSum_2(self, array, target): """input: int[] array, int target return: boolean""" <|body_1|> def existSum_3(self, array, target): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def existSum(self, array, target): """input: int[] array, int target return: boolean""" for i in range(len(array)): for j in range(i + 1, len(array)): if target == array[i] + array[j]: return True return False def existSum_...
the_stack_v2_python_sparse
array/k_sum/two_sum.py
wanlipu/coding-python
train
0
db6875b864e0568a878dd9595f35d4496c2d41b7
[ "if add_one == '0':\n if num1 == '1' and num2 == '1':\n return ('1', '0')\n if num1 == '1' and num2 == '0' or (num1 == '0' and num2 == '1'):\n return ('0', '1')\n else:\n return ('0', '0')\nelse:\n if num1 == '1' and num2 == '1':\n return ('1', '1')\n if num1 == '1' and nu...
<|body_start_0|> if add_one == '0': if num1 == '1' and num2 == '1': return ('1', '0') if num1 == '1' and num2 == '0' or (num1 == '0' and num2 == '1'): return ('0', '1') else: return ('0', '0') else: if num1 =...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addBit(self, num1, num2, add_one): """:return: add_one cur_num""" <|body_0|> def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if add_one == '0': if num1 == ...
stack_v2_sparse_classes_75kplus_train_066772
2,815
permissive
[ { "docstring": ":return: add_one cur_num", "name": "addBit", "signature": "def addBit(self, num1, num2, add_one)" }, { "docstring": ":type a: str :type b: str :rtype: str", "name": "addBinary", "signature": "def addBinary(self, a, b)" } ]
2
stack_v2_sparse_classes_30k_train_049434
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBit(self, num1, num2, add_one): :return: add_one cur_num - def addBinary(self, a, b): :type a: str :type b: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBit(self, num1, num2, add_one): :return: add_one cur_num - def addBinary(self, a, b): :type a: str :type b: str :rtype: str <|skeleton|> class Solution: def addBit(s...
1ed22267156fb968671731c2e983b0e65f670750
<|skeleton|> class Solution: def addBit(self, num1, num2, add_one): """:return: add_one cur_num""" <|body_0|> def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addBit(self, num1, num2, add_one): """:return: add_one cur_num""" if add_one == '0': if num1 == '1' and num2 == '1': return ('1', '0') if num1 == '1' and num2 == '0' or (num1 == '0' and num2 == '1'): return ('0', '1') ...
the_stack_v2_python_sparse
leetcode/67.py
pingrunhuang/CodeChallenge
train
0
ac7ca83839cb1a2d81186be1f0a47339111594a8
[ "if golden_questions is None:\n golden_questions = set()\nmodel.SetSampleParameters(data)\nfor question, (responses, resolution_map) in data.iteritems():\n if question in golden_questions:\n continue\n resolution_map.clear()\n probabilistic_resolution_map = model.ResolveQuestion(responses)\n a...
<|body_start_0|> if golden_questions is None: golden_questions = set() model.SetSampleParameters(data) for question, (responses, resolution_map) in data.iteritems(): if question in golden_questions: continue resolution_map.clear() p...
Implements the substitution sampling algorithm for judgments.
SubstitutionSampling
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstitutionSampling: """Implements the substitution sampling algorithm for judgments.""" def DrawOneSample(data, model, golden_questions=None, add_to=None): """Performs one step of the substitution sampling algorithm. Note: This method updates the resolution maps in data with random...
stack_v2_sparse_classes_75kplus_train_066773
6,645
permissive
[ { "docstring": "Performs one step of the substitution sampling algorithm. Note: This method updates the resolution maps in data with randomly sampled resolutions and updates model with randomly sampled parameters. Args: data: A ResolverData structure. model: A statistical model for the problem. It must provide ...
2
stack_v2_sparse_classes_30k_train_012838
Implement the Python class `SubstitutionSampling` described below. Class description: Implements the substitution sampling algorithm for judgments. Method signatures and docstrings: - def DrawOneSample(data, model, golden_questions=None, add_to=None): Performs one step of the substitution sampling algorithm. Note: Th...
Implement the Python class `SubstitutionSampling` described below. Class description: Implements the substitution sampling algorithm for judgments. Method signatures and docstrings: - def DrawOneSample(data, model, golden_questions=None, add_to=None): Performs one step of the substitution sampling algorithm. Note: Th...
ae15c07abdf99acc26ac402803b1f7dae8ba223e
<|skeleton|> class SubstitutionSampling: """Implements the substitution sampling algorithm for judgments.""" def DrawOneSample(data, model, golden_questions=None, add_to=None): """Performs one step of the substitution sampling algorithm. Note: This method updates the resolution maps in data with random...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubstitutionSampling: """Implements the substitution sampling algorithm for judgments.""" def DrawOneSample(data, model, golden_questions=None, add_to=None): """Performs one step of the substitution sampling algorithm. Note: This method updates the resolution maps in data with randomly sampled re...
the_stack_v2_python_sparse
resolver/substitution_sampling.py
charlieyqin/resolver-library
train
0
9b92c65a94e83060a3c9d507e8a1ac682f0c1289
[ "LDC_Info.__init__(self)\nself.setTitle(self.name)\nself.status = compat_res[0]\nui = Ui_WebcamFrame()\nui.setupUi(self.frame)\nself.__fill_frame(ui, info_res, compat_res, diag_res)", "ui.productLineEdit.setText(QtGui.QApplication.translate('WebcamFrame', info_res.product, None, QtGui.QApplication.UnicodeUTF8))\n...
<|body_start_0|> LDC_Info.__init__(self) self.setTitle(self.name) self.status = compat_res[0] ui = Ui_WebcamFrame() ui.setupUi(self.frame) self.__fill_frame(ui, info_res, compat_res, diag_res) <|end_body_0|> <|body_start_1|> ui.productLineEdit.setText(QtGui.QAppl...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.
GUIWebcam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIWebcam: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_...
stack_v2_sparse_classes_75kplus_train_066774
2,304
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_res -- Lista com as tuples de resultados de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagn�stico (lista de 'DaigResWebcam')", "name": "__init__", "signatur...
2
stack_v2_sparse_classes_30k_train_001292
Implement the Python class `GUIWebcam` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os ...
Implement the Python class `GUIWebcam` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os ...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIWebcam: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GUIWebcam: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_res -- Lista ...
the_stack_v2_python_sparse
src/libs/webcam/gui_webcam.py
adrianomelo/ldc-desktop
train
1
b1702183ee39602e24e55d5cacab72dd59f41274
[ "memo = {}\nfor p, s, e in trips:\n memo[s] = memo.get(s, 0) + p\n memo[e] = memo.get(e, 0) - p\ntakenSeats = 0\nfor k in sorted(memo.keys()):\n takenSeats += memo[k]\n if takenSeats > capacity:\n return False\nreturn True", "MAX_LOCATION = 1001\nmemo = [0] * MAX_LOCATION\nfor p, s, e in trips:...
<|body_start_0|> memo = {} for p, s, e in trips: memo[s] = memo.get(s, 0) + p memo[e] = memo.get(e, 0) - p takenSeats = 0 for k in sorted(memo.keys()): takenSeats += memo[k] if takenSeats > capacity: return False ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """General solution without knowing the range of the start and end locations.""" <|body_0|> def carPooling2(self, trips: List[List[int]], capacity: int) -> bool: """Optimized by taking adv...
stack_v2_sparse_classes_75kplus_train_066775
1,165
no_license
[ { "docstring": "General solution without knowing the range of the start and end locations.", "name": "carPooling", "signature": "def carPooling(self, trips: List[List[int]], capacity: int) -> bool" }, { "docstring": "Optimized by taking advantage of the start and end locations. The restriction i...
2
stack_v2_sparse_classes_30k_train_035867
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips: List[List[int]], capacity: int) -> bool: General solution without knowing the range of the start and end locations. - def carPooling2(self, trips: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips: List[List[int]], capacity: int) -> bool: General solution without knowing the range of the start and end locations. - def carPooling2(self, trips: Lis...
edb870f83f0c4568cce0cacec04ee70cf6b545bf
<|skeleton|> class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """General solution without knowing the range of the start and end locations.""" <|body_0|> def carPooling2(self, trips: List[List[int]], capacity: int) -> bool: """Optimized by taking adv...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """General solution without knowing the range of the start and end locations.""" memo = {} for p, s, e in trips: memo[s] = memo.get(s, 0) + p memo[e] = memo.get(e, 0) - p take...
the_stack_v2_python_sparse
2020/car_pooling.py
eronekogin/leetcode
train
0
95bb6c9dd3797fa7bf14c8f37551e0be6bcd3d3b
[ "ret = {}\nfor key in reversed(self):\n for unused_config_dir, config in reversed(self[key]):\n ret = OverrideConfig(ret, config)\nreturn ret", "depends = []\nfor config_name in self:\n for config_dir, unused_config in self[config_name]:\n depends.append(os.path.join(config_dir, config_name + ...
<|body_start_0|> ret = {} for key in reversed(self): for unused_config_dir, config in reversed(self[key]): ret = OverrideConfig(ret, config) return ret <|end_body_0|> <|body_start_1|> depends = [] for config_name in self: for config_dir, u...
Internal structure to store a list of raw configs.
_ConfigList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ConfigList: """Internal structure to store a list of raw configs.""" def Resolve(self): """Returns the final config after overriding.""" <|body_0|> def CollectDepend(self): """Returns a list of all files loaded for this config list. Returns: a list of paths (str...
stack_v2_sparse_classes_75kplus_train_066776
23,547
permissive
[ { "docstring": "Returns the final config after overriding.", "name": "Resolve", "signature": "def Resolve(self)" }, { "docstring": "Returns a list of all files loaded for this config list. Returns: a list of paths (strings).", "name": "CollectDepend", "signature": "def CollectDepend(self...
2
stack_v2_sparse_classes_30k_train_029591
Implement the Python class `_ConfigList` described below. Class description: Internal structure to store a list of raw configs. Method signatures and docstrings: - def Resolve(self): Returns the final config after overriding. - def CollectDepend(self): Returns a list of all files loaded for this config list. Returns:...
Implement the Python class `_ConfigList` described below. Class description: Internal structure to store a list of raw configs. Method signatures and docstrings: - def Resolve(self): Returns the final config after overriding. - def CollectDepend(self): Returns a list of all files loaded for this config list. Returns:...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class _ConfigList: """Internal structure to store a list of raw configs.""" def Resolve(self): """Returns the final config after overriding.""" <|body_0|> def CollectDepend(self): """Returns a list of all files loaded for this config list. Returns: a list of paths (str...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _ConfigList: """Internal structure to store a list of raw configs.""" def Resolve(self): """Returns the final config after overriding.""" ret = {} for key in reversed(self): for unused_config_dir, config in reversed(self[key]): ret = OverrideConfig(ret,...
the_stack_v2_python_sparse
py/utils/config_utils.py
bridder/factory
train
0
033e5cd1ea8ddb9f25f7f8bc26c1dd398ef19233
[ "self.approx = approx\nself.divisor = divisor\nself.force_fma = force_fma\nif force_fma:\n self.error = FusedMultiplyAdd(divisor, approx, 1.0, specifier=FusedMultiplyAdd.SubtractNegate)\n self.new_approx = FusedMultiplyAdd(self.error, self.approx, self.approx, specifier=FusedMultiplyAdd.Standard)\nelse:\n ...
<|body_start_0|> self.approx = approx self.divisor = divisor self.force_fma = force_fma if force_fma: self.error = FusedMultiplyAdd(divisor, approx, 1.0, specifier=FusedMultiplyAdd.SubtractNegate) self.new_approx = FusedMultiplyAdd(self.error, self.approx, self.ap...
Newton-Raphson iteration generator
NR_Iteration
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NR_Iteration: """Newton-Raphson iteration generator""" def __init__(self, approx, divisor, force_fma=False): """@param approx initial approximation of 1.0 / @p divisor @param divisor reciprocal input @param force_fma force the use of Fused Multiply and Add""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_066777
33,449
permissive
[ { "docstring": "@param approx initial approximation of 1.0 / @p divisor @param divisor reciprocal input @param force_fma force the use of Fused Multiply and Add", "name": "__init__", "signature": "def __init__(self, approx, divisor, force_fma=False)" }, { "docstring": "generate a hint rule to he...
2
stack_v2_sparse_classes_30k_train_019179
Implement the Python class `NR_Iteration` described below. Class description: Newton-Raphson iteration generator Method signatures and docstrings: - def __init__(self, approx, divisor, force_fma=False): @param approx initial approximation of 1.0 / @p divisor @param divisor reciprocal input @param force_fma force the ...
Implement the Python class `NR_Iteration` described below. Class description: Newton-Raphson iteration generator Method signatures and docstrings: - def __init__(self, approx, divisor, force_fma=False): @param approx initial approximation of 1.0 / @p divisor @param divisor reciprocal input @param force_fma force the ...
f96b1bc33a1cffd14cc322a770835cc7435de599
<|skeleton|> class NR_Iteration: """Newton-Raphson iteration generator""" def __init__(self, approx, divisor, force_fma=False): """@param approx initial approximation of 1.0 / @p divisor @param divisor reciprocal input @param force_fma force the use of Fused Multiply and Add""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NR_Iteration: """Newton-Raphson iteration generator""" def __init__(self, approx, divisor, force_fma=False): """@param approx initial approximation of 1.0 / @p divisor @param divisor reciprocal input @param force_fma force the use of Fused Multiply and Add""" self.approx = approx ...
the_stack_v2_python_sparse
metalibm_functions/ml_div.py
metalibm/metalibm
train
23
5efb406f5f49031a685b52e1c49c0e4c064b0956
[ "ScManager.log.info('Check criterion for Spark usage.')\nif type(tsuid_list) is not list:\n raise TypeError('Input `tsuid_list` is {}, list expected.'.format(type(tsuid_list)))\nif type(meta_list) is not dict and meta_list is not None:\n raise TypeError('Input `meta_list` is {}, dict expected.'.format(type(me...
<|body_start_0|> ScManager.log.info('Check criterion for Spark usage.') if type(tsuid_list) is not list: raise TypeError('Input `tsuid_list` is {}, list expected.'.format(type(tsuid_list))) if type(meta_list) is not dict and meta_list is not None: raise TypeError('Input `...
SparkUtils
[ "LGPL-3.0-only", "LGPL-2.0-or-later", "LGPL-3.0-or-later", "Zlib", "BSD-3-Clause", "Python-2.0", "ZPL-2.0", "LicenseRef-scancode-openssl-exception-lgpl3.0plus", "ZPL-2.1", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparkUtils: def check_spark_usage(tsuid_list, meta_list=None, nb_ts_criteria=100, nb_points_by_chunk=50000): """Function for checking Spark usage utility, function of the amount of available data. :param tsuid_list: A list of TS identifier ("tsuid") :type tsuid_list: list :param meta_lis...
stack_v2_sparse_classes_75kplus_train_066778
28,943
permissive
[ { "docstring": "Function for checking Spark usage utility, function of the amount of available data. :param tsuid_list: A list of TS identifier (\"tsuid\") :type tsuid_list: list :param meta_list: The list of meta data (not mandatory). If None, request IKATS for meta-data type meta_list: dict (key is TS identif...
3
null
Implement the Python class `SparkUtils` described below. Class description: Implement the SparkUtils class. Method signatures and docstrings: - def check_spark_usage(tsuid_list, meta_list=None, nb_ts_criteria=100, nb_points_by_chunk=50000): Function for checking Spark usage utility, function of the amount of availabl...
Implement the Python class `SparkUtils` described below. Class description: Implement the SparkUtils class. Method signatures and docstrings: - def check_spark_usage(tsuid_list, meta_list=None, nb_ts_criteria=100, nb_points_by_chunk=50000): Function for checking Spark usage utility, function of the amount of availabl...
0b04ab448faf1ffdc89687268c6192e69d61f890
<|skeleton|> class SparkUtils: def check_spark_usage(tsuid_list, meta_list=None, nb_ts_criteria=100, nb_points_by_chunk=50000): """Function for checking Spark usage utility, function of the amount of available data. :param tsuid_list: A list of TS identifier ("tsuid") :type tsuid_list: list :param meta_lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SparkUtils: def check_spark_usage(tsuid_list, meta_list=None, nb_ts_criteria=100, nb_points_by_chunk=50000): """Function for checking Spark usage utility, function of the amount of available data. :param tsuid_list: A list of TS identifier ("tsuid") :type tsuid_list: list :param meta_list: The list of...
the_stack_v2_python_sparse
src/ikats/core/library/spark.py
IKATS/ikats-pybase
train
0
ce1545b07f61f275ad0c61c956c7094e3bfdba11
[ "left = 0\nright = num\nif num == 1:\n return True\nwhile left < right - 1:\n mid = (left + right) // 2\n if mid ** 2 < num:\n left = mid\n if mid ** 2 > num:\n right = mid\n if mid ** 2 == num:\n return True\nreturn False", "i = 1 if num % 2 else 2\nwhile i ** 2 <= num:\n i...
<|body_start_0|> left = 0 right = num if num == 1: return True while left < right - 1: mid = (left + right) // 2 if mid ** 2 < num: left = mid if mid ** 2 > num: right = mid if mid ** 2 == num: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_0|> def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = 0 right = num if num == 1: ...
stack_v2_sparse_classes_75kplus_train_066779
883
no_license
[ { "docstring": ":type num: int :rtype: bool", "name": "isPerfectSquare", "signature": "def isPerfectSquare(self, num)" }, { "docstring": ":type num: int :rtype: bool", "name": "isPerfectSquare", "signature": "def isPerfectSquare(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_043714
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPerfectSquare(self, num): :type num: int :rtype: bool - def isPerfectSquare(self, num): :type num: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPerfectSquare(self, num): :type num: int :rtype: bool - def isPerfectSquare(self, num): :type num: int :rtype: bool <|skeleton|> class Solution: def isPerfectSquare(s...
2ecaeed38178819480388b5742bc2ea12009ae16
<|skeleton|> class Solution: def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_0|> def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPerfectSquare(self, num): """:type num: int :rtype: bool""" left = 0 right = num if num == 1: return True while left < right - 1: mid = (left + right) // 2 if mid ** 2 < num: left = mid if m...
the_stack_v2_python_sparse
367.valid-perfect-square.py
LouisYLWang/leetcode_python
train
0
8f70013da0449e2fba1487a06c9205dfba10689e
[ "for url in set(response.css('a::attr(href)').extract()):\n if url.startswith('/w/cpp') and (not url.endswith('symbol_index')):\n yield response.follow(url, callback=self.parse_symbol_index)", "names = resp.css('h1.firstHeading::text').extract()\nif not all((n.islower() or (n == '_' and n.startswith('st...
<|body_start_0|> for url in set(response.css('a::attr(href)').extract()): if url.startswith('/w/cpp') and (not url.endswith('symbol_index')): yield response.follow(url, callback=self.parse_symbol_index) <|end_body_0|> <|body_start_1|> names = resp.css('h1.firstHeading::text'...
Scrapes reference from the C++ symbol index: http://en.cppreference.com/w/cpp/symbol_index Basically this scrapes all symbols found in the std:: namespace. Several checks are done to ensure that only actual symbols are scraped.
CppSymbolSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CppSymbolSpider: """Scrapes reference from the C++ symbol index: http://en.cppreference.com/w/cpp/symbol_index Basically this scrapes all symbols found in the std:: namespace. Several checks are done to ensure that only actual symbols are scraped.""" def parse(self, response: scrapy.http.Res...
stack_v2_sparse_classes_75kplus_train_066780
7,010
no_license
[ { "docstring": "Invokes the callback self.parse_symbol_index for every link found on this page. A certain relevance is already validated here.", "name": "parse", "signature": "def parse(self, response: scrapy.http.Response)" }, { "docstring": "Parses a single symbol found in the std:: namespace....
4
null
Implement the Python class `CppSymbolSpider` described below. Class description: Scrapes reference from the C++ symbol index: http://en.cppreference.com/w/cpp/symbol_index Basically this scrapes all symbols found in the std:: namespace. Several checks are done to ensure that only actual symbols are scraped. Method si...
Implement the Python class `CppSymbolSpider` described below. Class description: Scrapes reference from the C++ symbol index: http://en.cppreference.com/w/cpp/symbol_index Basically this scrapes all symbols found in the std:: namespace. Several checks are done to ensure that only actual symbols are scraped. Method si...
32c12c4953d654334dfd97eb594456ae2549038a
<|skeleton|> class CppSymbolSpider: """Scrapes reference from the C++ symbol index: http://en.cppreference.com/w/cpp/symbol_index Basically this scrapes all symbols found in the std:: namespace. Several checks are done to ensure that only actual symbols are scraped.""" def parse(self, response: scrapy.http.Res...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CppSymbolSpider: """Scrapes reference from the C++ symbol index: http://en.cppreference.com/w/cpp/symbol_index Basically this scrapes all symbols found in the std:: namespace. Several checks are done to ensure that only actual symbols are scraped.""" def parse(self, response: scrapy.http.Response): ...
the_stack_v2_python_sparse
docflow/scraper/spiders/cpp_symbol_spider.py
strinking/docflow
train
7
035fa4f3697efcf97bf4613af180c4513a775e15
[ "self.dt = 0.5\nA = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])\nB = np.array([[self.dt, 0.0, 0.0], [0.0, self.dt, 0.0], [0.0, 0.0, self.dt]])\nQ = np.array([[1000, 0.0, 0.0], [0.0, 1000, 0.0], [0.0, 0.0, 1.0]])\nR = np.array([[0.5, 0.0, 0.0], [0.0, 0.5, 0.0], [0.0, 0.0, 1.0]])\nsuper().__init__(A...
<|body_start_0|> self.dt = 0.5 A = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) B = np.array([[self.dt, 0.0, 0.0], [0.0, self.dt, 0.0], [0.0, 0.0, self.dt]]) Q = np.array([[1000, 0.0, 0.0], [0.0, 1000, 0.0], [0.0, 0.0, 1.0]]) R = np.array([[0.5, 0.0, 0.0], [0.0, ...
MamboPositionController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MamboPositionController: def __init__(self): """Initializes the PositionController with Mambo system and weight matrices. Change Q and R to change weights on the states and inputs. The Mambo system is modeled the following way: x = [x_pos, y_pos, z_pos]' u = [x_vel, y_vel, z_vel]' sensin...
stack_v2_sparse_classes_75kplus_train_066781
7,596
no_license
[ { "docstring": "Initializes the PositionController with Mambo system and weight matrices. Change Q and R to change weights on the states and inputs. The Mambo system is modeled the following way: x = [x_pos, y_pos, z_pos]' u = [x_vel, y_vel, z_vel]' sensing x; fully observable system", "name": "__init__", ...
2
null
Implement the Python class `MamboPositionController` described below. Class description: Implement the MamboPositionController class. Method signatures and docstrings: - def __init__(self): Initializes the PositionController with Mambo system and weight matrices. Change Q and R to change weights on the states and inp...
Implement the Python class `MamboPositionController` described below. Class description: Implement the MamboPositionController class. Method signatures and docstrings: - def __init__(self): Initializes the PositionController with Mambo system and weight matrices. Change Q and R to change weights on the states and inp...
29e971c5f56677308af5faea7dbe8127b43fc3ec
<|skeleton|> class MamboPositionController: def __init__(self): """Initializes the PositionController with Mambo system and weight matrices. Change Q and R to change weights on the states and inputs. The Mambo system is modeled the following way: x = [x_pos, y_pos, z_pos]' u = [x_vel, y_vel, z_vel]' sensin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MamboPositionController: def __init__(self): """Initializes the PositionController with Mambo system and weight matrices. Change Q and R to change weights on the states and inputs. The Mambo system is modeled the following way: x = [x_pos, y_pos, z_pos]' u = [x_vel, y_vel, z_vel]' sensing x; fully obs...
the_stack_v2_python_sparse
estimation_and_control/PositionController.py
marcusabate/CooperativeMambois
train
0
948c85c592683726fc9828660f9e36710c9c9f29
[ "self.edit_type: int = edit_type\nself.origin: int = origin\nself.destination: int = destination\nself.length: int = length", "if self.edit_type == self.MOVE:\n return 'MOVE : %d -> %d, L= %d' % (self.origin, self.destination, self.length)\nif self.edit_type == self.DELETE:\n return 'DELETE : %d, L: %d' %...
<|body_start_0|> self.edit_type: int = edit_type self.origin: int = origin self.destination: int = destination self.length: int = length <|end_body_0|> <|body_start_1|> if self.edit_type == self.MOVE: return 'MOVE : %d -> %d, L= %d' % (self.origin, self.destination...
Class representing an edit, i.e. a change from one version to the next.
Edit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Edit: """Class representing an edit, i.e. a change from one version to the next.""" def __init__(self, edit_type: int, origin: int, destination: int, length: int) -> None: """Edit Constructor: -edit_type: The type of this edit. Should conform to constants declared above -origin: The ...
stack_v2_sparse_classes_75kplus_train_066782
2,603
no_license
[ { "docstring": "Edit Constructor: -edit_type: The type of this edit. Should conform to constants declared above -origin: The origin of this edit. In moves origin is the location of the moved text in the previous version. In deletes, origin is the location at which the removed text was. In insertions, origin is ...
3
stack_v2_sparse_classes_30k_train_043169
Implement the Python class `Edit` described below. Class description: Class representing an edit, i.e. a change from one version to the next. Method signatures and docstrings: - def __init__(self, edit_type: int, origin: int, destination: int, length: int) -> None: Edit Constructor: -edit_type: The type of this edit....
Implement the Python class `Edit` described below. Class description: Class representing an edit, i.e. a change from one version to the next. Method signatures and docstrings: - def __init__(self, edit_type: int, origin: int, destination: int, length: int) -> None: Edit Constructor: -edit_type: The type of this edit....
c6957919ab59f36355e33e597b868d358534150f
<|skeleton|> class Edit: """Class representing an edit, i.e. a change from one version to the next.""" def __init__(self, edit_type: int, origin: int, destination: int, length: int) -> None: """Edit Constructor: -edit_type: The type of this edit. Should conform to constants declared above -origin: The ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Edit: """Class representing an edit, i.e. a change from one version to the next.""" def __init__(self, edit_type: int, origin: int, destination: int, length: int) -> None: """Edit Constructor: -edit_type: The type of this edit. Should conform to constants declared above -origin: The origin of thi...
the_stack_v2_python_sparse
wikitrust_py/computation_engine/wikitrust_algorithms/text_diff/edit.py
WikiTrust/WikiTrust2.0
train
3
ab055e3c903c0a1c51ea4e8407d5df8c4b964dc7
[ "try:\n http_method = self._resolve_method(request)\n http_headers = self._convert_list_tuples_to_dict(headers_list=request.headers)\n parsed_url = parse_url(request.url)\n if parsed_url.scheme is None or parsed_url.scheme != 'https':\n raise ApiClientException('Requests against non-HTTPS endpoin...
<|body_start_0|> try: http_method = self._resolve_method(request) http_headers = self._convert_list_tuples_to_dict(headers_list=request.headers) parsed_url = parse_url(request.url) if parsed_url.scheme is None or parsed_url.scheme != 'https': raise...
Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.
DefaultApiClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultApiClient: """Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.""" def invoke(self, request): """Dispatches a request to an API endpoint described in the request. Resolves the method from input request obj...
stack_v2_sparse_classes_75kplus_train_066783
6,077
permissive
[ { "docstring": "Dispatches a request to an API endpoint described in the request. Resolves the method from input request object, converts the list of header tuples to the required format (dict) for the `requests` lib call and invokes the method with corresponding parameters on `requests` library. The response f...
4
stack_v2_sparse_classes_30k_train_008645
Implement the Python class `DefaultApiClient` described below. Class description: Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library. Method signatures and docstrings: - def invoke(self, request): Dispatches a request to an API endpoint described i...
Implement the Python class `DefaultApiClient` described below. Class description: Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library. Method signatures and docstrings: - def invoke(self, request): Dispatches a request to an API endpoint described i...
7e13ca69b240985584dff6ec633a27598a154ca1
<|skeleton|> class DefaultApiClient: """Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.""" def invoke(self, request): """Dispatches a request to an API endpoint described in the request. Resolves the method from input request obj...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultApiClient: """Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.""" def invoke(self, request): """Dispatches a request to an API endpoint described in the request. Resolves the method from input request object, converts...
the_stack_v2_python_sparse
ask-sdk-core/ask_sdk_core/api_client.py
alexa/alexa-skills-kit-sdk-for-python
train
560
b1c77a78e55f5e7a9ab1154871b970af629d52bb
[ "self.root_public_folder_vec = root_public_folder_vec\nself.target_folder_path = target_folder_path\nself.target_root_public_folder = target_root_public_folder", "if dictionary is None:\n return None\nroot_public_folder_vec = None\nif dictionary.get('rootPublicFolderVec') != None:\n root_public_folder_vec =...
<|body_start_0|> self.root_public_folder_vec = root_public_folder_vec self.target_folder_path = target_folder_path self.target_root_public_folder = target_root_public_folder <|end_body_0|> <|body_start_1|> if dictionary is None: return None root_public_folder_vec = N...
Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be restored. Provision is there for restoring full and partial P...
RestoreO365PublicFoldersParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreO365PublicFoldersParams: """Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be res...
stack_v2_sparse_classes_75kplus_train_066784
3,416
permissive
[ { "docstring": "Constructor for the RestoreO365PublicFoldersParams class", "name": "__init__", "signature": "def __init__(self, root_public_folder_vec=None, target_folder_path=None, target_root_public_folder=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dict...
2
stack_v2_sparse_classes_30k_train_053317
Implement the Python class `RestoreO365PublicFoldersParams` described below. Class description: Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide th...
Implement the Python class `RestoreO365PublicFoldersParams` described below. Class description: Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide th...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreO365PublicFoldersParams: """Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be res...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RestoreO365PublicFoldersParams: """Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be restored. Provis...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_o_365_public_folders_params.py
cohesity/management-sdk-python
train
24
9fb96ac46b5c682c1a3bbee8dbfd2f4b3c1272c9
[ "f = self.cleaned_data['avatar_upload']\nif f.size > self.MAX_FILE_SIZE:\n raise ValidationError(_('The file is too large.'))\ncontent_type = f.content_type.split('/')[0]\nif content_type != 'image':\n raise ValidationError(_('Only images are supported.'))\nreturn f", "storage = DefaultStorage()\nusername =...
<|body_start_0|> f = self.cleaned_data['avatar_upload'] if f.size > self.MAX_FILE_SIZE: raise ValidationError(_('The file is too large.')) content_type = f.content_type.split('/')[0] if content_type != 'image': raise ValidationError(_('Only images are supported.')...
The FileUploadService configuration form.
FileUploadServiceForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileUploadServiceForm: """The FileUploadService configuration form.""" def clean_file(self): """Ensure the uploaded file is an image of an appropriate size. Returns: django.core.files.UploadedFile: The uploaded file, if it is valid. Raises: django.core.exceptions.ValidationError: Rai...
stack_v2_sparse_classes_75kplus_train_066785
6,132
no_license
[ { "docstring": "Ensure the uploaded file is an image of an appropriate size. Returns: django.core.files.UploadedFile: The uploaded file, if it is valid. Raises: django.core.exceptions.ValidationError: Raised if the file is too large or the incorrect MIME type.", "name": "clean_file", "signature": "def c...
2
stack_v2_sparse_classes_30k_train_014416
Implement the Python class `FileUploadServiceForm` described below. Class description: The FileUploadService configuration form. Method signatures and docstrings: - def clean_file(self): Ensure the uploaded file is an image of an appropriate size. Returns: django.core.files.UploadedFile: The uploaded file, if it is v...
Implement the Python class `FileUploadServiceForm` described below. Class description: The FileUploadService configuration form. Method signatures and docstrings: - def clean_file(self): Ensure the uploaded file is an image of an appropriate size. Returns: django.core.files.UploadedFile: The uploaded file, if it is v...
99ea69d80a3a393b0da4da3152ef26e808dd8487
<|skeleton|> class FileUploadServiceForm: """The FileUploadService configuration form.""" def clean_file(self): """Ensure the uploaded file is an image of an appropriate size. Returns: django.core.files.UploadedFile: The uploaded file, if it is valid. Raises: django.core.exceptions.ValidationError: Rai...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileUploadServiceForm: """The FileUploadService configuration form.""" def clean_file(self): """Ensure the uploaded file is an image of an appropriate size. Returns: django.core.files.UploadedFile: The uploaded file, if it is valid. Raises: django.core.exceptions.ValidationError: Raised if the fi...
the_stack_v2_python_sparse
djblets/avatars/services/file_upload.py
chipx86/djblets
train
2
1e83aa1b49d409c154004b81ee923bd13091b92d
[ "super(BasicGGNN, self).__init__()\nself.ggnn = GatedGraphConv(in_feats=in_dim, out_feats=hidden_dim, n_steps=6, n_etypes=n_etypes)\nself.classify = nn.Linear(hidden_dim, 1)\nself.ndata_name = ndata_name\nself.edata_name = edata_name", "h = self.ggnn(g, g.ndata[self.ndata_name], g.edata[self.edata_name])\nh = F.r...
<|body_start_0|> super(BasicGGNN, self).__init__() self.ggnn = GatedGraphConv(in_feats=in_dim, out_feats=hidden_dim, n_steps=6, n_etypes=n_etypes) self.classify = nn.Linear(hidden_dim, 1) self.ndata_name = ndata_name self.edata_name = edata_name <|end_body_0|> <|body_start_1|> ...
Basic GGNN for graph classification.
BasicGGNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicGGNN: """Basic GGNN for graph classification.""" def __init__(self, in_dim, hidden_dim, n_etypes=13, ndata_name='_FEAT', edata_name='_TYPE'): """Initialise.""" <|body_0|> def forward(self, g): """Forward pass.""" <|body_1|> def get_graph_embeddi...
stack_v2_sparse_classes_75kplus_train_066786
12,862
no_license
[ { "docstring": "Initialise.", "name": "__init__", "signature": "def __init__(self, in_dim, hidden_dim, n_etypes=13, ndata_name='_FEAT', edata_name='_TYPE')" }, { "docstring": "Forward pass.", "name": "forward", "signature": "def forward(self, g)" }, { "docstring": "Get graph embe...
3
null
Implement the Python class `BasicGGNN` described below. Class description: Basic GGNN for graph classification. Method signatures and docstrings: - def __init__(self, in_dim, hidden_dim, n_etypes=13, ndata_name='_FEAT', edata_name='_TYPE'): Initialise. - def forward(self, g): Forward pass. - def get_graph_embeddings(...
Implement the Python class `BasicGGNN` described below. Class description: Basic GGNN for graph classification. Method signatures and docstrings: - def __init__(self, in_dim, hidden_dim, n_etypes=13, ndata_name='_FEAT', edata_name='_TYPE'): Initialise. - def forward(self, g): Forward pass. - def get_graph_embeddings(...
7e58db58d1de0c3f275fad53880f2a8f79cdd82c
<|skeleton|> class BasicGGNN: """Basic GGNN for graph classification.""" def __init__(self, in_dim, hidden_dim, n_etypes=13, ndata_name='_FEAT', edata_name='_TYPE'): """Initialise.""" <|body_0|> def forward(self, g): """Forward pass.""" <|body_1|> def get_graph_embeddi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicGGNN: """Basic GGNN for graph classification.""" def __init__(self, in_dim, hidden_dim, n_etypes=13, ndata_name='_FEAT', edata_name='_TYPE'): """Initialise.""" super(BasicGGNN, self).__init__() self.ggnn = GatedGraphConv(in_feats=in_dim, out_feats=hidden_dim, n_steps=6, n_ety...
the_stack_v2_python_sparse
gnnproject/helpers/dgl_helpers.py
davidhin/gnn-exploration
train
0
4ee84a23e7ee54e1be4700fbcd03f2203ea481c4
[ "image_data.image_data.__init__(self, self.variable)\nfor d in ['veg', 'litter']:\n v = {}\n matching = [s for s in albedoConfig.keys() if '{0}_'.format(d) in s]\n for m in matching:\n ms = m.split('_')\n v[ms[-1]] = albedoConfig[m]\n setattr(self, d, v)\nself.getConfig(albedoConfig)\nself...
<|body_start_0|> image_data.image_data.__init__(self, self.variable) for d in ['veg', 'litter']: v = {} matching = [s for s in albedoConfig.keys() if '{0}_'.format(d) in s] for m in matching: ms = m.split('_') v[ms[-1]] = albedoConfig[m...
The :mod:`~smrf.distribute.albedo.Albedo` class allows for variable specific distributions that go beyond the base class. The visible (280-700nm) and infrared (700-2800nm) albedo follows the relationships described in Marks et al. (1992) :cite:`Marks&al:1992`. The albedo is a function of the time since last storm, the ...
Albedo
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Albedo: """The :mod:`~smrf.distribute.albedo.Albedo` class allows for variable specific distributions that go beyond the base class. The visible (280-700nm) and infrared (700-2800nm) albedo follows the relationships described in Marks et al. (1992) :cite:`Marks&al:1992`. The albedo is a function ...
stack_v2_sparse_classes_75kplus_train_066787
6,169
permissive
[ { "docstring": "Initialize albedo() Args: albedoConfig: configuration from [albedo] section", "name": "__init__", "signature": "def __init__(self, albedoConfig)" }, { "docstring": "Initialize the distribution, calls image_data.image_data._initialize() Args: topo: smrf.data.loadTopo.Topo instance...
4
stack_v2_sparse_classes_30k_train_035405
Implement the Python class `Albedo` described below. Class description: The :mod:`~smrf.distribute.albedo.Albedo` class allows for variable specific distributions that go beyond the base class. The visible (280-700nm) and infrared (700-2800nm) albedo follows the relationships described in Marks et al. (1992) :cite:`Ma...
Implement the Python class `Albedo` described below. Class description: The :mod:`~smrf.distribute.albedo.Albedo` class allows for variable specific distributions that go beyond the base class. The visible (280-700nm) and infrared (700-2800nm) albedo follows the relationships described in Marks et al. (1992) :cite:`Ma...
465d42cca85820e76a50bc311d101c7dc506df8c
<|skeleton|> class Albedo: """The :mod:`~smrf.distribute.albedo.Albedo` class allows for variable specific distributions that go beyond the base class. The visible (280-700nm) and infrared (700-2800nm) albedo follows the relationships described in Marks et al. (1992) :cite:`Marks&al:1992`. The albedo is a function ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Albedo: """The :mod:`~smrf.distribute.albedo.Albedo` class allows for variable specific distributions that go beyond the base class. The visible (280-700nm) and infrared (700-2800nm) albedo follows the relationships described in Marks et al. (1992) :cite:`Marks&al:1992`. The albedo is a function of the time s...
the_stack_v2_python_sparse
smrf/distribute/albedo.py
USDA-ARS-NWRC/smrf
train
9
68a822e2ccc5a622ba9a38da9f849560ae454ee1
[ "super().__init__(container, name)\nself.iApartments = iApartments\nself.listApartments = list()\nif self.iApartments == 1:\n self.buildingType = 1\nelse:\n self.buildingType = 2\nfor x in range(0, iApartments):\n self.listApartments.append(Apartment(self.buildingType, sqm, specDemandTh, stepSize))", "_d...
<|body_start_0|> super().__init__(container, name) self.iApartments = iApartments self.listApartments = list() if self.iApartments == 1: self.buildingType = 1 else: self.buildingType = 2 for x in range(0, iApartments): self.listApartmen...
BuildingAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildingAgent: def __init__(self, container, name, iApartments, sqm, specDemandTh, stepSize): """Constructor of Building :param iApartments: number of apartments within the building :param sqm: square meter (sqm) of each apartment in the building [m^2] :param specDemandTh: specific therm...
stack_v2_sparse_classes_75kplus_train_066788
3,182
no_license
[ { "docstring": "Constructor of Building :param iApartments: number of apartments within the building :param sqm: square meter (sqm) of each apartment in the building [m^2] :param specDemandTh: specific thermal demand per sqm and year [kWh/(m^2 a)] :param stepSize: size of time slot in seconds", "name": "__i...
5
null
Implement the Python class `BuildingAgent` described below. Class description: Implement the BuildingAgent class. Method signatures and docstrings: - def __init__(self, container, name, iApartments, sqm, specDemandTh, stepSize): Constructor of Building :param iApartments: number of apartments within the building :par...
Implement the Python class `BuildingAgent` described below. Class description: Implement the BuildingAgent class. Method signatures and docstrings: - def __init__(self, container, name, iApartments, sqm, specDemandTh, stepSize): Constructor of Building :param iApartments: number of apartments within the building :par...
4eb511a7fea4117ef6dda9449c191e9058014280
<|skeleton|> class BuildingAgent: def __init__(self, container, name, iApartments, sqm, specDemandTh, stepSize): """Constructor of Building :param iApartments: number of apartments within the building :param sqm: square meter (sqm) of each apartment in the building [m^2] :param specDemandTh: specific therm...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BuildingAgent: def __init__(self, container, name, iApartments, sqm, specDemandTh, stepSize): """Constructor of Building :param iApartments: number of apartments within the building :param sqm: square meter (sqm) of each apartment in the building [m^2] :param specDemandTh: specific thermal demand per ...
the_stack_v2_python_sparse
building/buildingagent.py
cmolitor/pycity
train
1
afbf66a95c0e03a7cf7c62ee46ac455342b62150
[ "self.a = a.copy()\nself.ind = ind.copy()\nself.a_low = a_low\nself.ang_thr = ang_thr\nself.step_sz = step_sz\nself.length_thr = length_thr\nself.total_weight = total_weight\nself.max_points = max_points\nif len(self.a.shape) == 3:\n self.a.shape = self.a.shape + (1,)\n self.ind.shape = self.ind.shape + (1,)\...
<|body_start_0|> self.a = a.copy() self.ind = ind.copy() self.a_low = a_low self.ang_thr = ang_thr self.step_sz = step_sz self.length_thr = length_thr self.total_weight = total_weight self.max_points = max_points if len(self.a.shape) == 3: ...
Euler Delta Crossings Generates tracks with termination criteria defined by a delta function [1]_ and it has similarities with FACT algorithm [2]_ and Basser's method but uses trilinear interpolation. Can be used with any reconstruction method as DTI, DSI, QBI, GQI which can calculate an orientation distribution functi...
EuDX
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EuDX: """Euler Delta Crossings Generates tracks with termination criteria defined by a delta function [1]_ and it has similarities with FACT algorithm [2]_ and Basser's method but uses trilinear interpolation. Can be used with any reconstruction method as DTI, DSI, QBI, GQI which can calculate an...
stack_v2_sparse_classes_75kplus_train_066789
6,850
permissive
[ { "docstring": "Euler integration with multiple stopping criteria and supporting multiple multiple fibres in crossings [1]. [1] E. Garyfallidis (2012), \"Towards an accurate brain tractography\", PhD thesis, University of Cambridge, UK. Parameters ------------ a : array, shape(x,y,z,Np) magnitude of the peak of...
2
stack_v2_sparse_classes_30k_train_032440
Implement the Python class `EuDX` described below. Class description: Euler Delta Crossings Generates tracks with termination criteria defined by a delta function [1]_ and it has similarities with FACT algorithm [2]_ and Basser's method but uses trilinear interpolation. Can be used with any reconstruction method as DT...
Implement the Python class `EuDX` described below. Class description: Euler Delta Crossings Generates tracks with termination criteria defined by a delta function [1]_ and it has similarities with FACT algorithm [2]_ and Basser's method but uses trilinear interpolation. Can be used with any reconstruction method as DT...
4341b734995d6f51ac9c16df26a7de00c46f57ef
<|skeleton|> class EuDX: """Euler Delta Crossings Generates tracks with termination criteria defined by a delta function [1]_ and it has similarities with FACT algorithm [2]_ and Basser's method but uses trilinear interpolation. Can be used with any reconstruction method as DTI, DSI, QBI, GQI which can calculate an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EuDX: """Euler Delta Crossings Generates tracks with termination criteria defined by a delta function [1]_ and it has similarities with FACT algorithm [2]_ and Basser's method but uses trilinear interpolation. Can be used with any reconstruction method as DTI, DSI, QBI, GQI which can calculate an orientation ...
the_stack_v2_python_sparse
dipy/tracking/eudx.py
Garyfallidis/dipy
train
7
6e126cca71c7db9c1a6cdde5ed678adf1547c9ca
[ "assert opts.loss.split('_')[0] in SegLoss.LOSSES, 'Invalid loss'\nself.opts = opts\nif opts.loss.split('_')[0] in GANLoss._modes:\n n_C_D = int(opts.image_shape.split(',')[0]) + opts.n_labels\n net_D = mnets.make_discriminator(in_channels=n_C_D, disc_type=opts.disc_type, norm_name=opts.norm)\n net_D = mut...
<|body_start_0|> assert opts.loss.split('_')[0] in SegLoss.LOSSES, 'Invalid loss' self.opts = opts if opts.loss.split('_')[0] in GANLoss._modes: n_C_D = int(opts.image_shape.split(',')[0]) + opts.n_labels net_D = mnets.make_discriminator(in_channels=n_C_D, disc_type=opts....
SegLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegLoss: def __init__(self, opts): """__init__ SegLoss is a class for computing segmentation loss Loss can be one of normal crossentropy or an adversarial type of loss Adversarial loss makes use of a neural network for parametrization :param opts: opts must have the following fields: -lo...
stack_v2_sparse_classes_75kplus_train_066790
10,804
permissive
[ { "docstring": "__init__ SegLoss is a class for computing segmentation loss Loss can be one of normal crossentropy or an adversarial type of loss Adversarial loss makes use of a neural network for parametrization :param opts: opts must have the following fields: -loss (type of loss to use) -disc_type -norm -ima...
3
null
Implement the Python class `SegLoss` described below. Class description: Implement the SegLoss class. Method signatures and docstrings: - def __init__(self, opts): __init__ SegLoss is a class for computing segmentation loss Loss can be one of normal crossentropy or an adversarial type of loss Adversarial loss makes u...
Implement the Python class `SegLoss` described below. Class description: Implement the SegLoss class. Method signatures and docstrings: - def __init__(self, opts): __init__ SegLoss is a class for computing segmentation loss Loss can be one of normal crossentropy or an adversarial type of loss Adversarial loss makes u...
78f354da5d724b93ead3ac6c2b15ae18d3ac0aea
<|skeleton|> class SegLoss: def __init__(self, opts): """__init__ SegLoss is a class for computing segmentation loss Loss can be one of normal crossentropy or an adversarial type of loss Adversarial loss makes use of a neural network for parametrization :param opts: opts must have the following fields: -lo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SegLoss: def __init__(self, opts): """__init__ SegLoss is a class for computing segmentation loss Loss can be one of normal crossentropy or an adversarial type of loss Adversarial loss makes use of a neural network for parametrization :param opts: opts must have the following fields: -loss (type of lo...
the_stack_v2_python_sparse
models/losses.py
sunycl/GanSeg
train
0
1a80e8ec9e0d3266b7d3c8692cb76f44dab8e2bc
[ "if not isinstance(data, BaseData):\n raise TypeError('input data must data.BaseData class')\nself.n_otypes = data.n_otypes\nself.n_objects = data.n_objects\nself.eid = data.eid\nself.iid = data.iid", "try:\n return self.eid[otype][iid]\nexcept IndexError:\n raise ValueError('Illegal internal id')", "t...
<|body_start_0|> if not isinstance(data, BaseData): raise TypeError('input data must data.BaseData class') self.n_otypes = data.n_otypes self.n_objects = data.n_objects self.eid = data.eid self.iid = data.iid <|end_body_0|> <|body_start_1|> try: r...
Methods that are commonly used in data containers and recommenders for handling object.
ObjectUtilMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectUtilMixin: """Methods that are commonly used in data containers and recommenders for handling object.""" def _set_object_info(self, data): """import object meta information of input data to recommenders Parameters ---------- data : :class:`kamrecsys.data.BaseData` input data Ra...
stack_v2_sparse_classes_75kplus_train_066791
8,050
permissive
[ { "docstring": "import object meta information of input data to recommenders Parameters ---------- data : :class:`kamrecsys.data.BaseData` input data Raises ------ TypeError if input data is not :class:`kamrecsys.data.BaseData` class", "name": "_set_object_info", "signature": "def _set_object_info(self,...
5
null
Implement the Python class `ObjectUtilMixin` described below. Class description: Methods that are commonly used in data containers and recommenders for handling object. Method signatures and docstrings: - def _set_object_info(self, data): import object meta information of input data to recommenders Parameters -------...
Implement the Python class `ObjectUtilMixin` described below. Class description: Methods that are commonly used in data containers and recommenders for handling object. Method signatures and docstrings: - def _set_object_info(self, data): import object meta information of input data to recommenders Parameters -------...
62305312f7aaaa8c2985785983c1d2bf68b243c0
<|skeleton|> class ObjectUtilMixin: """Methods that are commonly used in data containers and recommenders for handling object.""" def _set_object_info(self, data): """import object meta information of input data to recommenders Parameters ---------- data : :class:`kamrecsys.data.BaseData` input data Ra...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjectUtilMixin: """Methods that are commonly used in data containers and recommenders for handling object.""" def _set_object_info(self, data): """import object meta information of input data to recommenders Parameters ---------- data : :class:`kamrecsys.data.BaseData` input data Raises ------ T...
the_stack_v2_python_sparse
kamrecsys/data/base.py
RongCao18/kamrecsys
train
0
a97480f48af2570d5493b8d4d1c326c527ac0857
[ "self.username = username\nself.password = password\nself.chrome_option = Options()\nself.chrome_option.add_argument('--headless')\nself.browser = webdriver.Chrome()", "self.browser.get('https://www.fifedu.com')\nbutton1 = self.browser.find_element_by_class_name('login')\nbutton1.click()\ninputs = self.browser.fi...
<|body_start_0|> self.username = username self.password = password self.chrome_option = Options() self.chrome_option.add_argument('--headless') self.browser = webdriver.Chrome() <|end_body_0|> <|body_start_1|> self.browser.get('https://www.fifedu.com') button1 = ...
Login
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: def __init__(self, username, password): """1.初始化用户名密码 :param username: :param password:""" <|body_0|> def login(self): """请求登陆界面 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.username = username self.password = passwor...
stack_v2_sparse_classes_75kplus_train_066792
1,387
permissive
[ { "docstring": "1.初始化用户名密码 :param username: :param password:", "name": "__init__", "signature": "def __init__(self, username, password)" }, { "docstring": "请求登陆界面 :return:", "name": "login", "signature": "def login(self)" } ]
2
stack_v2_sparse_classes_30k_val_002072
Implement the Python class `Login` described below. Class description: Implement the Login class. Method signatures and docstrings: - def __init__(self, username, password): 1.初始化用户名密码 :param username: :param password: - def login(self): 请求登陆界面 :return:
Implement the Python class `Login` described below. Class description: Implement the Login class. Method signatures and docstrings: - def __init__(self, username, password): 1.初始化用户名密码 :param username: :param password: - def login(self): 请求登陆界面 :return: <|skeleton|> class Login: def __init__(self, username, pas...
1a3149f60700e010b1d3defcf3a1ee8f3b34ae0f
<|skeleton|> class Login: def __init__(self, username, password): """1.初始化用户名密码 :param username: :param password:""" <|body_0|> def login(self): """请求登陆界面 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Login: def __init__(self, username, password): """1.初始化用户名密码 :param username: :param password:""" self.username = username self.password = password self.chrome_option = Options() self.chrome_option.add_argument('--headless') self.browser = webdriver.Chrome() ...
the_stack_v2_python_sparse
Fifedu_spider/Login.py
SunRelease/Spider_crawler
train
5
c819a67abf5b5754b04a9622184f188e4c3fef3d
[ "self = cls()\nself.lineno = dct['lineno']\nreturn self", "node = self\nwhile node.parent:\n node = node.parent\nreturn node" ]
<|body_start_0|> self = cls() self.lineno = dct['lineno'] return self <|end_body_0|> <|body_start_1|> node = self while node.parent: node = node.parent return node <|end_body_1|>
The base class for Enaml construct nodes. A construct node is an abstract representation of the tree described by an 'enamldef' block. Unlike the AST generated by the parser, this tree will contain resolved class objects and the other information needed to create an instance of the 'enamldef'.
ConstructNode
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstructNode: """The base class for Enaml construct nodes. A construct node is an abstract representation of the tree described by an 'enamldef' block. Unlike the AST generated by the parser, this tree will contain resolved class objects and the other information needed to create an instance of ...
stack_v2_sparse_classes_75kplus_train_066793
7,589
permissive
[ { "docstring": "Create an instance of the node from a dict. Subclasses should reimplement this classmethod. Parameters ---------- dct : dict The serializable dictionary created by the Enaml compiler which represents the construction tree. Returns ------- result : ConstructNode The construct node for the given d...
2
stack_v2_sparse_classes_30k_train_041465
Implement the Python class `ConstructNode` described below. Class description: The base class for Enaml construct nodes. A construct node is an abstract representation of the tree described by an 'enamldef' block. Unlike the AST generated by the parser, this tree will contain resolved class objects and the other infor...
Implement the Python class `ConstructNode` described below. Class description: The base class for Enaml construct nodes. A construct node is an abstract representation of the tree described by an 'enamldef' block. Unlike the AST generated by the parser, this tree will contain resolved class objects and the other infor...
15c20b035a73187e8e66fa20a43c3a4372d008bd
<|skeleton|> class ConstructNode: """The base class for Enaml construct nodes. A construct node is an abstract representation of the tree described by an 'enamldef' block. Unlike the AST generated by the parser, this tree will contain resolved class objects and the other information needed to create an instance of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConstructNode: """The base class for Enaml construct nodes. A construct node is an abstract representation of the tree described by an 'enamldef' block. Unlike the AST generated by the parser, this tree will contain resolved class objects and the other information needed to create an instance of the 'enamldef...
the_stack_v2_python_sparse
enaml/core/construct_nodes.py
ContinuumIO/enaml
train
2
b7e248ec616e33fc143d9315808a1e803ceea4b1
[ "with Database() as db:\n if id_person_requiring_assistance_type is None and is_active is None:\n data = db.query(Table).all()\n elif id_person_requiring_assistance_type is None:\n data = db.query(Table).filter(Table.is_active == is_active).all()\n else:\n data = db.query(Table).get(id...
<|body_start_0|> with Database() as db: if id_person_requiring_assistance_type is None and is_active is None: data = db.query(Table).all() elif id_person_requiring_assistance_type is None: data = db.query(Table).filter(Table.is_active == is_active).all() ...
PersonRequiringAssistanceType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonRequiringAssistanceType: def get(self, id_person_requiring_assistance_type=None, is_active=None): """Return all person requiring assistance type information :param person_requiring_assistance_type: UUID :param is_active: BOOLEAN""" <|body_0|> def create(self, body): ...
stack_v2_sparse_classes_75kplus_train_066794
2,925
no_license
[ { "docstring": "Return all person requiring assistance type information :param person_requiring_assistance_type: UUID :param is_active: BOOLEAN", "name": "get", "signature": "def get(self, id_person_requiring_assistance_type=None, is_active=None)" }, { "docstring": "Create a new person requiring...
4
stack_v2_sparse_classes_30k_train_020118
Implement the Python class `PersonRequiringAssistanceType` described below. Class description: Implement the PersonRequiringAssistanceType class. Method signatures and docstrings: - def get(self, id_person_requiring_assistance_type=None, is_active=None): Return all person requiring assistance type information :param ...
Implement the Python class `PersonRequiringAssistanceType` described below. Class description: Implement the PersonRequiringAssistanceType class. Method signatures and docstrings: - def get(self, id_person_requiring_assistance_type=None, is_active=None): Return all person requiring assistance type information :param ...
43bd57c466a5cd3b133ddc437cb4a6b9f007d267
<|skeleton|> class PersonRequiringAssistanceType: def get(self, id_person_requiring_assistance_type=None, is_active=None): """Return all person requiring assistance type information :param person_requiring_assistance_type: UUID :param is_active: BOOLEAN""" <|body_0|> def create(self, body): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PersonRequiringAssistanceType: def get(self, id_person_requiring_assistance_type=None, is_active=None): """Return all person requiring assistance type information :param person_requiring_assistance_type: UUID :param is_active: BOOLEAN""" with Database() as db: if id_person_requirin...
the_stack_v2_python_sparse
resturls/personrequiringassistancetype.py
CAUCA-9-1-1/survip-api
train
1
6c39d9b60c8e7de1102537ad8583eb9fa9ed5eed
[ "assert util.is_not_empty(stream_name), 'Kinesis Firehose StreamName cannot be empty.'\nassert record is not None, 'Record cannot be empty.'\nf_client = self.get_or_create_client()\nreturn f_client.put_record(DeliveryStreamName=stream_name, Record={'Data': record})", "assert util.is_not_empty(stream_name), 'Kines...
<|body_start_0|> assert util.is_not_empty(stream_name), 'Kinesis Firehose StreamName cannot be empty.' assert record is not None, 'Record cannot be empty.' f_client = self.get_or_create_client() return f_client.put_record(DeliveryStreamName=stream_name, Record={'Data': record}) <|end_bod...
Firehose
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Firehose: def write_record(self, stream_name=None, record=None): """:param stream_name: firehose stream name to publish to. :param record: , data in bytes to be published to firehose :return: firehose response""" <|body_0|> def write_batch(self, stream_name=None, batch=None)...
stack_v2_sparse_classes_75kplus_train_066795
1,497
no_license
[ { "docstring": ":param stream_name: firehose stream name to publish to. :param record: , data in bytes to be published to firehose :return: firehose response", "name": "write_record", "signature": "def write_record(self, stream_name=None, record=None)" }, { "docstring": ":param stream_name: fire...
2
stack_v2_sparse_classes_30k_val_000245
Implement the Python class `Firehose` described below. Class description: Implement the Firehose class. Method signatures and docstrings: - def write_record(self, stream_name=None, record=None): :param stream_name: firehose stream name to publish to. :param record: , data in bytes to be published to firehose :return:...
Implement the Python class `Firehose` described below. Class description: Implement the Firehose class. Method signatures and docstrings: - def write_record(self, stream_name=None, record=None): :param stream_name: firehose stream name to publish to. :param record: , data in bytes to be published to firehose :return:...
f8d685b99347990e5625325cad5acecc7728bd2a
<|skeleton|> class Firehose: def write_record(self, stream_name=None, record=None): """:param stream_name: firehose stream name to publish to. :param record: , data in bytes to be published to firehose :return: firehose response""" <|body_0|> def write_batch(self, stream_name=None, batch=None)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Firehose: def write_record(self, stream_name=None, record=None): """:param stream_name: firehose stream name to publish to. :param record: , data in bytes to be published to firehose :return: firehose response""" assert util.is_not_empty(stream_name), 'Kinesis Firehose StreamName cannot be emp...
the_stack_v2_python_sparse
common_utils/utils/firehose_util.py
prayushtatke/python
train
0
39ebd4644f5c4205c35b16a51c45215f199406e0
[ "td_queryset = self.filter_queryset(self.get_queryset())\nweapon = td_queryset.values('weaponType').annotate(count=Count('weaponType')).values('weaponType', 'weaponType__weaponTypeName', 'count').order_by('-count')\nweapon = weapon.annotate(weaponTypeName=F('weaponType__weaponTypeName')).values('weaponType', 'weapo...
<|body_start_0|> td_queryset = self.filter_queryset(self.get_queryset()) weapon = td_queryset.values('weaponType').annotate(count=Count('weaponType')).values('weaponType', 'weaponType__weaponTypeName', 'count').order_by('-count') weapon = weapon.annotate(weaponTypeName=F('weaponType__weaponTypeN...
list: 返回按关键词(keyword)、国家(country)、地区(region)、时间段(start&end)、多边形(poly)筛选得到的袭击详细数据 retrieve: 返回某一id对应的袭击详细数据
TDInfoViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TDInfoViewSet: """list: 返回按关键词(keyword)、国家(country)、地区(region)、时间段(start&end)、多边形(poly)筛选得到的袭击详细数据 retrieve: 返回某一id对应的袭击详细数据""" def statistics(self, request): """返回按过滤字段筛选后的统计数据""" <|body_0|> def trend(self, request): """返回国家/地区的年袭击数、死伤人数、经济损失趋势""" <|body...
stack_v2_sparse_classes_75kplus_train_066796
9,605
no_license
[ { "docstring": "返回按过滤字段筛选后的统计数据", "name": "statistics", "signature": "def statistics(self, request)" }, { "docstring": "返回国家/地区的年袭击数、死伤人数、经济损失趋势", "name": "trend", "signature": "def trend(self, request)" }, { "docstring": "返回全球各地区某时段袭击次数、死亡人数、经济损失", "name": "globalStatistics"...
4
stack_v2_sparse_classes_30k_train_021501
Implement the Python class `TDInfoViewSet` described below. Class description: list: 返回按关键词(keyword)、国家(country)、地区(region)、时间段(start&end)、多边形(poly)筛选得到的袭击详细数据 retrieve: 返回某一id对应的袭击详细数据 Method signatures and docstrings: - def statistics(self, request): 返回按过滤字段筛选后的统计数据 - def trend(self, request): 返回国家/地区的年袭击数、死伤人数、经济损...
Implement the Python class `TDInfoViewSet` described below. Class description: list: 返回按关键词(keyword)、国家(country)、地区(region)、时间段(start&end)、多边形(poly)筛选得到的袭击详细数据 retrieve: 返回某一id对应的袭击详细数据 Method signatures and docstrings: - def statistics(self, request): 返回按过滤字段筛选后的统计数据 - def trend(self, request): 返回国家/地区的年袭击数、死伤人数、经济损...
5f93a342dfa8f782cb7f6d3a0d6b8c011faa2575
<|skeleton|> class TDInfoViewSet: """list: 返回按关键词(keyword)、国家(country)、地区(region)、时间段(start&end)、多边形(poly)筛选得到的袭击详细数据 retrieve: 返回某一id对应的袭击详细数据""" def statistics(self, request): """返回按过滤字段筛选后的统计数据""" <|body_0|> def trend(self, request): """返回国家/地区的年袭击数、死伤人数、经济损失趋势""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TDInfoViewSet: """list: 返回按关键词(keyword)、国家(country)、地区(region)、时间段(start&end)、多边形(poly)筛选得到的袭击详细数据 retrieve: 返回某一id对应的袭击详细数据""" def statistics(self, request): """返回按过滤字段筛选后的统计数据""" td_queryset = self.filter_queryset(self.get_queryset()) weapon = td_queryset.values('weaponType').an...
the_stack_v2_python_sparse
rear_end_services/views.py
LaZzyMan/terrorsim_rear_end
train
2
e87a8683d4300f34018575e8d42abaf0fb780b5c
[ "self._graph = graph\nself.opset = util.default(opset, 11)\nself.optimize = util.default(optimize, True)", "(graph, output_names), _ = util.invoke_if_callable(self._graph)\ninput_names = list(tf_util.get_input_metadata(graph).keys())\ngraphdef = graph.as_graph_def()\nif self.optimize:\n graphdef = tf2onnx.tfon...
<|body_start_0|> self._graph = graph self.opset = util.default(opset, 11) self.optimize = util.default(optimize, True) <|end_body_0|> <|body_start_1|> (graph, output_names), _ = util.invoke_if_callable(self._graph) input_names = list(tf_util.get_input_metadata(graph).keys()) ...
Functor that loads a TensorFlow graph and converts it to ONNX using the tf2onnx converter.
OnnxFromTfGraph
[ "Apache-2.0", "BSD-3-Clause", "MIT", "ISC", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnnxFromTfGraph: """Functor that loads a TensorFlow graph and converts it to ONNX using the tf2onnx converter.""" def __init__(self, graph, opset=None, optimize=None): """Converts a TensorFlow model into ONNX. Args: graph (Union[Tuple[tf.Graph, Sequence[str]], Callable() -> Tuple[tf....
stack_v2_sparse_classes_75kplus_train_066797
37,448
permissive
[ { "docstring": "Converts a TensorFlow model into ONNX. Args: graph (Union[Tuple[tf.Graph, Sequence[str]], Callable() -> Tuple[tf.Graph, Sequence[str]]]): A tuple containing a TensorFlow graph and output names or a callable that returns one. opset (int): The ONNX opset to use during conversion. optimize (bool): ...
2
stack_v2_sparse_classes_30k_train_048777
Implement the Python class `OnnxFromTfGraph` described below. Class description: Functor that loads a TensorFlow graph and converts it to ONNX using the tf2onnx converter. Method signatures and docstrings: - def __init__(self, graph, opset=None, optimize=None): Converts a TensorFlow model into ONNX. Args: graph (Unio...
Implement the Python class `OnnxFromTfGraph` described below. Class description: Functor that loads a TensorFlow graph and converts it to ONNX using the tf2onnx converter. Method signatures and docstrings: - def __init__(self, graph, opset=None, optimize=None): Converts a TensorFlow model into ONNX. Args: graph (Unio...
a167852705d74bcc619d8fad0af4b9e4d84472fc
<|skeleton|> class OnnxFromTfGraph: """Functor that loads a TensorFlow graph and converts it to ONNX using the tf2onnx converter.""" def __init__(self, graph, opset=None, optimize=None): """Converts a TensorFlow model into ONNX. Args: graph (Union[Tuple[tf.Graph, Sequence[str]], Callable() -> Tuple[tf....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OnnxFromTfGraph: """Functor that loads a TensorFlow graph and converts it to ONNX using the tf2onnx converter.""" def __init__(self, graph, opset=None, optimize=None): """Converts a TensorFlow model into ONNX. Args: graph (Union[Tuple[tf.Graph, Sequence[str]], Callable() -> Tuple[tf.Graph, Sequen...
the_stack_v2_python_sparse
tools/Polygraphy/polygraphy/backend/onnx/loader.py
NVIDIA/TensorRT
train
8,026
3c3d058dde413e10020e3ddab0d7640be724fc8e
[ "driver = self.driver\ntry:\n driver.find_element(*self.registerlink).click()\n driver.implicitly_wait(3)\n Select(driver.find_element(*self.province)).select_by_visible_text(province)\n Select(driver.find_element(*self.city)).select_by_visible_text(city)\n driver.find_element(*self.nickname).clear()...
<|body_start_0|> driver = self.driver try: driver.find_element(*self.registerlink).click() driver.implicitly_wait(3) Select(driver.find_element(*self.province)).select_by_visible_text(province) Select(driver.find_element(*self.city)).select_by_visible_text...
该类包含与注册相关的所有操作 1、submit_information:注册信息填写页面 2、regist:注册提交页面
Regist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regist: """该类包含与注册相关的所有操作 1、submit_information:注册信息填写页面 2、regist:注册提交页面""" def submit_information(self, province=u'河南省', city=u'郑州市', nickname='random', password='888888', confirmpassword='888888', **kwargs): """@该方法作用于注册信息提交页面 @所传字典参数必须包含如下KEY KEY:area 省份(键值为汉字,不能输入错误) KEY:city 地级市(...
stack_v2_sparse_classes_75kplus_train_066798
4,543
no_license
[ { "docstring": "@该方法作用于注册信息提交页面 @所传字典参数必须包含如下KEY KEY:area 省份(键值为汉字,不能输入错误) KEY:city 地级市(键值为汉字,不能输入错误) KEY:nickname 昵称 KEY:password 密码 KEY:confirmpassword 密码确认 @返回数据 返回如下字典格式数据 {'result':True|False ,'msg':msg,['errorimg':imgpath]}", "name": "submit_information", "signature": "def submit_information(self,...
2
stack_v2_sparse_classes_30k_train_025248
Implement the Python class `Regist` described below. Class description: 该类包含与注册相关的所有操作 1、submit_information:注册信息填写页面 2、regist:注册提交页面 Method signatures and docstrings: - def submit_information(self, province=u'河南省', city=u'郑州市', nickname='random', password='888888', confirmpassword='888888', **kwargs): @该方法作用于注册信息提交页面...
Implement the Python class `Regist` described below. Class description: 该类包含与注册相关的所有操作 1、submit_information:注册信息填写页面 2、regist:注册提交页面 Method signatures and docstrings: - def submit_information(self, province=u'河南省', city=u'郑州市', nickname='random', password='888888', confirmpassword='888888', **kwargs): @该方法作用于注册信息提交页面...
b8acaceddae3491066b1d864ab734a213e8aa1d1
<|skeleton|> class Regist: """该类包含与注册相关的所有操作 1、submit_information:注册信息填写页面 2、regist:注册提交页面""" def submit_information(self, province=u'河南省', city=u'郑州市', nickname='random', password='888888', confirmpassword='888888', **kwargs): """@该方法作用于注册信息提交页面 @所传字典参数必须包含如下KEY KEY:area 省份(键值为汉字,不能输入错误) KEY:city 地级市(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Regist: """该类包含与注册相关的所有操作 1、submit_information:注册信息填写页面 2、regist:注册提交页面""" def submit_information(self, province=u'河南省', city=u'郑州市', nickname='random', password='888888', confirmpassword='888888', **kwargs): """@该方法作用于注册信息提交页面 @所传字典参数必须包含如下KEY KEY:area 省份(键值为汉字,不能输入错误) KEY:city 地级市(键值为汉字,不能输入错误)...
the_stack_v2_python_sparse
veeker/action/action_regist.py
sunyanhui/autotest
train
1
2bac8b83d1e7cb13e7bef6f87b3886f1bd115839
[ "self.dic = dic\nif line_adapter is None:\n line_adapter = IdentityAdapter()\nself.verbose = verbose\nself.breakpoints = brs = []\nfor _, cb in getmembers(self, predicate=is_breakpoint_cb):\n if verbose:\n print('Mapping breakpoint %s.%s' % (type(self).__name__, cb.__name__))\n try:\n mi = No...
<|body_start_0|> self.dic = dic if line_adapter is None: line_adapter = IdentityAdapter() self.verbose = verbose self.breakpoints = brs = [] for _, cb in getmembers(self, predicate=is_breakpoint_cb): if verbose: print('Mapping breakpoint %s...
Automates breakpoint setting with handlers. A breakpoint handler is a method with name with prefix "on_" (see `is_breakpoint_cb`) and a position specifier in the doc string. A position specifier is a tuple of file name and line number. It should be given in next format (see `re_breakpoint_pos`): file/name/suffix.c:1234...
Watcher
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Watcher: """Automates breakpoint setting with handlers. A breakpoint handler is a method with name with prefix "on_" (see `is_breakpoint_cb`) and a position specifier in the doc string. A position specifier is a tuple of file name and line number. It should be given in next format (see `re_breakp...
stack_v2_sparse_classes_75kplus_train_066799
4,639
permissive
[ { "docstring": ":type dic: DWARFInfoCache :param line_adapter: is object that specifically converts the line number of a file for some breakpoint position", "name": "__init__", "signature": "def __init__(self, dic, line_adapter=None, verbose=False)" }, { "docstring": "Setup breakpoint handlers :...
3
stack_v2_sparse_classes_30k_train_035310
Implement the Python class `Watcher` described below. Class description: Automates breakpoint setting with handlers. A breakpoint handler is a method with name with prefix "on_" (see `is_breakpoint_cb`) and a position specifier in the doc string. A position specifier is a tuple of file name and line number. It should ...
Implement the Python class `Watcher` described below. Class description: Automates breakpoint setting with handlers. A breakpoint handler is a method with name with prefix "on_" (see `is_breakpoint_cb`) and a position specifier in the doc string. A position specifier is a tuple of file name and line number. It should ...
93e03c2b3f880f5c7c9f90e1ba5593dbf602bdb9
<|skeleton|> class Watcher: """Automates breakpoint setting with handlers. A breakpoint handler is a method with name with prefix "on_" (see `is_breakpoint_cb`) and a position specifier in the doc string. A position specifier is a tuple of file name and line number. It should be given in next format (see `re_breakp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Watcher: """Automates breakpoint setting with handlers. A breakpoint handler is a method with name with prefix "on_" (see `is_breakpoint_cb`) and a position specifier in the doc string. A position specifier is a tuple of file name and line number. It should be given in next format (see `re_breakpoint_pos`): f...
the_stack_v2_python_sparse
debug/watcher.py
ispras/qdt
train
38