blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
a1dc0b4495f5c42e902b569b99aa5c776bcb9290
[ "self = cls()\nfor value in values:\n self.add(value)\nreturn self", "path = value if isinstance(value, Path) else Path(str(value))\nsubtree = self\nfor part in path.parts:\n try:\n subtree = subtree[part]\n except KeyError:\n return default\nreturn subtree", "path = value if isinstance(v...
<|body_start_0|> self = cls() for value in values: self.add(value) return self <|end_body_0|> <|body_start_1|> path = value if isinstance(value, Path) else Path(str(value)) subtree = self for part in path.parts: try: subtree = subt...
Create a safe directory tree from paths. Example usage: >>> directory = DirectoryTree() >>> directory.add('a/b/c') >>> directory.add('a/b/c/d') >>> directory.add('x/y/z') >>> directory.add('x/y/zz') >>> print('\\n'.join(sorted(directory))) a/b/c/d x/y/z x/y/zz >>> print('\\n'.join(sorted(directory.get('x/y')))) z zz
DirectoryTree
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectoryTree: """Create a safe directory tree from paths. Example usage: >>> directory = DirectoryTree() >>> directory.add('a/b/c') >>> directory.add('a/b/c/d') >>> directory.add('x/y/z') >>> directory.add('x/y/zz') >>> print('\\n'.join(sorted(directory))) a/b/c/d x/y/z x/y/zz >>> print('\\n'.jo...
stack_v2_sparse_classes_36k_train_008900
2,754
permissive
[ { "docstring": "Construct a tree from a list with paths.", "name": "from_list", "signature": "def from_list(cls, values)" }, { "docstring": "Return a subtree if exists.", "name": "get", "signature": "def get(self, value, default=None)" }, { "docstring": "Create a safe directory f...
4
null
Implement the Python class `DirectoryTree` described below. Class description: Create a safe directory tree from paths. Example usage: >>> directory = DirectoryTree() >>> directory.add('a/b/c') >>> directory.add('a/b/c/d') >>> directory.add('x/y/z') >>> directory.add('x/y/zz') >>> print('\\n'.join(sorted(directory))) ...
Implement the Python class `DirectoryTree` described below. Class description: Create a safe directory tree from paths. Example usage: >>> directory = DirectoryTree() >>> directory.add('a/b/c') >>> directory.add('a/b/c/d') >>> directory.add('x/y/z') >>> directory.add('x/y/zz') >>> print('\\n'.join(sorted(directory))) ...
e0ff587f507d049eeeb873e8488ba8bb10ac1a15
<|skeleton|> class DirectoryTree: """Create a safe directory tree from paths. Example usage: >>> directory = DirectoryTree() >>> directory.add('a/b/c') >>> directory.add('a/b/c/d') >>> directory.add('x/y/z') >>> directory.add('x/y/zz') >>> print('\\n'.join(sorted(directory))) a/b/c/d x/y/z x/y/zz >>> print('\\n'.jo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirectoryTree: """Create a safe directory tree from paths. Example usage: >>> directory = DirectoryTree() >>> directory.add('a/b/c') >>> directory.add('a/b/c/d') >>> directory.add('x/y/z') >>> directory.add('x/y/zz') >>> print('\\n'.join(sorted(directory))) a/b/c/d x/y/z x/y/zz >>> print('\\n'.join(sorted(dir...
the_stack_v2_python_sparse
renku/domain_model/datastructures.py
SwissDataScienceCenter/renku-python
train
30
709b7a281bac1f3d1f7541e5bddaa9a7e7cf4786
[ "super(FourierFineCoattention, self).__init__()\nwith self.init_scope():\n self.energy_layer = links.Bilinear(hidden_dim, hidden_dim, 1)\n self.attention_layer_1 = GraphLinear(head, 1, nobias=True)\n self.attention_layer_2 = GraphLinear(head, 1, nobias=True)\n self.lt_layer_1 = GraphLinear(hidden_dim, h...
<|body_start_0|> super(FourierFineCoattention, self).__init__() with self.init_scope(): self.energy_layer = links.Bilinear(hidden_dim, hidden_dim, 1) self.attention_layer_1 = GraphLinear(head, 1, nobias=True) self.attention_layer_2 = GraphLinear(head, 1, nobias=True) ...
TODO
FourierFineCoattention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FourierFineCoattention: """TODO""" def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism""" ...
stack_v2_sparse_classes_36k_train_008901
25,561
permissive
[ { "docstring": ":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism", "name": "__init__", "signature": "def __init__(self, hidden_dim, out_dim, head, activation=functions.identity)" }, { "do...
4
stack_v2_sparse_classes_30k_train_011129
Implement the Python class `FourierFineCoattention` described below. Class description: TODO Method signatures and docstrings: - def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): :param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :para...
Implement the Python class `FourierFineCoattention` described below. Class description: TODO Method signatures and docstrings: - def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): :param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :para...
21b64a3c8cc9bc33718ae09c65aa917e575132eb
<|skeleton|> class FourierFineCoattention: """TODO""" def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FourierFineCoattention: """TODO""" def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism""" super(Fourie...
the_stack_v2_python_sparse
models/coattention/nie_coattention.py
Minys233/GCN-BMP
train
1
f0bdc18bbdc65c9e968d24215b8e50bef2352cc7
[ "super(Conv2dSubsampling1, self).__init__()\nself.conv = torch.nn.Sequential(torch.nn.Conv2d(1, odim, 3, 1), torch.nn.ReLU(), torch.nn.Conv2d(odim, odim, 3, 1), torch.nn.ReLU())\nself.out = torch.nn.Sequential(torch.nn.Linear(odim * (idim - 4), odim), pos_enc if pos_enc is not None else PositionalEncoding(odim, dro...
<|body_start_0|> super(Conv2dSubsampling1, self).__init__() self.conv = torch.nn.Sequential(torch.nn.Conv2d(1, odim, 3, 1), torch.nn.ReLU(), torch.nn.Conv2d(odim, odim, 3, 1), torch.nn.ReLU()) self.out = torch.nn.Sequential(torch.nn.Linear(odim * (idim - 4), odim), pos_enc if pos_enc is not None...
Similar to Conv2dSubsampling module, but without any subsampling performed. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Conv2dSubsampling1
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling1: """Similar to Conv2dSubsampling module, but without any subsampling performed. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim,...
stack_v2_sparse_classes_36k_train_008902
14,351
permissive
[ { "docstring": "Construct an Conv2dSubsampling1 object.", "name": "__init__", "signature": "def __init__(self, idim, odim, dropout_rate, pos_enc=None)" }, { "docstring": "Pass x through 2 Conv2d layers without subsampling. Args: x (torch.Tensor): Input tensor (#batch, time, idim). x_mask (torch....
3
null
Implement the Python class `Conv2dSubsampling1` described below. Class description: Similar to Conv2dSubsampling module, but without any subsampling performed. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer....
Implement the Python class `Conv2dSubsampling1` described below. Class description: Similar to Conv2dSubsampling module, but without any subsampling performed. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer....
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class Conv2dSubsampling1: """Similar to Conv2dSubsampling module, but without any subsampling performed. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling1: """Similar to Conv2dSubsampling module, but without any subsampling performed. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/transformer/subsampling.py
espnet/espnet
train
7,242
c450d5fab34c11f348247928e4c22920bcaf43cf
[ "rows = len(matrix)\ncols = len(matrix[0])\nlens = [[-1] * cols for _ in range(rows)]\nmax_path = 0\nfor row in range(rows):\n for col in range(cols):\n max_path = max(max_path, self.longest_increasing_path_core(matrix, rows, cols, row, col, lens))\nreturn max_path + 1", "if lens[row][col] != -1:\n r...
<|body_start_0|> rows = len(matrix) cols = len(matrix[0]) lens = [[-1] * cols for _ in range(rows)] max_path = 0 for row in range(rows): for col in range(cols): max_path = max(max_path, self.longest_increasing_path_core(matrix, rows, cols, row, col, le...
给定一个整数矩阵,找到增加最长路径的长度。
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个整数矩阵,找到增加最长路径的长度。""" def longest_increasing_path(self, matrix): """对矩阵中的每一个坐标计算最远距离 :param matrix: 整数矩阵 :return: 最长路径的长度""" <|body_0|> def longest_increasing_path_core(self, matrix, rows, cols, row, col, lens): """寻找四个方向上的最大路径 :param matrix: 整数矩阵...
stack_v2_sparse_classes_36k_train_008903
3,070
no_license
[ { "docstring": "对矩阵中的每一个坐标计算最远距离 :param matrix: 整数矩阵 :return: 最长路径的长度", "name": "longest_increasing_path", "signature": "def longest_increasing_path(self, matrix)" }, { "docstring": "寻找四个方向上的最大路径 :param matrix: 整数矩阵 :param rows: 行数 :param cols: 列数 :param row: 当前行 :param col: 当前列 :param lens: 动态规...
2
null
Implement the Python class `Solution` described below. Class description: 给定一个整数矩阵,找到增加最长路径的长度。 Method signatures and docstrings: - def longest_increasing_path(self, matrix): 对矩阵中的每一个坐标计算最远距离 :param matrix: 整数矩阵 :return: 最长路径的长度 - def longest_increasing_path_core(self, matrix, rows, cols, row, col, lens): 寻找四个方向上的最大路...
Implement the Python class `Solution` described below. Class description: 给定一个整数矩阵,找到增加最长路径的长度。 Method signatures and docstrings: - def longest_increasing_path(self, matrix): 对矩阵中的每一个坐标计算最远距离 :param matrix: 整数矩阵 :return: 最长路径的长度 - def longest_increasing_path_core(self, matrix, rows, cols, row, col, lens): 寻找四个方向上的最大路...
9fdc4b1a2b59b7aed22ddfe92aade487b4c19b71
<|skeleton|> class Solution: """给定一个整数矩阵,找到增加最长路径的长度。""" def longest_increasing_path(self, matrix): """对矩阵中的每一个坐标计算最远距离 :param matrix: 整数矩阵 :return: 最长路径的长度""" <|body_0|> def longest_increasing_path_core(self, matrix, rows, cols, row, col, lens): """寻找四个方向上的最大路径 :param matrix: 整数矩阵...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """给定一个整数矩阵,找到增加最长路径的长度。""" def longest_increasing_path(self, matrix): """对矩阵中的每一个坐标计算最远距离 :param matrix: 整数矩阵 :return: 最长路径的长度""" rows = len(matrix) cols = len(matrix[0]) lens = [[-1] * cols for _ in range(rows)] max_path = 0 for row in range(row...
the_stack_v2_python_sparse
interview_coding/longest_increasing_path.py
MemoryForSky/Data-Structures-and-Algorithms
train
0
78d5677e32e6b588b32f33b38158759f6a2a96bf
[ "if dispositivo_id:\n dispositivo = Dispositivo.objects.get(pk=dispositivo_id)\n form = FormDispositivo(instance=dispositivo)\nelse:\n form = FormDispositivo()\nreturn render(request, self.template, {'form': form})", "if dispositivo_id:\n dispositivo = Dispositivo.objects.get(pk=dispositivo_id)\n f...
<|body_start_0|> if dispositivo_id: dispositivo = Dispositivo.objects.get(pk=dispositivo_id) form = FormDispositivo(instance=dispositivo) else: form = FormDispositivo() return render(request, self.template, {'form': form}) <|end_body_0|> <|body_start_1|> ...
Cadastra os dispositivos
CadastroDispositivoView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CadastroDispositivoView: """Cadastra os dispositivos""" def get(self, request, dispositivo_id=None): """Cria um formulário para cadastrar o dispositivo""" <|body_0|> def post(self, request, dispositivo_id=None): """Envia para o servidor os dispositivos cadastrado...
stack_v2_sparse_classes_36k_train_008904
5,983
no_license
[ { "docstring": "Cria um formulário para cadastrar o dispositivo", "name": "get", "signature": "def get(self, request, dispositivo_id=None)" }, { "docstring": "Envia para o servidor os dispositivos cadastrados", "name": "post", "signature": "def post(self, request, dispositivo_id=None)" ...
2
null
Implement the Python class `CadastroDispositivoView` described below. Class description: Cadastra os dispositivos Method signatures and docstrings: - def get(self, request, dispositivo_id=None): Cria um formulário para cadastrar o dispositivo - def post(self, request, dispositivo_id=None): Envia para o servidor os di...
Implement the Python class `CadastroDispositivoView` described below. Class description: Cadastra os dispositivos Method signatures and docstrings: - def get(self, request, dispositivo_id=None): Cria um formulário para cadastrar o dispositivo - def post(self, request, dispositivo_id=None): Envia para o servidor os di...
7b799a71380aca342e879c5556cc24fcebdac1ca
<|skeleton|> class CadastroDispositivoView: """Cadastra os dispositivos""" def get(self, request, dispositivo_id=None): """Cria um formulário para cadastrar o dispositivo""" <|body_0|> def post(self, request, dispositivo_id=None): """Envia para o servidor os dispositivos cadastrado...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CadastroDispositivoView: """Cadastra os dispositivos""" def get(self, request, dispositivo_id=None): """Cria um formulário para cadastrar o dispositivo""" if dispositivo_id: dispositivo = Dispositivo.objects.get(pk=dispositivo_id) form = FormDispositivo(instance=di...
the_stack_v2_python_sparse
detransapp/views/dispositivo.py
brunowber/transnote2
train
0
3d354a435b6c318cfdcc7ee2be0ccc91f1e7aba6
[ "self.user = kwargs.pop('user', None)\nself.question = kwargs.pop('question', None)\nsuper(KitsuneBaseForumForm, self).__init__(*args, **kwargs)", "cdata = self.cleaned_data.get('content')\nif not cdata:\n return super(KitsuneBaseForumForm, self).clean(*args, **kwargs)\nif not self.user:\n raise forms.Valid...
<|body_start_0|> self.user = kwargs.pop('user', None) self.question = kwargs.pop('question', None) super(KitsuneBaseForumForm, self).__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> cdata = self.cleaned_data.get('content') if not cdata: return super(KitsuneB...
Base form suitable for all the project. Mainly adds a common clean method to deal with spam.
KitsuneBaseForumForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KitsuneBaseForumForm: """Base form suitable for all the project. Mainly adds a common clean method to deal with spam.""" def __init__(self, *args, **kwargs): """Override init method to get the user if possible.""" <|body_0|> def clean(self, *args, **kwargs): """G...
stack_v2_sparse_classes_36k_train_008905
1,419
permissive
[ { "docstring": "Override init method to get the user if possible.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Generic clean method used by all forms in the question app. Parse content for suspicious content. - Toll free numbers - NANP numbers - Lin...
2
stack_v2_sparse_classes_30k_train_010313
Implement the Python class `KitsuneBaseForumForm` described below. Class description: Base form suitable for all the project. Mainly adds a common clean method to deal with spam. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Override init method to get the user if possible. - def clean(self...
Implement the Python class `KitsuneBaseForumForm` described below. Class description: Base form suitable for all the project. Mainly adds a common clean method to deal with spam. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Override init method to get the user if possible. - def clean(self...
67ec527bfc32c715bf9f29d5e01362c4903aebd2
<|skeleton|> class KitsuneBaseForumForm: """Base form suitable for all the project. Mainly adds a common clean method to deal with spam.""" def __init__(self, *args, **kwargs): """Override init method to get the user if possible.""" <|body_0|> def clean(self, *args, **kwargs): """G...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KitsuneBaseForumForm: """Base form suitable for all the project. Mainly adds a common clean method to deal with spam.""" def __init__(self, *args, **kwargs): """Override init method to get the user if possible.""" self.user = kwargs.pop('user', None) self.question = kwargs.pop('qu...
the_stack_v2_python_sparse
kitsune/sumo/forms.py
mozilla/kitsune
train
1,218
5f45935372d3cb33d0e21d88a390bcc90e986189
[ "super(Darknet, self).__init__()\nself.in_channels = in_ch\nself.batch_norm = batch_norm\nself.filters = filters\nself.stride_out_1 = 32\nself.stride_out_2 = 16\nself.stride_out_3 = 8\nindex = 0\nself.first_index = 0\nself.conv0 = DarknetConvBlock(self.in_channels, self.filters, kernel_size=3, stride=1, padding=1, ...
<|body_start_0|> super(Darknet, self).__init__() self.in_channels = in_ch self.batch_norm = batch_norm self.filters = filters self.stride_out_1 = 32 self.stride_out_2 = 16 self.stride_out_3 = 8 index = 0 self.first_index = 0 self.conv0 = Da...
Darknet body class
Darknet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Darknet: """Darknet body class""" def __init__(self, in_ch, filters=32, batch_norm=True): """Constructor""" <|body_0|> def forward(self, x): """Foward method""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Darknet, self).__init__() ...
stack_v2_sparse_classes_36k_train_008906
28,014
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, in_ch, filters=32, batch_norm=True)" }, { "docstring": "Foward method", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_test_000835
Implement the Python class `Darknet` described below. Class description: Darknet body class Method signatures and docstrings: - def __init__(self, in_ch, filters=32, batch_norm=True): Constructor - def forward(self, x): Foward method
Implement the Python class `Darknet` described below. Class description: Darknet body class Method signatures and docstrings: - def __init__(self, in_ch, filters=32, batch_norm=True): Constructor - def forward(self, x): Foward method <|skeleton|> class Darknet: """Darknet body class""" def __init__(self, in...
69edb5ecd569395086cf610df9c8aa345284259a
<|skeleton|> class Darknet: """Darknet body class""" def __init__(self, in_ch, filters=32, batch_norm=True): """Constructor""" <|body_0|> def forward(self, x): """Foward method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Darknet: """Darknet body class""" def __init__(self, in_ch, filters=32, batch_norm=True): """Constructor""" super(Darknet, self).__init__() self.in_channels = in_ch self.batch_norm = batch_norm self.filters = filters self.stride_out_1 = 32 self.stri...
the_stack_v2_python_sparse
python/models/modules.py
dswanderley/detntorch
train
2
bdda34ac8938f7fc69fa465bf05ff900881b795e
[ "Parametre.__init__(self, 'info', 'info')\nself.schema = '<cle>'\nself.aide_courte = \"affiche des informations sur l'étendue\"\nself.aide_longue = \"Affiche des informations sur l'étendue d'eau précisée en paramètre, comme ses obstacles, côtes et liens. Les obstacles sont des points neutres de l'étendue, pouvant r...
<|body_start_0|> Parametre.__init__(self, 'info', 'info') self.schema = '<cle>' self.aide_courte = "affiche des informations sur l'étendue" self.aide_longue = "Affiche des informations sur l'étendue d'eau précisée en paramètre, comme ses obstacles, côtes et liens. Les obstacles sont des ...
Commande 'etendue info'.
PrmInfo
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmInfo: """Commande 'etendue info'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__ini...
stack_v2_sparse_classes_36k_train_008907
4,018
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmInfo` described below. Class description: Commande 'etendue info'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmInfo` described below. Class description: Commande 'etendue info'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmInfo: """Commande 'etendue info'....
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmInfo: """Commande 'etendue info'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmInfo: """Commande 'etendue info'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'info', 'info') self.schema = '<cle>' self.aide_courte = "affiche des informations sur l'étendue" self.aide_longue = "Affiche des informations sur l...
the_stack_v2_python_sparse
src/primaires/salle/commandes/etendue/info.py
vincent-lg/tsunami
train
5
752fee9382a1ce1515fe484109a916e1d8964cd3
[ "if hasattr(measurement_model, 'inverse_covar'):\n inv_measurement_covar = measurement_model.inverse_covar(**kwargs)\nelse:\n inv_measurement_covar = np.linalg.inv(measurement_model.covar(**kwargs))\nreturn inv_measurement_covar", "measurement_model = self._check_measurement_model(measurement_model)\nhh = s...
<|body_start_0|> if hasattr(measurement_model, 'inverse_covar'): inv_measurement_covar = measurement_model.inverse_covar(**kwargs) else: inv_measurement_covar = np.linalg.inv(measurement_model.covar(**kwargs)) return inv_measurement_covar <|end_body_0|> <|body_start_1|> ...
A class which implements the update of information form of the Kalman filter. This is conceptually very simple. The update proceeds as: .. math:: Y_{k|k} = Y_{k|k-1} + H^{T}_k R^{-1}_k H_k \\mathbf{y}_{k|k} = \\mathbf{y}_{k|k-1} + H^{T}_k R^{-1}_k \\mathbf{z}_{k} where :math:`\\mathbf{y}_{k|k-1}` is the predicted infor...
InformationKalmanUpdater
[ "LicenseRef-scancode-proprietary-license", "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "Python-2.0", "LicenseRef-scancode-secret-labs-2011" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InformationKalmanUpdater: """A class which implements the update of information form of the Kalman filter. This is conceptually very simple. The update proceeds as: .. math:: Y_{k|k} = Y_{k|k-1} + H^{T}_k R^{-1}_k H_k \\mathbf{y}_{k|k} = \\mathbf{y}_{k|k-1} + H^{T}_k R^{-1}_k \\mathbf{z}_{k} wher...
stack_v2_sparse_classes_36k_train_008908
6,014
permissive
[ { "docstring": "Return the inverse of the measurement covariance (or calculate it) Parameters ---------- measurement_model The measurement model to be queried **kwargs : various, optional These are passed to :meth:`~.LinearGaussian.covar()` Returns ------- : :class:`numpy.ndarray` The inverse of the measurement...
3
stack_v2_sparse_classes_30k_train_008338
Implement the Python class `InformationKalmanUpdater` described below. Class description: A class which implements the update of information form of the Kalman filter. This is conceptually very simple. The update proceeds as: .. math:: Y_{k|k} = Y_{k|k-1} + H^{T}_k R^{-1}_k H_k \\mathbf{y}_{k|k} = \\mathbf{y}_{k|k-1} ...
Implement the Python class `InformationKalmanUpdater` described below. Class description: A class which implements the update of information form of the Kalman filter. This is conceptually very simple. The update proceeds as: .. math:: Y_{k|k} = Y_{k|k-1} + H^{T}_k R^{-1}_k H_k \\mathbf{y}_{k|k} = \\mathbf{y}_{k|k-1} ...
f24090cc919b3b590b84f965a3884ed1293d181d
<|skeleton|> class InformationKalmanUpdater: """A class which implements the update of information form of the Kalman filter. This is conceptually very simple. The update proceeds as: .. math:: Y_{k|k} = Y_{k|k-1} + H^{T}_k R^{-1}_k H_k \\mathbf{y}_{k|k} = \\mathbf{y}_{k|k-1} + H^{T}_k R^{-1}_k \\mathbf{z}_{k} wher...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InformationKalmanUpdater: """A class which implements the update of information form of the Kalman filter. This is conceptually very simple. The update proceeds as: .. math:: Y_{k|k} = Y_{k|k-1} + H^{T}_k R^{-1}_k H_k \\mathbf{y}_{k|k} = \\mathbf{y}_{k|k-1} + H^{T}_k R^{-1}_k \\mathbf{z}_{k} where :math:`\\ma...
the_stack_v2_python_sparse
stonesoup/updater/information.py
dstl/Stone-Soup
train
315
9e4048e89c0a57b3e4d57720b05b91fb7846363f
[ "super(MultiHeadedAttention, self).__init__()\nassert n_feat % n_head == 0\nself.d_k = n_feat // n_head\nself.h = n_head\nself.linear_q = torch.nn.Linear(q_dim, n_feat)\nself.linear_k = torch.nn.Linear(k_dim, n_feat)\nself.linear_v = torch.nn.Linear(v_dim, n_feat)\nself.linear_out = torch.nn.Linear(n_feat, n_feat)\...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert n_feat % n_head == 0 self.d_k = n_feat // n_head self.h = n_head self.linear_q = torch.nn.Linear(q_dim, n_feat) self.linear_k = torch.nn.Linear(k_dim, n_feat) self.linear_v = torch.nn.Linear(v_di...
Multi head attention module with different input dimension.
MultiHeadedAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: """Multi head attention module with different input dimension.""" def __init__(self, q_dim, k_dim, v_dim, n_head, n_feat, dropout_rate=0.0): """Initialize multi head attention module.""" <|body_0|> def forward_qkv(self, query, key, value): "...
stack_v2_sparse_classes_36k_train_008909
6,388
no_license
[ { "docstring": "Initialize multi head attention module.", "name": "__init__", "signature": "def __init__(self, q_dim, k_dim, v_dim, n_head, n_feat, dropout_rate=0.0)" }, { "docstring": "Transform query, key and value. Args: query (torch.Tensor): Query tensor (#batch, time1, size). key (torch.Ten...
4
null
Implement the Python class `MultiHeadedAttention` described below. Class description: Multi head attention module with different input dimension. Method signatures and docstrings: - def __init__(self, q_dim, k_dim, v_dim, n_head, n_feat, dropout_rate=0.0): Initialize multi head attention module. - def forward_qkv(sel...
Implement the Python class `MultiHeadedAttention` described below. Class description: Multi head attention module with different input dimension. Method signatures and docstrings: - def __init__(self, q_dim, k_dim, v_dim, n_head, n_feat, dropout_rate=0.0): Initialize multi head attention module. - def forward_qkv(sel...
b8365ea023e75cb69d84466319dd682726908320
<|skeleton|> class MultiHeadedAttention: """Multi head attention module with different input dimension.""" def __init__(self, q_dim, k_dim, v_dim, n_head, n_feat, dropout_rate=0.0): """Initialize multi head attention module.""" <|body_0|> def forward_qkv(self, query, key, value): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadedAttention: """Multi head attention module with different input dimension.""" def __init__(self, q_dim, k_dim, v_dim, n_head, n_feat, dropout_rate=0.0): """Initialize multi head attention module.""" super(MultiHeadedAttention, self).__init__() assert n_feat % n_head == 0...
the_stack_v2_python_sparse
vae_npvc/model/layers_gst.py
Sinica-SLAM/vae_npvc
train
1
bd3ffce8f8f65094804a0236b96ac7d1da1d6cfe
[ "self.config = config_\nself.logger = logging.getLogger('cuda_logger')\nself.radius = self.config['RL_parameters']['neighborhood_radius']", "self.logger.info('Starting job: NeighborhoodDataExportJob\\n')\ndata_provider = DataProvider(self.config)\ndata_exporter = DataExporter(self.config)\nhex_attr_df = data_prov...
<|body_start_0|> self.config = config_ self.logger = logging.getLogger('cuda_logger') self.radius = self.config['RL_parameters']['neighborhood_radius'] <|end_body_0|> <|body_start_1|> self.logger.info('Starting job: NeighborhoodDataExportJob\n') data_provider = DataProvider(self...
This class implements a job to export the neighborhood data
NeighborhoodDataExportJob
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeighborhoodDataExportJob: """This class implements a job to export the neighborhood data""" def __init__(self, config_): """Constructor :param config_: :param viz_name: :return:""" <|body_0|> def run(self): """This method executes the job :param: :return:""" ...
stack_v2_sparse_classes_36k_train_008910
1,581
no_license
[ { "docstring": "Constructor :param config_: :param viz_name: :return:", "name": "__init__", "signature": "def __init__(self, config_)" }, { "docstring": "This method executes the job :param: :return:", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `NeighborhoodDataExportJob` described below. Class description: This class implements a job to export the neighborhood data Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :param viz_name: :return: - def run(self): This method executes the job :p...
Implement the Python class `NeighborhoodDataExportJob` described below. Class description: This class implements a job to export the neighborhood data Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :param viz_name: :return: - def run(self): This method executes the job :p...
f7fcd2cc1d6ba18b199d176d4d39193f025ee281
<|skeleton|> class NeighborhoodDataExportJob: """This class implements a job to export the neighborhood data""" def __init__(self, config_): """Constructor :param config_: :param viz_name: :return:""" <|body_0|> def run(self): """This method executes the job :param: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeighborhoodDataExportJob: """This class implements a job to export the neighborhood data""" def __init__(self, config_): """Constructor :param config_: :param viz_name: :return:""" self.config = config_ self.logger = logging.getLogger('cuda_logger') self.radius = self.con...
the_stack_v2_python_sparse
learn_to_earn_framework/jobs/export_neighborhood_data.py
transparent-framework/optimize-ride-sharing-earnings
train
7
8bb32698a54f8e26798bc59451899e77a7dfe995
[ "Thread.__init__(self)\nself.IP = IP\nself.scan_type = scan_type\nself.file = file\nself.connstr = ''\nself.scanresult = ''", "try:\n cd = pyclamd.ClamdNetworkSocket(self.IP, 3310)\n if cd.ping():\n self.connstr = self.IP + ' Connection [OK]'\n cd.reload()\n if self.scan_type == 'contsc...
<|body_start_0|> Thread.__init__(self) self.IP = IP self.scan_type = scan_type self.file = file self.connstr = '' self.scanresult = '' <|end_body_0|> <|body_start_1|> try: cd = pyclamd.ClamdNetworkSocket(self.IP, 3310) if cd.ping(): ...
Scan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scan: def __init__(self, IP, scan_type, file): """构造方法,参数初始化""" <|body_0|> def run(self): """多进程run方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> Thread.__init__(self) self.IP = IP self.scan_type = scan_type self.file = f...
stack_v2_sparse_classes_36k_train_008911
2,394
no_license
[ { "docstring": "构造方法,参数初始化", "name": "__init__", "signature": "def __init__(self, IP, scan_type, file)" }, { "docstring": "多进程run方法", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_012783
Implement the Python class `Scan` described below. Class description: Implement the Scan class. Method signatures and docstrings: - def __init__(self, IP, scan_type, file): 构造方法,参数初始化 - def run(self): 多进程run方法
Implement the Python class `Scan` described below. Class description: Implement the Scan class. Method signatures and docstrings: - def __init__(self, IP, scan_type, file): 构造方法,参数初始化 - def run(self): 多进程run方法 <|skeleton|> class Scan: def __init__(self, IP, scan_type, file): """构造方法,参数初始化""" <|b...
c77e518f8faaa832fda83f86d2ed594667bebe47
<|skeleton|> class Scan: def __init__(self, IP, scan_type, file): """构造方法,参数初始化""" <|body_0|> def run(self): """多进程run方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scan: def __init__(self, IP, scan_type, file): """构造方法,参数初始化""" Thread.__init__(self) self.IP = IP self.scan_type = scan_type self.file = file self.connstr = '' self.scanresult = '' def run(self): """多进程run方法""" try: cd =...
the_stack_v2_python_sparse
Python自动化运维/Chapter Four/pyClamad/sample.py
qq412607705/Python_test
train
0
cf63158ab3652d28bce03bdaf20dd7d8d59e90b9
[ "super(ErrorWindow, self).__init__()\nmovieName = name\nerrorMessage = msg", "size = getSize()\nfm = g.getFontMetrics()\ng.setColor(Color.WHITE)\ng.fillRect(0, 0, size.width, size.height)\ng.setColor(Color.BLACK)\nx = (size.width - fm.stringWidth(movieName)) / 2\ny = size.height / 2 - fm.getHeight()\ng.drawString...
<|body_start_0|> super(ErrorWindow, self).__init__() movieName = name errorMessage = msg <|end_body_0|> <|body_start_1|> size = getSize() fm = g.getFontMetrics() g.setColor(Color.WHITE) g.fillRect(0, 0, size.width, size.height) g.setColor(Color.BLACK) ...
generated source for class ErrorWindow
ErrorWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorWindow: """generated source for class ErrorWindow""" def __init__(self, name, msg): """generated source for method __init__""" <|body_0|> def paint(self, g): """generated source for method paint""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_008912
28,432
no_license
[ { "docstring": "generated source for method __init__", "name": "__init__", "signature": "def __init__(self, name, msg)" }, { "docstring": "generated source for method paint", "name": "paint", "signature": "def paint(self, g)" } ]
2
stack_v2_sparse_classes_30k_train_000242
Implement the Python class `ErrorWindow` described below. Class description: generated source for class ErrorWindow Method signatures and docstrings: - def __init__(self, name, msg): generated source for method __init__ - def paint(self, g): generated source for method paint
Implement the Python class `ErrorWindow` described below. Class description: generated source for class ErrorWindow Method signatures and docstrings: - def __init__(self, name, msg): generated source for method __init__ - def paint(self, g): generated source for method paint <|skeleton|> class ErrorWindow: """ge...
5de73ee6d6945974083767c7bcbb650de08356de
<|skeleton|> class ErrorWindow: """generated source for class ErrorWindow""" def __init__(self, name, msg): """generated source for method __init__""" <|body_0|> def paint(self, g): """generated source for method paint""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorWindow: """generated source for class ErrorWindow""" def __init__(self, name, msg): """generated source for method __init__""" super(ErrorWindow, self).__init__() movieName = name errorMessage = msg def paint(self, g): """generated source for method paint...
the_stack_v2_python_sparse
ACM-Test/out/production/acm/out/production/acm/MovieClip.java.py
nrnoble/masterdirectory
train
0
2fff010753645435909604d84fa60de82e44b05c
[ "layer.Layer.__init__(self, inputs, inputs, alpha)\nself.hiddens = hiddens\nself.previoushidden = None\nself.parameters['weightsin'] = numpy.random.normal(0.0, 1.0 / numpy.sqrt(self.inputs), (self.hiddens, self.inputs))\nself.parameters['weightsout'] = numpy.random.normal(0.0, 1.0 / numpy.sqrt(self.hiddens), (self....
<|body_start_0|> layer.Layer.__init__(self, inputs, inputs, alpha) self.hiddens = hiddens self.previoushidden = None self.parameters['weightsin'] = numpy.random.normal(0.0, 1.0 / numpy.sqrt(self.inputs), (self.hiddens, self.inputs)) self.parameters['weightsout'] = numpy.random.no...
Auto Encoder Layer Mathematically, f(x) = W2 * g(x) + b2 g(x)(i) = 1 / (1 + exp(-h(x)(i))) h(x) = W1 * x + b1
AutoEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoEncoder: """Auto Encoder Layer Mathematically, f(x) = W2 * g(x) + b2 g(x)(i) = 1 / (1 + exp(-h(x)(i))) h(x) = W1 * x + b1""" def __init__(self, inputs, hiddens, alpha=None, nonlinearity=None): """Constructor : param inputs : dimension of input (and reconstructed output) feature s...
stack_v2_sparse_classes_36k_train_008913
4,788
no_license
[ { "docstring": "Constructor : param inputs : dimension of input (and reconstructed output) feature space : param hiddens : dimension of compressed output feature space : param alpha : learning rate constant hyperparameter : param nonlinearity : transfer function applied after linear transformation of inputs", ...
4
stack_v2_sparse_classes_30k_val_000582
Implement the Python class `AutoEncoder` described below. Class description: Auto Encoder Layer Mathematically, f(x) = W2 * g(x) + b2 g(x)(i) = 1 / (1 + exp(-h(x)(i))) h(x) = W1 * x + b1 Method signatures and docstrings: - def __init__(self, inputs, hiddens, alpha=None, nonlinearity=None): Constructor : param inputs ...
Implement the Python class `AutoEncoder` described below. Class description: Auto Encoder Layer Mathematically, f(x) = W2 * g(x) + b2 g(x)(i) = 1 / (1 + exp(-h(x)(i))) h(x) = W1 * x + b1 Method signatures and docstrings: - def __init__(self, inputs, hiddens, alpha=None, nonlinearity=None): Constructor : param inputs ...
10ee6e2297b7a2e01165ef983ae34097d7178122
<|skeleton|> class AutoEncoder: """Auto Encoder Layer Mathematically, f(x) = W2 * g(x) + b2 g(x)(i) = 1 / (1 + exp(-h(x)(i))) h(x) = W1 * x + b1""" def __init__(self, inputs, hiddens, alpha=None, nonlinearity=None): """Constructor : param inputs : dimension of input (and reconstructed output) feature s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoEncoder: """Auto Encoder Layer Mathematically, f(x) = W2 * g(x) + b2 g(x)(i) = 1 / (1 + exp(-h(x)(i))) h(x) = W1 * x + b1""" def __init__(self, inputs, hiddens, alpha=None, nonlinearity=None): """Constructor : param inputs : dimension of input (and reconstructed output) feature space : param ...
the_stack_v2_python_sparse
net/autoencoder.py
sunilmallya-work/NET
train
0
3c4a028f08dfa7bbe5f28c94f95c77a77a16cd99
[ "super(MultiheadAttentionContainer, self).__init__()\nself.nhead = nhead\nself.in_proj_container = in_proj_container\nself.attention_layer = attention_layer\nself.out_proj = out_proj\nself.attn_map = 0", "tgt_len, src_len, bsz, embed_dim = (query.size(-3), key.size(-3), query.size(-2), query.size(-1))\nq, k, v = ...
<|body_start_0|> super(MultiheadAttentionContainer, self).__init__() self.nhead = nhead self.in_proj_container = in_proj_container self.attention_layer = attention_layer self.out_proj = out_proj self.attn_map = 0 <|end_body_0|> <|body_start_1|> tgt_len, src_len, ...
MultiheadAttentionContainer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Li...
stack_v2_sparse_classes_36k_train_008914
38,400
permissive
[ { "docstring": "A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Linear). attention_layer: The attention layer. out_proj: The multi-head out-projection layer (a.k.a nn.Linear). Exa...
2
null
Implement the Python class `MultiheadAttentionContainer` described below. Class description: Implement the MultiheadAttentionContainer class. Method signatures and docstrings: - def __init__(self, nhead, in_proj_container, attention_layer, out_proj): A multi-head attention container Args: nhead: the number of heads i...
Implement the Python class `MultiheadAttentionContainer` described below. Class description: Implement the MultiheadAttentionContainer class. Method signatures and docstrings: - def __init__(self, nhead, in_proj_container, attention_layer, out_proj): A multi-head attention container Args: nhead: the number of heads i...
feeab742e9c737c8e2b8b0e44d3efff4049f5847
<|skeleton|> class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Linear). attenti...
the_stack_v2_python_sparse
src/models/baselines/transformer.py
ColinAvrech/state-spaces
train
0
ed62a18590d04c2e0abd79169cc74f77220acd95
[ "self.nuts = [Coconut(variety) for variety in ['middle eastern', 'south asian', 'american']]\nself.weights = [2.5, 3.0, 3.5]\nfor i in range(0, 3):\n self.assertEqual(self.nuts[i]._Coconut__weight, self.weights[i], 'The weight is wrong')", "varieties = [Coconut(variety) for variety in ['middle eastern', 'south...
<|body_start_0|> self.nuts = [Coconut(variety) for variety in ['middle eastern', 'south asian', 'american']] self.weights = [2.5, 3.0, 3.5] for i in range(0, 3): self.assertEqual(self.nuts[i]._Coconut__weight, self.weights[i], 'The weight is wrong') <|end_body_0|> <|body_start_1|> ...
TestCoconuts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" <|body_0|> def test_total_weight(self): """Tests that the sum of a specified number of coconuts of each type returned matches the expected total""" <|bo...
stack_v2_sparse_classes_36k_train_008915
2,241
no_license
[ { "docstring": "Tests that different coconut types each have a different weight", "name": "test_weight", "signature": "def test_weight(self)" }, { "docstring": "Tests that the sum of a specified number of coconuts of each type returned matches the expected total", "name": "test_total_weight"...
3
stack_v2_sparse_classes_30k_train_013812
Implement the Python class `TestCoconuts` described below. Class description: Implement the TestCoconuts class. Method signatures and docstrings: - def test_weight(self): Tests that different coconut types each have a different weight - def test_total_weight(self): Tests that the sum of a specified number of coconuts...
Implement the Python class `TestCoconuts` described below. Class description: Implement the TestCoconuts class. Method signatures and docstrings: - def test_weight(self): Tests that different coconut types each have a different weight - def test_total_weight(self): Tests that the sum of a specified number of coconuts...
4ca74dd054be17e7a57da891c5d239e3f915d3f1
<|skeleton|> class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" <|body_0|> def test_total_weight(self): """Tests that the sum of a specified number of coconuts of each type returned matches the expected total""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" self.nuts = [Coconut(variety) for variety in ['middle eastern', 'south asian', 'american']] self.weights = [2.5, 3.0, 3.5] for i in range(0, 3): self.assertEqu...
the_stack_v2_python_sparse
Lesson 2 - Converting Data Into Structured Objects/project/attempt_1/test_coconuts.py
jmwoloso/Python_3
train
0
8d87a8ca8530345d20eed9587cbdd4bf71b542d5
[ "self.pipe = pipe\nself.event = event\nself.schema = event[3:]\nself.table = data[0]\nself.cmd = data[1]\nself.args = data[2]\nthreading.Thread.__init__(self)", "dictdb = get_db(self.schema)\nassert hasattr(dictdb, self.cmd), \"'%(cmd)s' not a valid method of <type 'dict'>\" % self\nfunc = getattr(dictdb, self.cm...
<|body_start_0|> self.pipe = pipe self.event = event self.schema = event[3:] self.table = data[0] self.cmd = data[1] self.args = data[2] threading.Thread.__init__(self) <|end_body_0|> <|body_start_1|> dictdb = get_db(self.schema) assert hasattr(di...
This handler receives a "database command", in the form of a dictionary method name and its arguments, and the return value is sent to the session pipe with the same 'event' name.
DBHandler
[ "MIT", "ISC", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBHandler: """This handler receives a "database command", in the form of a dictionary method name and its arguments, and the return value is sent to the session pipe with the same 'event' name.""" def __init__(self, pipe, event, data): """Arguments: pipe: parent end of multiprocessin...
stack_v2_sparse_classes_36k_train_008916
2,757
permissive
[ { "docstring": "Arguments: pipe: parent end of multiprocessing.Pipe() event: database schema in form of string 'db-schema' or 'db=schema'. When '-' is used, the result is returned as a single transfer. When '=', an iterable is yielded and the data is transfered via the IPC pipe as a stream.", "name": "__ini...
2
null
Implement the Python class `DBHandler` described below. Class description: This handler receives a "database command", in the form of a dictionary method name and its arguments, and the return value is sent to the session pipe with the same 'event' name. Method signatures and docstrings: - def __init__(self, pipe, ev...
Implement the Python class `DBHandler` described below. Class description: This handler receives a "database command", in the form of a dictionary method name and its arguments, and the return value is sent to the session pipe with the same 'event' name. Method signatures and docstrings: - def __init__(self, pipe, ev...
730fe0e0dcbfba9bc818b665d86ebf1f0cc269fb
<|skeleton|> class DBHandler: """This handler receives a "database command", in the form of a dictionary method name and its arguments, and the return value is sent to the session pipe with the same 'event' name.""" def __init__(self, pipe, event, data): """Arguments: pipe: parent end of multiprocessin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DBHandler: """This handler receives a "database command", in the form of a dictionary method name and its arguments, and the return value is sent to the session pipe with the same 'event' name.""" def __init__(self, pipe, event, data): """Arguments: pipe: parent end of multiprocessing.Pipe() even...
the_stack_v2_python_sparse
db.py
madberry/x84
train
0
14048504ec0bfa41af6dc6a8c20fcb6ac1f03952
[ "self.state_manager = state_manager\nself.orchestrator = orchestrator\nself.extended = extended", "health_check = HealthCheck()\ntry:\n now = self.state_manager.get_now()\n if now is None:\n raise Exception('None received from database for now()')\nexcept Exception:\n hcm = HealthCheckMessage(msg=...
<|body_start_0|> self.state_manager = state_manager self.orchestrator = orchestrator self.extended = extended <|end_body_0|> <|body_start_1|> health_check = HealthCheck() try: now = self.state_manager.get_now() if now is None: raise Except...
Returns Drydock health check status.
HealthCheckCombined
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthCheckCombined: """Returns Drydock health check status.""" def __init__(self, state_manager=None, orchestrator=None, extended=False): """Object initializer. :param orchestrator: instance of Drydock orchestrator""" <|body_0|> def get(self, req, resp): """Retu...
stack_v2_sparse_classes_36k_train_008917
4,455
permissive
[ { "docstring": "Object initializer. :param orchestrator: instance of Drydock orchestrator", "name": "__init__", "signature": "def __init__(self, state_manager=None, orchestrator=None, extended=False)" }, { "docstring": "Returns updated response with body if extended.", "name": "get", "si...
2
stack_v2_sparse_classes_30k_train_016910
Implement the Python class `HealthCheckCombined` described below. Class description: Returns Drydock health check status. Method signatures and docstrings: - def __init__(self, state_manager=None, orchestrator=None, extended=False): Object initializer. :param orchestrator: instance of Drydock orchestrator - def get(s...
Implement the Python class `HealthCheckCombined` described below. Class description: Returns Drydock health check status. Method signatures and docstrings: - def __init__(self, state_manager=None, orchestrator=None, extended=False): Object initializer. :param orchestrator: instance of Drydock orchestrator - def get(s...
f99abfa4337f8cbb591513aac404b11208d4187c
<|skeleton|> class HealthCheckCombined: """Returns Drydock health check status.""" def __init__(self, state_manager=None, orchestrator=None, extended=False): """Object initializer. :param orchestrator: instance of Drydock orchestrator""" <|body_0|> def get(self, req, resp): """Retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HealthCheckCombined: """Returns Drydock health check status.""" def __init__(self, state_manager=None, orchestrator=None, extended=False): """Object initializer. :param orchestrator: instance of Drydock orchestrator""" self.state_manager = state_manager self.orchestrator = orchest...
the_stack_v2_python_sparse
python/drydock_provisioner/control/health.py
airshipit/drydock
train
13
c015f7d1cb7f3ef62db3471c6959cb6cb2750a4b
[ "super(GateUnit, self).__init__()\nself.conv1 = nn.Conv2d(out_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False)\nself.bn1 = nn.BatchNorm2d(in_feat)\nself.relu1 = nn.ReLU(inplace=True)\nself.conv2 = nn.Conv2d(in_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False)\nself.bn2 = nn.BatchNorm2d(in...
<|body_start_0|> super(GateUnit, self).__init__() self.conv1 = nn.Conv2d(out_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False) self.bn1 = nn.BatchNorm2d(in_feat) self.relu1 = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(in_feat, in_feat, kernel_size=3, padding=1, str...
GateUnit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GateUnit: def __init__(self, in_feat, out_feat): """First is a smaller feature and second is a larger feature""" <|body_0|> def forward(self, x1, x2): """x1 is smaller feature map""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(GateUnit, self)...
stack_v2_sparse_classes_36k_train_008918
29,670
no_license
[ { "docstring": "First is a smaller feature and second is a larger feature", "name": "__init__", "signature": "def __init__(self, in_feat, out_feat)" }, { "docstring": "x1 is smaller feature map", "name": "forward", "signature": "def forward(self, x1, x2)" } ]
2
stack_v2_sparse_classes_30k_train_016161
Implement the Python class `GateUnit` described below. Class description: Implement the GateUnit class. Method signatures and docstrings: - def __init__(self, in_feat, out_feat): First is a smaller feature and second is a larger feature - def forward(self, x1, x2): x1 is smaller feature map
Implement the Python class `GateUnit` described below. Class description: Implement the GateUnit class. Method signatures and docstrings: - def __init__(self, in_feat, out_feat): First is a smaller feature and second is a larger feature - def forward(self, x1, x2): x1 is smaller feature map <|skeleton|> class GateUn...
23ab1cbe8a1e3f9d68ef774a51ce23eeff81aea9
<|skeleton|> class GateUnit: def __init__(self, in_feat, out_feat): """First is a smaller feature and second is a larger feature""" <|body_0|> def forward(self, x1, x2): """x1 is smaller feature map""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GateUnit: def __init__(self, in_feat, out_feat): """First is a smaller feature and second is a larger feature""" super(GateUnit, self).__init__() self.conv1 = nn.Conv2d(out_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False) self.bn1 = nn.BatchNorm2d(in_feat) ...
the_stack_v2_python_sparse
refinenet.py
JunhongXu/kaggle-carvana-car-masking
train
1
a1e487b2b9731d606624e3a2f3b6783e562ed98e
[ "self._io = IO_handler()\nself._phrase = self._io.hanle_in(phrase, encoding)\nself._word_count = None", "if self._word_count is None:\n words = re.findall('\\\\w+', self._phrase.lower(), re.U)\n self._word_count = collections.Counter(self._io.handle_out(words))\nreturn self._word_count" ]
<|body_start_0|> self._io = IO_handler() self._phrase = self._io.hanle_in(phrase, encoding) self._word_count = None <|end_body_0|> <|body_start_1|> if self._word_count is None: words = re.findall('\\w+', self._phrase.lower(), re.U) self._word_count = collections....
Phrase abstraction with word counter.
Phrase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Phrase: """Phrase abstraction with word counter.""" def __init__(self, phrase, encoding=None): """Please specify your encoding""" <|body_0|> def word_count(self): """Count the words""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._io = IO_h...
stack_v2_sparse_classes_36k_train_008919
2,345
no_license
[ { "docstring": "Please specify your encoding", "name": "__init__", "signature": "def __init__(self, phrase, encoding=None)" }, { "docstring": "Count the words", "name": "word_count", "signature": "def word_count(self)" } ]
2
null
Implement the Python class `Phrase` described below. Class description: Phrase abstraction with word counter. Method signatures and docstrings: - def __init__(self, phrase, encoding=None): Please specify your encoding - def word_count(self): Count the words
Implement the Python class `Phrase` described below. Class description: Phrase abstraction with word counter. Method signatures and docstrings: - def __init__(self, phrase, encoding=None): Please specify your encoding - def word_count(self): Count the words <|skeleton|> class Phrase: """Phrase abstraction with w...
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
<|skeleton|> class Phrase: """Phrase abstraction with word counter.""" def __init__(self, phrase, encoding=None): """Please specify your encoding""" <|body_0|> def word_count(self): """Count the words""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Phrase: """Phrase abstraction with word counter.""" def __init__(self, phrase, encoding=None): """Please specify your encoding""" self._io = IO_handler() self._phrase = self._io.hanle_in(phrase, encoding) self._word_count = None def word_count(self): """Count ...
the_stack_v2_python_sparse
all_data/exercism_data/python/word-count/b904bdcab75e49208be23279c28cd40b.py
itsolutionscorp/AutoStyle-Clustering
train
4
8dcb13c4188770ec1f8a0cfb4ca8f75fba1a67cb
[ "next_index = next_object_key(self)\nnew_section = Section()\nnew_section.load_section_from_library(path, material_id)\nsetattr(self, str(next_index), new_section)\nreturn next_index", "next_index = next_object_key(self)\nnew_section = Section()\nnew_section.load_custom_from_library(name, material_id)\nsetattr(se...
<|body_start_0|> next_index = next_object_key(self) new_section = Section() new_section.load_section_from_library(path, material_id) setattr(self, str(next_index), new_section) return next_index <|end_body_0|> <|body_start_1|> next_index = next_object_key(self) n...
Creates an instance of the SkyCiv Sections class.
Sections
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sections: """Creates an instance of the SkyCiv Sections class.""" def add_library_section(self, path: list[str], material_id: int) -> int: """Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path o...
stack_v2_sparse_classes_36k_train_008920
2,588
permissive
[ { "docstring": "Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path of the section in the section library, obtained by inspection from within SkyCiv Section Builder or by attaining the library tree via S3D.SB.getLibraryTree...
3
stack_v2_sparse_classes_30k_train_018825
Implement the Python class `Sections` described below. Class description: Creates an instance of the SkyCiv Sections class. Method signatures and docstrings: - def add_library_section(self, path: list[str], material_id: int) -> int: Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an...
Implement the Python class `Sections` described below. Class description: Creates an instance of the SkyCiv Sections class. Method signatures and docstrings: - def add_library_section(self, path: list[str], material_id: int) -> int: Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an...
1cf3dad7f8d451760df02886df41684add72a4eb
<|skeleton|> class Sections: """Creates an instance of the SkyCiv Sections class.""" def add_library_section(self, path: list[str], material_id: int) -> int: """Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sections: """Creates an instance of the SkyCiv Sections class.""" def add_library_section(self, path: list[str], material_id: int) -> int: """Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path of the section...
the_stack_v2_python_sparse
src/skyciv/classes/model/components/sections/sections.py
osasanchezme/skyciv-pip
train
0
636eb050a5e470e616a887bff836b44510132e1a
[ "self.authnzerver = authnzerver\nself.fernetkey = fernetkey\nself.ferneter = Fernet(fernetkey)\nself.executor = executor\nself.session_expiry = session_expiry\nself.httpclient = AsyncHTTPClient(force_instance=True)\nself.siteinfo = siteinfo\nself.ratelimit = ratelimit\nself.cachedir = cachedir\nself.basedir = based...
<|body_start_0|> self.authnzerver = authnzerver self.fernetkey = fernetkey self.ferneter = Fernet(fernetkey) self.executor = executor self.session_expiry = session_expiry self.httpclient = AsyncHTTPClient(force_instance=True) self.siteinfo = siteinfo self....
This handles /admin.
AdminIndexHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminIndexHandler: """This handles /admin.""" def initialize(self, fernetkey, executor, authnzerver, basedir, session_expiry, siteinfo, ratelimit, cachedir): """This just sets up some stuff.""" <|body_0|> def get(self): """This shows the admin page.""" <|...
stack_v2_sparse_classes_36k_train_008921
27,340
permissive
[ { "docstring": "This just sets up some stuff.", "name": "initialize", "signature": "def initialize(self, fernetkey, executor, authnzerver, basedir, session_expiry, siteinfo, ratelimit, cachedir)" }, { "docstring": "This shows the admin page.", "name": "get", "signature": "def get(self)" ...
2
stack_v2_sparse_classes_30k_train_000487
Implement the Python class `AdminIndexHandler` described below. Class description: This handles /admin. Method signatures and docstrings: - def initialize(self, fernetkey, executor, authnzerver, basedir, session_expiry, siteinfo, ratelimit, cachedir): This just sets up some stuff. - def get(self): This shows the admi...
Implement the Python class `AdminIndexHandler` described below. Class description: This handles /admin. Method signatures and docstrings: - def initialize(self, fernetkey, executor, authnzerver, basedir, session_expiry, siteinfo, ratelimit, cachedir): This just sets up some stuff. - def get(self): This shows the admi...
b8256bf28aee42e628abe27f0203d6f5361fb84b
<|skeleton|> class AdminIndexHandler: """This handles /admin.""" def initialize(self, fernetkey, executor, authnzerver, basedir, session_expiry, siteinfo, ratelimit, cachedir): """This just sets up some stuff.""" <|body_0|> def get(self): """This shows the admin page.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminIndexHandler: """This handles /admin.""" def initialize(self, fernetkey, executor, authnzerver, basedir, session_expiry, siteinfo, ratelimit, cachedir): """This just sets up some stuff.""" self.authnzerver = authnzerver self.fernetkey = fernetkey self.ferneter = Ferne...
the_stack_v2_python_sparse
lccserver/frontend/admin_handlers.py
waqasbhatti/lcc-server
train
4
219c7aa63c2a983a891214099e3cff69455bccc9
[ "super().__init__(name)\nself.database = database\nself.searchTags = searchTags\nself.database.add_sensor_observer(self)", "if isinstance(keys, (slice, float, int)):\n keys = (keys,)\nreturn [copy.deepcopy(entry.data) for entry in self.database.find_entries(tags=self.searchTags, keys=keys)]", "sampleTags = [...
<|body_start_0|> super().__init__(name) self.database = database self.searchTags = searchTags self.database.add_sensor_observer(self) <|end_body_0|> <|body_start_1|> if isinstance(keys, (slice, float, int)): keys = (keys,) return [copy.deepcopy(entry.data) fo...
DatabaseView Dataview without parents made to access a NephelaeDataServer (The NephelaeDataServer play the role of a parent (but is not in the self.parent list). /!\\ This can only be used to manage SensorSample, only the add_sample observation is done on the database. TODO Consider changing database output interface. ...
DatabaseView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseView: """DatabaseView Dataview without parents made to access a NephelaeDataServer (The NephelaeDataServer play the role of a parent (but is not in the self.parent list). /!\\ This can only be used to manage SensorSample, only the add_sample observation is done on the database. TODO Consi...
stack_v2_sparse_classes_36k_train_008922
2,048
permissive
[ { "docstring": "Parameters: database : NephelaeDataServer database to which subscribing and from which data will be fetched on a __getitem__. searchTags : list(str, ...) tags to search data in the database.", "name": "__init__", "signature": "def __init__(self, name, database, searchTags)" }, { ...
3
stack_v2_sparse_classes_30k_train_020504
Implement the Python class `DatabaseView` described below. Class description: DatabaseView Dataview without parents made to access a NephelaeDataServer (The NephelaeDataServer play the role of a parent (but is not in the self.parent list). /!\\ This can only be used to manage SensorSample, only the add_sample observat...
Implement the Python class `DatabaseView` described below. Class description: DatabaseView Dataview without parents made to access a NephelaeDataServer (The NephelaeDataServer play the role of a parent (but is not in the self.parent list). /!\\ This can only be used to manage SensorSample, only the add_sample observat...
d5f1abeae0b0473b895b4735f182ddae0516a1bd
<|skeleton|> class DatabaseView: """DatabaseView Dataview without parents made to access a NephelaeDataServer (The NephelaeDataServer play the role of a parent (but is not in the self.parent list). /!\\ This can only be used to manage SensorSample, only the add_sample observation is done on the database. TODO Consi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseView: """DatabaseView Dataview without parents made to access a NephelaeDataServer (The NephelaeDataServer play the role of a parent (but is not in the self.parent list). /!\\ This can only be used to manage SensorSample, only the add_sample observation is done on the database. TODO Consider changing ...
the_stack_v2_python_sparse
nephelae/dataviews/types/DatabaseView.py
pnarvor/nephelae_base
train
0
1342dc471bb9ad0f89f4fba35056fa78a29404ec
[ "data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en = tokenizer_en\nself.data_train = data_train.map(self.tf_encode)\ndata_valid = tfds.load('ted_hrlr_translate/...
<|body_start_0|> data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) tokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train) self.tokenizer_pt = tokenizer_pt self.tokenizer_en = tokenizer_en self.data_train = data_train.map(self.tf_enco...
Dataset class
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Dataset class""" def __init__(self): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Method that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """Method that encodes a transl...
stack_v2_sparse_classes_36k_train_008923
2,032
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method that creates sub-word tokenizers for our dataset", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "Method that encodes a tr...
4
stack_v2_sparse_classes_30k_train_009421
Implement the Python class `Dataset` described below. Class description: Dataset class Method signatures and docstrings: - def __init__(self): Constructor - def tokenize_dataset(self, data): Method that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Method that encodes a translation into toke...
Implement the Python class `Dataset` described below. Class description: Dataset class Method signatures and docstrings: - def __init__(self): Constructor - def tokenize_dataset(self, data): Method that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Method that encodes a translation into toke...
131be8fcf61aafb5a4ddc0b3853ba625560eb786
<|skeleton|> class Dataset: """Dataset class""" def __init__(self): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Method that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """Method that encodes a transl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Dataset class""" def __init__(self): """Constructor""" data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) tokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train) self.tokenizer_pt = tokenizer_pt self.tokenize...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/2-dataset.py
zahraaassaad/holbertonschool-machine_learning
train
1
569b97e9b2cc854985c4a006086f81d13484c4fa
[ "if num < 0:\n return False\nelif num <= 1:\n return True\nleft = 1\nright = num - 1\nwhile left <= right:\n mid = (left + right) // 2\n mid_square = mid * mid\n if num == mid_square:\n return True\n elif num < mid_square:\n right = mid - 1\n else:\n left = mid + 1\nreturn ...
<|body_start_0|> if num < 0: return False elif num <= 1: return True left = 1 right = num - 1 while left <= right: mid = (left + right) // 2 mid_square = mid * mid if num == mid_square: return True ...
Runtime: 20 ms, faster than 55.25% of Python online submissions for Valid Perfect Square. Memory Usage: 13.4 MB, less than 35.08% of Python online submissions for Valid Perfect Square.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 20 ms, faster than 55.25% of Python online submissions for Valid Perfect Square. Memory Usage: 13.4 MB, less than 35.08% of Python online submissions for Valid Perfect Square.""" def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_0|...
stack_v2_sparse_classes_36k_train_008924
1,905
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)" }, { "docstring": ":type num: int :rtyp...
3
null
Implement the Python class `Solution` described below. Class description: Runtime: 20 ms, faster than 55.25% of Python online submissions for Valid Perfect Square. Memory Usage: 13.4 MB, less than 35.08% of Python online submissions for Valid Perfect Square. Method signatures and docstrings: - def isPerfectSquare(sel...
Implement the Python class `Solution` described below. Class description: Runtime: 20 ms, faster than 55.25% of Python online submissions for Valid Perfect Square. Memory Usage: 13.4 MB, less than 35.08% of Python online submissions for Valid Perfect Square. Method signatures and docstrings: - def isPerfectSquare(sel...
843db7190a95ebe310f5e867c02d28d43ca99248
<|skeleton|> class Solution: """Runtime: 20 ms, faster than 55.25% of Python online submissions for Valid Perfect Square. Memory Usage: 13.4 MB, less than 35.08% of Python online submissions for Valid Perfect Square.""" def isPerfectSquare(self, num): """:type num: int :rtype: bool""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Runtime: 20 ms, faster than 55.25% of Python online submissions for Valid Perfect Square. Memory Usage: 13.4 MB, less than 35.08% of Python online submissions for Valid Perfect Square.""" def isPerfectSquare(self, num): """:type num: int :rtype: bool""" if num < 0: ...
the_stack_v2_python_sparse
search/binary_search/valid_perfect_square.py
YuanZheCSYZ/algorithm
train
0
1b307bb242d4f2e0085c286024ddc959dab980c9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.accessPackageAssignmentRequestWorkflowExten...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
CustomCalloutExtension
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomCalloutExtension: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomCalloutExtension: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
stack_v2_sparse_classes_36k_train_008925
6,532
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: CustomCalloutExtension", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
stack_v2_sparse_classes_30k_train_006923
Implement the Python class `CustomCalloutExtension` described below. Class description: Implement the CustomCalloutExtension class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomCalloutExtension: Creates a new instance of the appropriate class b...
Implement the Python class `CustomCalloutExtension` described below. Class description: Implement the CustomCalloutExtension class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomCalloutExtension: Creates a new instance of the appropriate class b...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CustomCalloutExtension: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomCalloutExtension: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomCalloutExtension: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomCalloutExtension: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret...
the_stack_v2_python_sparse
msgraph/generated/models/custom_callout_extension.py
microsoftgraph/msgraph-sdk-python
train
135
59747667445c5b05233e57943b460c731e42505d
[ "if hasattr(self, 'gate'):\n return isinstance(self.gate, DifferentiableUnitary)\nif hasattr(self, 'gates'):\n return all((isinstance(gate, DifferentiableUnitary) for gate in self.gates))\nraise AttributeError('Expected gate or gates field for composed gate %s.' % self.get_name())", "if hasattr(self, 'gate'...
<|body_start_0|> if hasattr(self, 'gate'): return isinstance(self.gate, DifferentiableUnitary) if hasattr(self, 'gates'): return all((isinstance(gate, DifferentiableUnitary) for gate in self.gates)) raise AttributeError('Expected gate or gates field for composed gate %s.'...
The ComposedGate class. A ComposedGate provides methods for determining if the gate is differentiable or locally optimizable. A ComposedGate is differentiable/locally optimizable if it inherits from the appropriate base class and all of its subgates (in either self.gate or self.gates) inherit from the base class. For m...
ComposedGate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComposedGate: """The ComposedGate class. A ComposedGate provides methods for determining if the gate is differentiable or locally optimizable. A ComposedGate is differentiable/locally optimizable if it inherits from the appropriate base class and all of its subgates (in either self.gate or self.g...
stack_v2_sparse_classes_36k_train_008926
1,859
permissive
[ { "docstring": "Check is all sub gates are differentiable.", "name": "is_differentiable", "signature": "def is_differentiable(self) -> bool" }, { "docstring": "Check is all sub gates are locally optimizable.", "name": "is_locally_optimizable", "signature": "def is_locally_optimizable(sel...
2
stack_v2_sparse_classes_30k_val_000692
Implement the Python class `ComposedGate` described below. Class description: The ComposedGate class. A ComposedGate provides methods for determining if the gate is differentiable or locally optimizable. A ComposedGate is differentiable/locally optimizable if it inherits from the appropriate base class and all of its ...
Implement the Python class `ComposedGate` described below. Class description: The ComposedGate class. A ComposedGate provides methods for determining if the gate is differentiable or locally optimizable. A ComposedGate is differentiable/locally optimizable if it inherits from the appropriate base class and all of its ...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class ComposedGate: """The ComposedGate class. A ComposedGate provides methods for determining if the gate is differentiable or locally optimizable. A ComposedGate is differentiable/locally optimizable if it inherits from the appropriate base class and all of its subgates (in either self.gate or self.g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComposedGate: """The ComposedGate class. A ComposedGate provides methods for determining if the gate is differentiable or locally optimizable. A ComposedGate is differentiable/locally optimizable if it inherits from the appropriate base class and all of its subgates (in either self.gate or self.gates) inherit...
the_stack_v2_python_sparse
bqskit/ir/gates/composedgate.py
mtreinish/bqskit
train
0
22dba2c5cf6c001c17dbedd38e4cd64a2c9be617
[ "self._export_dir = export_dir\nself._best = None\nif isinstance(cmp_fn, tuple):\n self.cmp_fn = cmp_fn[0]\n self.is_export = cmp_fn[1]\nelse:\n self.cmp_fn = cmp_fn\n self.is_export = False\nself._best_result = None\nself._epoch_count = 0", "log.debug('New evaluate result: %s \\nold: %s' % (repr(eval...
<|body_start_0|> self._export_dir = export_dir self._best = None if isinstance(cmp_fn, tuple): self.cmp_fn = cmp_fn[0] self.is_export = cmp_fn[1] else: self.cmp_fn = cmp_fn self.is_export = False self._best_result = None sel...
export saved model accordingto `cmp_fn`
BestResultExporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BestResultExporter: """export saved model accordingto `cmp_fn`""" def __init__(self, export_dir, cmp_fn): """doc""" <|body_0|> def export(self, exe, program, eval_model_spec, eval_result, state): """doc""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_008927
8,759
permissive
[ { "docstring": "doc", "name": "__init__", "signature": "def __init__(self, export_dir, cmp_fn)" }, { "docstring": "doc", "name": "export", "signature": "def export(self, exe, program, eval_model_spec, eval_result, state)" } ]
2
stack_v2_sparse_classes_30k_train_000961
Implement the Python class `BestResultExporter` described below. Class description: export saved model accordingto `cmp_fn` Method signatures and docstrings: - def __init__(self, export_dir, cmp_fn): doc - def export(self, exe, program, eval_model_spec, eval_result, state): doc
Implement the Python class `BestResultExporter` described below. Class description: export saved model accordingto `cmp_fn` Method signatures and docstrings: - def __init__(self, export_dir, cmp_fn): doc - def export(self, exe, program, eval_model_spec, eval_result, state): doc <|skeleton|> class BestResultExporter:...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class BestResultExporter: """export saved model accordingto `cmp_fn`""" def __init__(self, export_dir, cmp_fn): """doc""" <|body_0|> def export(self, exe, program, eval_model_spec, eval_result, state): """doc""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BestResultExporter: """export saved model accordingto `cmp_fn`""" def __init__(self, export_dir, cmp_fn): """doc""" self._export_dir = export_dir self._best = None if isinstance(cmp_fn, tuple): self.cmp_fn = cmp_fn[0] self.is_export = cmp_fn[1] ...
the_stack_v2_python_sparse
competition/ogbg_molhiv/propeller/paddle/train/exporter.py
PaddlePaddle/PaddleHelix
train
771
3966e7685870d24be8eb237e028ec65f319c4a25
[ "self.memoryChartVirt = MemoryChart('virt')\nself.memoryChartVirt.signalNamespace(self, 'memoryChartVirt')\nself.registerMethodForRpc(self.uri + '/memoryChartVirt.data', self.memoryChartVirt, self.memoryChartVirt.data)\nself.memoryChartSwap = MemoryChart('swap')\nself.memoryChartSwap.signalNamespace(self, 'memoryCh...
<|body_start_0|> self.memoryChartVirt = MemoryChart('virt') self.memoryChartVirt.signalNamespace(self, 'memoryChartVirt') self.registerMethodForRpc(self.uri + '/memoryChartVirt.data', self.memoryChartVirt, self.memoryChartVirt.data) self.memoryChartSwap = MemoryChart('swap') self...
This is simple memory monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection
MemoryMonitorServerProtocol
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemoryMonitorServerProtocol: """This is simple memory monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection""" def onSessionOpen(self): """When connection is established, we crea...
stack_v2_sparse_classes_36k_train_008928
3,362
no_license
[ { "docstring": "When connection is established, we create our model instances and register them for RPC. that's it.", "name": "onSessionOpen", "signature": "def onSessionOpen(self)" }, { "docstring": "When connection is gone (i.e. client close window, navigated away from the page), stop the mode...
2
stack_v2_sparse_classes_30k_train_017586
Implement the Python class `MemoryMonitorServerProtocol` described below. Class description: This is simple memory monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection Method signatures and docstrings: - def onS...
Implement the Python class `MemoryMonitorServerProtocol` described below. Class description: This is simple memory monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection Method signatures and docstrings: - def onS...
16d3284d83ad5f8bd5fb6aaa048d5b444892b31a
<|skeleton|> class MemoryMonitorServerProtocol: """This is simple memory monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection""" def onSessionOpen(self): """When connection is established, we crea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemoryMonitorServerProtocol: """This is simple memory monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection""" def onSessionOpen(self): """When connection is established, we create our model ...
the_stack_v2_python_sparse
src/web/server_memory.py
vminakov/system-monitor
train
0
a709e348d0ac489ee9f649b493f77a818055518b
[ "tester = app.test_client(self)\nresponse = tester.get('/', content_type='html/text')\nself.assertEqual(response.status_code, 200)", "tester = app.test_client(self)\nresponse = tester.get('/', content_type='html/text')\nself.assertIn('<title>Flask Stock Visualizer</title>', response.data)" ]
<|body_start_0|> tester = app.test_client(self) response = tester.get('/', content_type='html/text') self.assertEqual(response.status_code, 200) <|end_body_0|> <|body_start_1|> tester = app.test_client(self) response = tester.get('/', content_type='html/text') self.asser...
BasicTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicTestCase: def test_index(self): """Ensure flask was set up correctly.""" <|body_0|> def test_index_slightly_better(self): """Ensure '/' contains expected HTML.""" <|body_1|> <|end_skeleton|> <|body_start_0|> tester = app.test_client(self) ...
stack_v2_sparse_classes_36k_train_008929
629
no_license
[ { "docstring": "Ensure flask was set up correctly.", "name": "test_index", "signature": "def test_index(self)" }, { "docstring": "Ensure '/' contains expected HTML.", "name": "test_index_slightly_better", "signature": "def test_index_slightly_better(self)" } ]
2
null
Implement the Python class `BasicTestCase` described below. Class description: Implement the BasicTestCase class. Method signatures and docstrings: - def test_index(self): Ensure flask was set up correctly. - def test_index_slightly_better(self): Ensure '/' contains expected HTML.
Implement the Python class `BasicTestCase` described below. Class description: Implement the BasicTestCase class. Method signatures and docstrings: - def test_index(self): Ensure flask was set up correctly. - def test_index_slightly_better(self): Ensure '/' contains expected HTML. <|skeleton|> class BasicTestCase: ...
7993f94d4fb8007a7e366687af11dd8aeb7ca7ed
<|skeleton|> class BasicTestCase: def test_index(self): """Ensure flask was set up correctly.""" <|body_0|> def test_index_slightly_better(self): """Ensure '/' contains expected HTML.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicTestCase: def test_index(self): """Ensure flask was set up correctly.""" tester = app.test_client(self) response = tester.get('/', content_type='html/text') self.assertEqual(response.status_code, 200) def test_index_slightly_better(self): """Ensure '/' contain...
the_stack_v2_python_sparse
Flask-Malaria Eradication/tests.py
sambapython/python
train
8
44cd910dda05b0f07c9339f3a0fc6d95e9977bb3
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.Azimuth = Azimuth\nself.Slope = Slope\nself.Squint = Squint\nself.Graze = Graze\nself.Tilt = Tilt\nself.DopplerConeAngle = DopplerConeAngle\nself.Extensions = Extensions\ns...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.Azimuth = Azimuth self.Slope = Slope self.Squint = Squint self.Graze = Graze self.Tilt = Til...
Key geometry parameters independent of product processing. All values computed at the center time of the full collection.
ExploitationFeaturesCollectionGeometryType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExploitationFeaturesCollectionGeometryType: """Key geometry parameters independent of product processing. All values computed at the center time of the full collection.""" def __init__(self, Azimuth=None, Slope=None, Squint=None, Graze=None, Tilt=None, DopplerConeAngle=None, Extensions=None,...
stack_v2_sparse_classes_36k_train_008930
34,922
permissive
[ { "docstring": "Parameters ---------- Azimuth : None|float Slope : None|float Squint : None|float Graze : None|float Tilt : None|float DopplerConeAngle : None|float Extensions : None|ParametersCollection|dict kwargs", "name": "__init__", "signature": "def __init__(self, Azimuth=None, Slope=None, Squint=...
2
null
Implement the Python class `ExploitationFeaturesCollectionGeometryType` described below. Class description: Key geometry parameters independent of product processing. All values computed at the center time of the full collection. Method signatures and docstrings: - def __init__(self, Azimuth=None, Slope=None, Squint=...
Implement the Python class `ExploitationFeaturesCollectionGeometryType` described below. Class description: Key geometry parameters independent of product processing. All values computed at the center time of the full collection. Method signatures and docstrings: - def __init__(self, Azimuth=None, Slope=None, Squint=...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class ExploitationFeaturesCollectionGeometryType: """Key geometry parameters independent of product processing. All values computed at the center time of the full collection.""" def __init__(self, Azimuth=None, Slope=None, Squint=None, Graze=None, Tilt=None, DopplerConeAngle=None, Extensions=None,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExploitationFeaturesCollectionGeometryType: """Key geometry parameters independent of product processing. All values computed at the center time of the full collection.""" def __init__(self, Azimuth=None, Slope=None, Squint=None, Graze=None, Tilt=None, DopplerConeAngle=None, Extensions=None, **kwargs): ...
the_stack_v2_python_sparse
sarpy/io/product/sidd2_elements/ExploitationFeatures.py
ngageoint/sarpy
train
192
9abbb516d5fa52ead1845cfc888b466131d9d205
[ "super(Embedding_LS, self).__init__()\nself.num_classes = num_classes\nself.label_smoothing_prob = label_smoothing_prob\nself.embed = LinearND(num_classes, embedding_dim, bias=False, dropout=dropout)", "y = _to_onehot(y, self.num_classes, self.label_smoothing_prob)\ny = self.embed(y)\nreturn y" ]
<|body_start_0|> super(Embedding_LS, self).__init__() self.num_classes = num_classes self.label_smoothing_prob = label_smoothing_prob self.embed = LinearND(num_classes, embedding_dim, bias=False, dropout=dropout) <|end_body_0|> <|body_start_1|> y = _to_onehot(y, self.num_classes...
Embedding_LS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding_LS: def __init__(self, num_classes, embedding_dim, dropout=0, label_smoothing_prob=0.0): """Embedding layer with label smoothing. Args: num_classes (int): the number of nodes in softmax layer (including <SOS> and <EOS> classes) embedding_dim (int): the dimension of the embeddin...
stack_v2_sparse_classes_36k_train_008931
4,283
no_license
[ { "docstring": "Embedding layer with label smoothing. Args: num_classes (int): the number of nodes in softmax layer (including <SOS> and <EOS> classes) embedding_dim (int): the dimension of the embedding in target spaces dropout (float, optional): the probability to drop nodes of the embedding label_smoothing_p...
2
stack_v2_sparse_classes_30k_train_002261
Implement the Python class `Embedding_LS` described below. Class description: Implement the Embedding_LS class. Method signatures and docstrings: - def __init__(self, num_classes, embedding_dim, dropout=0, label_smoothing_prob=0.0): Embedding layer with label smoothing. Args: num_classes (int): the number of nodes in...
Implement the Python class `Embedding_LS` described below. Class description: Implement the Embedding_LS class. Method signatures and docstrings: - def __init__(self, num_classes, embedding_dim, dropout=0, label_smoothing_prob=0.0): Embedding layer with label smoothing. Args: num_classes (int): the number of nodes in...
b6b60a338d65bb369d0034f423feb09db10db8b7
<|skeleton|> class Embedding_LS: def __init__(self, num_classes, embedding_dim, dropout=0, label_smoothing_prob=0.0): """Embedding layer with label smoothing. Args: num_classes (int): the number of nodes in softmax layer (including <SOS> and <EOS> classes) embedding_dim (int): the dimension of the embeddin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Embedding_LS: def __init__(self, num_classes, embedding_dim, dropout=0, label_smoothing_prob=0.0): """Embedding layer with label smoothing. Args: num_classes (int): the number of nodes in softmax layer (including <SOS> and <EOS> classes) embedding_dim (int): the dimension of the embedding in target sp...
the_stack_v2_python_sparse
models/pytorch/linear.py
carolinebear/pytorch_end2end_speech_recognition
train
0
6d695534710d9c62902c0649bbedc02a386225d8
[ "from __builtin__ import xrange\nresult = []\n\ndef dfs(previous_total, previous_value, pop, low_index, previous_str):\n \"\"\"\n :param int previous_total: previous total, shoud not be modified.\n :param int previous_value: previous single value.\n :param str pop: previous op.\n...
<|body_start_0|> from __builtin__ import xrange result = [] def dfs(previous_total, previous_value, pop, low_index, previous_str): """ :param int previous_total: previous total, shoud not be modified. :param int previous_value: previous single...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] 1 23 12 3 123 -- 1 23 1 2 3 1 23 -- 12 3 12 3 -- 123 123 beware of "001" convert to int is '1' '00' -> '0' '01' -> '1' moving index""" <|body_0|> def rewrite(self, num, targe...
stack_v2_sparse_classes_36k_train_008932
5,951
no_license
[ { "docstring": ":type num: str :type target: int :rtype: List[str] 1 23 12 3 123 -- 1 23 1 2 3 1 23 -- 12 3 12 3 -- 123 123 beware of \"001\" convert to int is '1' '00' -> '0' '01' -> '1' moving index", "name": "addOperators", "signature": "def addOperators(self, num, target)" }, { "docstring": ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str] 1 23 12 3 123 -- 1 23 1 2 3 1 23 -- 12 3 12 3 -- 123 123 beware of "001" convert to int is...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str] 1 23 12 3 123 -- 1 23 1 2 3 1 23 -- 12 3 12 3 -- 123 123 beware of "001" convert to int is...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] 1 23 12 3 123 -- 1 23 1 2 3 1 23 -- 12 3 12 3 -- 123 123 beware of "001" convert to int is '1' '00' -> '0' '01' -> '1' moving index""" <|body_0|> def rewrite(self, num, targe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] 1 23 12 3 123 -- 1 23 1 2 3 1 23 -- 12 3 12 3 -- 123 123 beware of "001" convert to int is '1' '00' -> '0' '01' -> '1' moving index""" from __builtin__ import xrange result = [] ...
the_stack_v2_python_sparse
depth-first-search/282_Expression_Add_Operators_hard.py
vsdrun/lc_public
train
6
1cf6b4db235a6f269be8f1ee3c8410d0dae769cf
[ "super().__init__()\nself.file_paths = file_paths\nself.single_file = single_file\nself.start = start\nself.chunk_size = chunk_size\nif self.single_file and (not chunk_size):\n raise DDSException('Missing chunk_size argument...')", "if self.single_file:\n with open(self.file_paths[0]) as file_paths_fd:\n ...
<|body_start_0|> super().__init__() self.file_paths = file_paths self.single_file = single_file self.start = start self.chunk_size = chunk_size if self.single_file and (not chunk_size): raise DDSException('Missing chunk_size argument...') <|end_body_0|> <|bod...
Worker file loader.
WorkerFileLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkerFileLoader: """Worker file loader.""" def __init__(self, file_paths, single_file=False, start=0, chunk_size=None): """Create new WorkerFileLoader object. :param file_paths: List of file paths. :param single_file: Is a single file? :param start: Start position. :param chunk_size...
stack_v2_sparse_classes_36k_train_008933
6,375
permissive
[ { "docstring": "Create new WorkerFileLoader object. :param file_paths: List of file paths. :param single_file: Is a single file? :param start: Start position. :param chunk_size: Chunk size. :returns: None.", "name": "__init__", "signature": "def __init__(self, file_paths, single_file=False, start=0, chu...
2
null
Implement the Python class `WorkerFileLoader` described below. Class description: Worker file loader. Method signatures and docstrings: - def __init__(self, file_paths, single_file=False, start=0, chunk_size=None): Create new WorkerFileLoader object. :param file_paths: List of file paths. :param single_file: Is a sin...
Implement the Python class `WorkerFileLoader` described below. Class description: Worker file loader. Method signatures and docstrings: - def __init__(self, file_paths, single_file=False, start=0, chunk_size=None): Create new WorkerFileLoader object. :param file_paths: List of file paths. :param single_file: Is a sin...
5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092
<|skeleton|> class WorkerFileLoader: """Worker file loader.""" def __init__(self, file_paths, single_file=False, start=0, chunk_size=None): """Create new WorkerFileLoader object. :param file_paths: List of file paths. :param single_file: Is a single file? :param start: Start position. :param chunk_size...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkerFileLoader: """Worker file loader.""" def __init__(self, file_paths, single_file=False, start=0, chunk_size=None): """Create new WorkerFileLoader object. :param file_paths: List of file paths. :param single_file: Is a single file? :param start: Start position. :param chunk_size: Chunk size....
the_stack_v2_python_sparse
compss/programming_model/bindings/python/src/pycompss/dds/partition_generators.py
bsc-wdc/compss
train
39
1a0d5ac5132ae7c124adbbf66cfc17bf497c73d8
[ "cmd = 'fleetrun dist_fleet_tree_node.py'\npro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nout, err = pro.communicate()\npro.wait()\npro.returncode == 0", "cmd = 'fleetrun dist_fleet_grahp_engine.py'\npro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=s...
<|body_start_0|> cmd = 'fleetrun dist_fleet_tree_node.py' pro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = pro.communicate() pro.wait() pro.returncode == 0 <|end_body_0|> <|body_start_1|> cmd = 'fleetrun dist_fleet_grahp_...
test all comm api
TestTreeNodeAndGrahpEngineApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTreeNodeAndGrahpEngineApi: """test all comm api""" def test_tree_node(self): """test_tree_node""" <|body_0|> def test_graph_engine(self): """test_tree_node""" <|body_1|> <|end_skeleton|> <|body_start_0|> cmd = 'fleetrun dist_fleet_tree_node....
stack_v2_sparse_classes_36k_train_008934
762
no_license
[ { "docstring": "test_tree_node", "name": "test_tree_node", "signature": "def test_tree_node(self)" }, { "docstring": "test_tree_node", "name": "test_graph_engine", "signature": "def test_graph_engine(self)" } ]
2
null
Implement the Python class `TestTreeNodeAndGrahpEngineApi` described below. Class description: test all comm api Method signatures and docstrings: - def test_tree_node(self): test_tree_node - def test_graph_engine(self): test_tree_node
Implement the Python class `TestTreeNodeAndGrahpEngineApi` described below. Class description: test all comm api Method signatures and docstrings: - def test_tree_node(self): test_tree_node - def test_graph_engine(self): test_tree_node <|skeleton|> class TestTreeNodeAndGrahpEngineApi: """test all comm api""" ...
e3562ab40b574f06bba68df6895a055fa31a085d
<|skeleton|> class TestTreeNodeAndGrahpEngineApi: """test all comm api""" def test_tree_node(self): """test_tree_node""" <|body_0|> def test_graph_engine(self): """test_tree_node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTreeNodeAndGrahpEngineApi: """test all comm api""" def test_tree_node(self): """test_tree_node""" cmd = 'fleetrun dist_fleet_tree_node.py' pro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = pro.communicate() pro.w...
the_stack_v2_python_sparse
dist_cts/dist_fleet_pipeline/test_dist_fleet_tree_node_and_graph_engine.py
gentelyang/scripts
train
0
716598e54713fde901b3625461d59204dc4e9cb7
[ "self.input_size = input_size\nself.output_size = output_size\nself.X = tf.placeholder(tf.float32, shape=[None, self.input_size])\nself.Y = tf.placeholder(tf.float32, shape=[None, self.output_size])\nself.weights = tf.Variable(tf.glorot_uniform_initializer()((self.input_size, self.output_size)))\nself.biases = tf.V...
<|body_start_0|> self.input_size = input_size self.output_size = output_size self.X = tf.placeholder(tf.float32, shape=[None, self.input_size]) self.Y = tf.placeholder(tf.float32, shape=[None, self.output_size]) self.weights = tf.Variable(tf.glorot_uniform_initializer()((self.inp...
SoftmaxRegression
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftmaxRegression: def __init__(self, input_size, output_size, dropout=False, BN=False): """Function: Initialization of all variables""" <|body_0|> def Regression(self): """Function: Define softmax function as y = sigmoid(A * x + b) Using tf function tf.layers.BatchN...
stack_v2_sparse_classes_36k_train_008935
19,475
no_license
[ { "docstring": "Function: Initialization of all variables", "name": "__init__", "signature": "def __init__(self, input_size, output_size, dropout=False, BN=False)" }, { "docstring": "Function: Define softmax function as y = sigmoid(A * x + b) Using tf function tf.layers.BatchNormalization()", ...
5
stack_v2_sparse_classes_30k_train_005159
Implement the Python class `SoftmaxRegression` described below. Class description: Implement the SoftmaxRegression class. Method signatures and docstrings: - def __init__(self, input_size, output_size, dropout=False, BN=False): Function: Initialization of all variables - def Regression(self): Function: Define softmax...
Implement the Python class `SoftmaxRegression` described below. Class description: Implement the SoftmaxRegression class. Method signatures and docstrings: - def __init__(self, input_size, output_size, dropout=False, BN=False): Function: Initialization of all variables - def Regression(self): Function: Define softmax...
929e28c3ea5aec63bc655035c48d96d2d3cff5bc
<|skeleton|> class SoftmaxRegression: def __init__(self, input_size, output_size, dropout=False, BN=False): """Function: Initialization of all variables""" <|body_0|> def Regression(self): """Function: Define softmax function as y = sigmoid(A * x + b) Using tf function tf.layers.BatchN...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftmaxRegression: def __init__(self, input_size, output_size, dropout=False, BN=False): """Function: Initialization of all variables""" self.input_size = input_size self.output_size = output_size self.X = tf.placeholder(tf.float32, shape=[None, self.input_size]) self.Y...
the_stack_v2_python_sparse
Ao_Zhang/assignment2/assignment2_question3.py
ZhangAoCanada/CSI5138_Assignments
train
1
e3079993328eb502d206b4fe93ef708a18071277
[ "if filters is None:\n filters = {}\norm_filters = super(EventResource, self).build_filters(filters)\nquery = filters.get('q')\ncategory_pk = filters.get('catpk')\nif query is not None:\n sqs = SearchQuerySet().models(Event).load_all().auto_query(query)\n orm_filters['pk__in'] = [i.pk for i in sqs]\nif cat...
<|body_start_0|> if filters is None: filters = {} orm_filters = super(EventResource, self).build_filters(filters) query = filters.get('q') category_pk = filters.get('catpk') if query is not None: sqs = SearchQuerySet().models(Event).load_all().auto_query(q...
EventResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventResource: def build_filters(self, filters=None): """Custom filters used for category and searching.""" <|body_0|> def dehydrate_image(self, bundle): """Ensures data includes a url for an app-sized thumbnail""" <|body_1|> def dehydrate(self, bundle):...
stack_v2_sparse_classes_36k_train_008936
2,337
no_license
[ { "docstring": "Custom filters used for category and searching.", "name": "build_filters", "signature": "def build_filters(self, filters=None)" }, { "docstring": "Ensures data includes a url for an app-sized thumbnail", "name": "dehydrate_image", "signature": "def dehydrate_image(self, b...
3
stack_v2_sparse_classes_30k_train_021410
Implement the Python class `EventResource` described below. Class description: Implement the EventResource class. Method signatures and docstrings: - def build_filters(self, filters=None): Custom filters used for category and searching. - def dehydrate_image(self, bundle): Ensures data includes a url for an app-sized...
Implement the Python class `EventResource` described below. Class description: Implement the EventResource class. Method signatures and docstrings: - def build_filters(self, filters=None): Custom filters used for category and searching. - def dehydrate_image(self, bundle): Ensures data includes a url for an app-sized...
3ed85e856a026001a1d91d09d31d944c64704824
<|skeleton|> class EventResource: def build_filters(self, filters=None): """Custom filters used for category and searching.""" <|body_0|> def dehydrate_image(self, bundle): """Ensures data includes a url for an app-sized thumbnail""" <|body_1|> def dehydrate(self, bundle):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventResource: def build_filters(self, filters=None): """Custom filters used for category and searching.""" if filters is None: filters = {} orm_filters = super(EventResource, self).build_filters(filters) query = filters.get('q') category_pk = filters.get('c...
the_stack_v2_python_sparse
scenable/events/api.py
gregarious/betasite
train
0
e4791412da0cc3439476c78f0b8df7db19e05957
[ "if data.get('action') is None:\n raise ValidationError({'action': 'This field is required.'})\nif data['action'] == FinancialAidStatus.APPROVED:\n if data.get('tier_program_id') is None:\n raise ValidationError({'tier_program_id': 'This field is required.'})\n if data.get('justification') is None:\...
<|body_start_0|> if data.get('action') is None: raise ValidationError({'action': 'This field is required.'}) if data['action'] == FinancialAidStatus.APPROVED: if data.get('tier_program_id') is None: raise ValidationError({'tier_program_id': 'This field is required...
Serializer for financial aid actions
FinancialAidActionSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FinancialAidActionSerializer: """Serializer for financial aid actions""" def validate(self, data): """Validators for this serializer""" <|body_0|> def save(self): """Save method for this serializer""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_008937
6,670
no_license
[ { "docstring": "Validators for this serializer", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Save method for this serializer", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_006550
Implement the Python class `FinancialAidActionSerializer` described below. Class description: Serializer for financial aid actions Method signatures and docstrings: - def validate(self, data): Validators for this serializer - def save(self): Save method for this serializer
Implement the Python class `FinancialAidActionSerializer` described below. Class description: Serializer for financial aid actions Method signatures and docstrings: - def validate(self, data): Validators for this serializer - def save(self): Save method for this serializer <|skeleton|> class FinancialAidActionSerial...
3c166bc52dfe8d7aa04f922134f4f6deeff49eb6
<|skeleton|> class FinancialAidActionSerializer: """Serializer for financial aid actions""" def validate(self, data): """Validators for this serializer""" <|body_0|> def save(self): """Save method for this serializer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FinancialAidActionSerializer: """Serializer for financial aid actions""" def validate(self, data): """Validators for this serializer""" if data.get('action') is None: raise ValidationError({'action': 'This field is required.'}) if data['action'] == FinancialAidStatus.A...
the_stack_v2_python_sparse
financialaid/serializers.py
avontd2868/micromasters
train
0
516f3a4265f6a4df81c1182c586c251c759b02bc
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('cici_fyl', 'cici_fyl')\nurl = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/1d9509a8b2fd485d9ad471ba2fdb1f90_0.geojson'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nr = js...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('cici_fyl', 'cici_fyl') url = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/1d9509a8b2fd485d9ad471ba2fdb1f90_0.geojson' response = url...
schoolrestaurant
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class schoolrestaurant: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_36k_train_008938
4,759
permissive
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_012200
Implement the Python class `schoolrestaurant` described below. Class description: Implement the schoolrestaurant class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
Implement the Python class `schoolrestaurant` described below. Class description: Implement the schoolrestaurant class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class schoolrestaurant: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class schoolrestaurant: 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('cici_fyl', 'cici_fyl') url...
the_stack_v2_python_sparse
cici_fyl/project/cici_fyl/schoolrestaurant.py
lingyigu/course-2017-spr-proj
train
0
d7df72c6a44d1cbeba1db77e46c9f2c90c04edb2
[ "super(BinaryExpression, self).__init__()\nself.args = []\nself.operator = operator", "if len(self.args) == 2:\n return '({0!s}) {1:s} {2!s}'.format(self.args[0], self.operator, self.args[1])\nreturn self.operator", "if not isinstance(lhs, Expression):\n raise errors.ParseError('Left hand side is not an e...
<|body_start_0|> super(BinaryExpression, self).__init__() self.args = [] self.operator = operator <|end_body_0|> <|body_start_1|> if len(self.args) == 2: return '({0!s}) {1:s} {2!s}'.format(self.args[0], self.operator, self.args[1]) return self.operator <|end_body_1|...
An event filter parser expression which takes two other expressions.
BinaryExpression
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryExpression: """An event filter parser expression which takes two other expressions.""" def __init__(self, operator=''): """Initializes an event filter parser binary expression. Args: operator (str): operator, such as "and" or "&&".""" <|body_0|> def __repr__(self):...
stack_v2_sparse_classes_36k_train_008939
7,105
permissive
[ { "docstring": "Initializes an event filter parser binary expression. Args: operator (str): operator, such as \"and\" or \"&&\".", "name": "__init__", "signature": "def __init__(self, operator='')" }, { "docstring": "Retrieves a string representation of the object for debugging.", "name": "_...
4
null
Implement the Python class `BinaryExpression` described below. Class description: An event filter parser expression which takes two other expressions. Method signatures and docstrings: - def __init__(self, operator=''): Initializes an event filter parser binary expression. Args: operator (str): operator, such as "and...
Implement the Python class `BinaryExpression` described below. Class description: An event filter parser expression which takes two other expressions. Method signatures and docstrings: - def __init__(self, operator=''): Initializes an event filter parser binary expression. Args: operator (str): operator, such as "and...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class BinaryExpression: """An event filter parser expression which takes two other expressions.""" def __init__(self, operator=''): """Initializes an event filter parser binary expression. Args: operator (str): operator, such as "and" or "&&".""" <|body_0|> def __repr__(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryExpression: """An event filter parser expression which takes two other expressions.""" def __init__(self, operator=''): """Initializes an event filter parser binary expression. Args: operator (str): operator, such as "and" or "&&".""" super(BinaryExpression, self).__init__() ...
the_stack_v2_python_sparse
plaso/filters/expressions.py
log2timeline/plaso
train
1,506
8a04bc228de5da95600daa29ac3fdb5193da2324
[ "uf = UnionFindMapWithDist2()\nfor (key1, key2), value in zip(equations, values):\n id1, id2 = (id(key1), id(key2))\n if not uf.isConnected(id1, id2):\n uf.union(id1, id2, value)\n else:\n dist = uf.dist(id1, id2)\n if abs(dist - value) > EPS:\n return True\nreturn False", ...
<|body_start_0|> uf = UnionFindMapWithDist2() for (key1, key2), value in zip(equations, values): id1, id2 = (id(key1), id(key2)) if not uf.isConnected(id1, id2): uf.union(id1, id2, value) else: dist = uf.dist(id1, id2) i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool: """检查方程是否存在矛盾""" <|body_0|> def checkContradictions2(self, equations: List[List[str]], values: List[float]) -> bool: """dfs或bfs求出每个点到每个组的根的距离,再逐一检验""" <|body_1|>...
stack_v2_sparse_classes_36k_train_008940
2,228
no_license
[ { "docstring": "检查方程是否存在矛盾", "name": "checkContradictions", "signature": "def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool" }, { "docstring": "dfs或bfs求出每个点到每个组的根的距离,再逐一检验", "name": "checkContradictions2", "signature": "def checkContradictions2(self, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool: 检查方程是否存在矛盾 - def checkContradictions2(self, equations: List[List[str]], values: List[float...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool: 检查方程是否存在矛盾 - def checkContradictions2(self, equations: List[List[str]], values: List[float...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool: """检查方程是否存在矛盾""" <|body_0|> def checkContradictions2(self, equations: List[List[str]], values: List[float]) -> bool: """dfs或bfs求出每个点到每个组的根的距离,再逐一检验""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool: """检查方程是否存在矛盾""" uf = UnionFindMapWithDist2() for (key1, key2), value in zip(equations, values): id1, id2 = (id(key1), id(key2)) if not uf.isConnected(id1, id2): ...
the_stack_v2_python_sparse
14_并查集/经典题/维护到根节点距离/2307. 检查方程中的矛盾之处.py
981377660LMT/algorithm-study
train
225
1a00e7f6dbc7c39d4e077799185542ebfcfa4dd0
[ "if result_schema is None:\n return {}\nresult = result_schema.get_computed_entity_columns(entity, **options)\nif result is None:\n return {}\noptions.update(result_schema=result_schema)\nresult = serializer_services.serialize(result, **options)\nreturn result", "if result_schema is None:\n return {}\nre...
<|body_start_0|> if result_schema is None: return {} result = result_schema.get_computed_entity_columns(entity, **options) if result is None: return {} options.update(result_schema=result_schema) result = serializer_services.serialize(result, **options) ...
schema manager class.
SchemaManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaManager: """schema manager class.""" def get_computed_entity_columns(self, entity, result_schema=None, **options): """gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict s...
stack_v2_sparse_classes_36k_train_008941
2,114
permissive
[ { "docstring": "gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict should not contain any `BaseEntity` or `ROW_RESULT` values, otherwise a max recursion error may occur. :param BaseEntity entity: the actu...
2
null
Implement the Python class `SchemaManager` described below. Class description: schema manager class. Method signatures and docstrings: - def get_computed_entity_columns(self, entity, result_schema=None, **options): gets a dict containing all computed columns to be added to the result. if `result_schema` is not provid...
Implement the Python class `SchemaManager` described below. Class description: schema manager class. Method signatures and docstrings: - def get_computed_entity_columns(self, entity, result_schema=None, **options): gets a dict containing all computed columns to be added to the result. if `result_schema` is not provid...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class SchemaManager: """schema manager class.""" def get_computed_entity_columns(self, entity, result_schema=None, **options): """gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchemaManager: """schema manager class.""" def get_computed_entity_columns(self, entity, result_schema=None, **options): """gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict should not con...
the_stack_v2_python_sparse
src/pyrin/api/schema/manager.py
mononobi/pyrin
train
20
d83bea28f33a0a43f6fdf8ad90714239e45e97f3
[ "self.login_with_cookie()\nuser_page = dimissionPage.DimissionPage(self.dr)\nl = user_page.delete_dimission()\nself.assertEqual(l[0] - 1, l[1])", "self.login_with_cookie()\nuser_page = dimissionPage.DimissionPage(self.dr)\nl = user_page.recover_dimission()\nself.assertEqual(l[0] - 1, l[1])" ]
<|body_start_0|> self.login_with_cookie() user_page = dimissionPage.DimissionPage(self.dr) l = user_page.delete_dimission() self.assertEqual(l[0] - 1, l[1]) <|end_body_0|> <|body_start_1|> self.login_with_cookie() user_page = dimissionPage.DimissionPage(self.dr) ...
离职库测试
TestDimission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDimission: """离职库测试""" def test_del_dimission(self): """从离职库中删除用户""" <|body_0|> def test_revover_dimission(self): """从离职库中还原用户""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.login_with_cookie() user_page = dimissionPage.Dimissi...
stack_v2_sparse_classes_36k_train_008942
799
no_license
[ { "docstring": "从离职库中删除用户", "name": "test_del_dimission", "signature": "def test_del_dimission(self)" }, { "docstring": "从离职库中还原用户", "name": "test_revover_dimission", "signature": "def test_revover_dimission(self)" } ]
2
stack_v2_sparse_classes_30k_train_004991
Implement the Python class `TestDimission` described below. Class description: 离职库测试 Method signatures and docstrings: - def test_del_dimission(self): 从离职库中删除用户 - def test_revover_dimission(self): 从离职库中还原用户
Implement the Python class `TestDimission` described below. Class description: 离职库测试 Method signatures and docstrings: - def test_del_dimission(self): 从离职库中删除用户 - def test_revover_dimission(self): 从离职库中还原用户 <|skeleton|> class TestDimission: """离职库测试""" def test_del_dimission(self): """从离职库中删除用户""" ...
91de99c0cba6b339cb95ea2ee4ba7d5b937a4ab6
<|skeleton|> class TestDimission: """离职库测试""" def test_del_dimission(self): """从离职库中删除用户""" <|body_0|> def test_revover_dimission(self): """从离职库中还原用户""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDimission: """离职库测试""" def test_del_dimission(self): """从离职库中删除用户""" self.login_with_cookie() user_page = dimissionPage.DimissionPage(self.dr) l = user_page.delete_dimission() self.assertEqual(l[0] - 1, l[1]) def test_revover_dimission(self): """从离...
the_stack_v2_python_sparse
JustCC/testcase/test_23_organize_dimission.py
ganlp/JUST
train
0
43c7c509ea963bed711e8465d285e21f411c719c
[ "super().__init__(**kwargs)\nif text is None:\n raise SelectError('Required text parameter is missing')\nself.text = text\nself.font_name = font_name\nself.font_size = font_size\nif self.height is None:\n self.height = 0.03\nif self.width is None:\n self.width = self.height * 0.5 * len(text)", "text_pos ...
<|body_start_0|> super().__init__(**kwargs) if text is None: raise SelectError('Required text parameter is missing') self.text = text self.font_name = font_name self.font_size = font_size if self.height is None: self.height = 0.03 if self.w...
Place text at position
BlockText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockText: """Place text at position""" def __init__(self, text=None, font_name='Tahoma', font_size=12, **kwargs): """Setup object :text: text string to display :font_name: font name default: system font :font_size: font size default:12""" <|body_0|> def display(self): ...
stack_v2_sparse_classes_36k_train_008943
3,836
no_license
[ { "docstring": "Setup object :text: text string to display :font_name: font name default: system font :font_size: font size default:12", "name": "__init__", "signature": "def __init__(self, text=None, font_name='Tahoma', font_size=12, **kwargs)" }, { "docstring": "Display text in canvas", "n...
2
stack_v2_sparse_classes_30k_train_017282
Implement the Python class `BlockText` described below. Class description: Place text at position Method signatures and docstrings: - def __init__(self, text=None, font_name='Tahoma', font_size=12, **kwargs): Setup object :text: text string to display :font_name: font name default: system font :font_size: font size d...
Implement the Python class `BlockText` described below. Class description: Place text at position Method signatures and docstrings: - def __init__(self, text=None, font_name='Tahoma', font_size=12, **kwargs): Setup object :text: text string to display :font_name: font name default: system font :font_size: font size d...
407d542e1c8b09718c6e931f1991562805f04607
<|skeleton|> class BlockText: """Place text at position""" def __init__(self, text=None, font_name='Tahoma', font_size=12, **kwargs): """Setup object :text: text string to display :font_name: font name default: system font :font_size: font size default:12""" <|body_0|> def display(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockText: """Place text at position""" def __init__(self, text=None, font_name='Tahoma', font_size=12, **kwargs): """Setup object :text: text string to display :font_name: font name default: system font :font_size: font size default:12""" super().__init__(**kwargs) if text is Non...
the_stack_v2_python_sparse
src/src/block_text.py
raysmith619/race_track
train
0
d59704128656e8a2f7539c3eabae5c763395e213
[ "if model._meta.app_label == 'syncwerk_ccnet_models':\n return 'ccnet'\nreturn None", "if model._meta.app_label == 'syncwerk_ccnet_models':\n return 'ccnet'\nreturn None", "if obj1._meta.app_label == 'syncwerk_ccnet_models' or obj2._meta.app_label == 'syncwerk_ccnet_models':\n return True\nreturn None"...
<|body_start_0|> if model._meta.app_label == 'syncwerk_ccnet_models': return 'ccnet' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'syncwerk_ccnet_models': return 'ccnet' return None <|end_body_1|> <|body_start_2|> if obj1._meta...
A router to control all database operations on models related to ccnet
SyncwerkCcnetModelsRouter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncwerkCcnetModelsRouter: """A router to control all database operations on models related to ccnet""" def db_for_read(self, model, **hints): """Point all operations which has app_label='syncwerk_ccnet_models' models to 'ccnet'""" <|body_0|> def db_for_write(self, model...
stack_v2_sparse_classes_36k_train_008944
1,265
permissive
[ { "docstring": "Point all operations which has app_label='syncwerk_ccnet_models' models to 'ccnet'", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Point all operations on syncwerk_ccnet_models models to 'ccnet'", "name": "db_for_write", "s...
4
stack_v2_sparse_classes_30k_train_006794
Implement the Python class `SyncwerkCcnetModelsRouter` described below. Class description: A router to control all database operations on models related to ccnet Method signatures and docstrings: - def db_for_read(self, model, **hints): Point all operations which has app_label='syncwerk_ccnet_models' models to 'ccnet...
Implement the Python class `SyncwerkCcnetModelsRouter` described below. Class description: A router to control all database operations on models related to ccnet Method signatures and docstrings: - def db_for_read(self, model, **hints): Point all operations which has app_label='syncwerk_ccnet_models' models to 'ccnet...
13b3ed26a04248211ef91ca70dccc617be27a3c3
<|skeleton|> class SyncwerkCcnetModelsRouter: """A router to control all database operations on models related to ccnet""" def db_for_read(self, model, **hints): """Point all operations which has app_label='syncwerk_ccnet_models' models to 'ccnet'""" <|body_0|> def db_for_write(self, model...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyncwerkCcnetModelsRouter: """A router to control all database operations on models related to ccnet""" def db_for_read(self, model, **hints): """Point all operations which has app_label='syncwerk_ccnet_models' models to 'ccnet'""" if model._meta.app_label == 'syncwerk_ccnet_models': ...
the_stack_v2_python_sparse
fhs/usr/share/python/syncwerk/restapi/restapi/syncwerk_ccnet_models/routers.py
syncwerk/syncwerk-server-restapi
train
0
04021339b4be3ae193900a1857477640ee228926
[ "probabilities = []\nlist_theoretical_amplitude = []\nbest_algorithms = []\nconfigurations = []\nlist_number_calls_made = []\nfor eta_group in self._eta_groups:\n self._global_eta_group = eta_group\n result = self._compute_theoretical_best_configuration()\n best_algorithms.append(result['best_algorithm'])\...
<|body_start_0|> probabilities = [] list_theoretical_amplitude = [] best_algorithms = [] configurations = [] list_number_calls_made = [] for eta_group in self._eta_groups: self._global_eta_group = eta_group result = self._compute_theoretical_best_c...
Representation of the theoretical One Shot Optimization
TheoreticalOneShotOptimization
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TheoreticalOneShotOptimization: """Representation of the theoretical One Shot Optimization""" def compute_theoretical_optimal_results(self) -> TheoreticalOneShotOptimalConfigurations: """Finds out the theoretical optimal configuration for each pair of attenuation levels""" <|...
stack_v2_sparse_classes_36k_train_008945
3,017
permissive
[ { "docstring": "Finds out the theoretical optimal configuration for each pair of attenuation levels", "name": "compute_theoretical_optimal_results", "signature": "def compute_theoretical_optimal_results(self) -> TheoreticalOneShotOptimalConfigurations" }, { "docstring": "Find out the theoretical...
2
stack_v2_sparse_classes_30k_train_017644
Implement the Python class `TheoreticalOneShotOptimization` described below. Class description: Representation of the theoretical One Shot Optimization Method signatures and docstrings: - def compute_theoretical_optimal_results(self) -> TheoreticalOneShotOptimalConfigurations: Finds out the theoretical optimal config...
Implement the Python class `TheoreticalOneShotOptimization` described below. Class description: Representation of the theoretical One Shot Optimization Method signatures and docstrings: - def compute_theoretical_optimal_results(self) -> TheoreticalOneShotOptimalConfigurations: Finds out the theoretical optimal config...
ea37fca21fc4c8cf7ac6a39b3a6666e8a4fe5a19
<|skeleton|> class TheoreticalOneShotOptimization: """Representation of the theoretical One Shot Optimization""" def compute_theoretical_optimal_results(self) -> TheoreticalOneShotOptimalConfigurations: """Finds out the theoretical optimal configuration for each pair of attenuation levels""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TheoreticalOneShotOptimization: """Representation of the theoretical One Shot Optimization""" def compute_theoretical_optimal_results(self) -> TheoreticalOneShotOptimalConfigurations: """Finds out the theoretical optimal configuration for each pair of attenuation levels""" probabilities =...
the_stack_v2_python_sparse
qcd/optimizations/theoreticaloneshotoptimization.py
iamtxena/quantum-channel-discrimination
train
0
e669bce7a6f60541978b3057826e3637ec22734b
[ "if message is not None:\n self.message = message\nif code is not None:\n self.code = code", "if len(value) > 255:\n raise ValidationError(self.message, self.code)\nif value[-1] == '.':\n value = value[:-1]\nif not self.regex.match(value):\n raise ValidationError(self.message, self.code)" ]
<|body_start_0|> if message is not None: self.message = message if code is not None: self.code = code <|end_body_0|> <|body_start_1|> if len(value) > 255: raise ValidationError(self.message, self.code) if value[-1] == '.': value = value[:-...
Validator for fqdn.
HostnameValidator
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostnameValidator: """Validator for fqdn.""" def __init__(self, message=None, code=None): """Constructor.""" <|body_0|> def __call__(self, value): """Check value.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if message is not None: ...
stack_v2_sparse_classes_36k_train_008946
1,896
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, message=None, code=None)" }, { "docstring": "Check value.", "name": "__call__", "signature": "def __call__(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_007712
Implement the Python class `HostnameValidator` described below. Class description: Validator for fqdn. Method signatures and docstrings: - def __init__(self, message=None, code=None): Constructor. - def __call__(self, value): Check value.
Implement the Python class `HostnameValidator` described below. Class description: Validator for fqdn. Method signatures and docstrings: - def __init__(self, message=None, code=None): Constructor. - def __call__(self, value): Check value. <|skeleton|> class HostnameValidator: """Validator for fqdn.""" def _...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class HostnameValidator: """Validator for fqdn.""" def __init__(self, message=None, code=None): """Constructor.""" <|body_0|> def __call__(self, value): """Check value.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HostnameValidator: """Validator for fqdn.""" def __init__(self, message=None, code=None): """Constructor.""" if message is not None: self.message = message if code is not None: self.code = code def __call__(self, value): """Check value.""" ...
the_stack_v2_python_sparse
modoboa/lib/validators.py
modoboa/modoboa
train
2,201
cd14bc5ce3550f3b2bdb47912c2ac6c9aeb5d2cb
[ "self.driver = driver\nself.value = value\nself.by = by\nself.locator = (self.by, self.value)\nself.webElement = None", "element = WebDriverWait(self.driver, 10).until(EC.visibility_of_element_located(locator=self.locator))\nself.webElement = element\nreturn None", "element = WebDriverWait(self.driver, 10).unti...
<|body_start_0|> self.driver = driver self.value = value self.by = by self.locator = (self.by, self.value) self.webElement = None <|end_body_0|> <|body_start_1|> element = WebDriverWait(self.driver, 10).until(EC.visibility_of_element_located(locator=self.locator)) ...
BaseElement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseElement: def __init__(self, driver, by, value): """This initializes the values :param driver: arg1 and is driver which runs chrome :param value: arg2 and is element value :param by: arg3 and is element locator""" <|body_0|> def find(self): """This finds the eleme...
stack_v2_sparse_classes_36k_train_008947
1,218
no_license
[ { "docstring": "This initializes the values :param driver: arg1 and is driver which runs chrome :param value: arg2 and is element value :param by: arg3 and is element locator", "name": "__init__", "signature": "def __init__(self, driver, by, value)" }, { "docstring": "This finds the element on t...
3
null
Implement the Python class `BaseElement` described below. Class description: Implement the BaseElement class. Method signatures and docstrings: - def __init__(self, driver, by, value): This initializes the values :param driver: arg1 and is driver which runs chrome :param value: arg2 and is element value :param by: ar...
Implement the Python class `BaseElement` described below. Class description: Implement the BaseElement class. Method signatures and docstrings: - def __init__(self, driver, by, value): This initializes the values :param driver: arg1 and is driver which runs chrome :param value: arg2 and is element value :param by: ar...
2b7edfafc4e448bd558c034044570496ca68bf2d
<|skeleton|> class BaseElement: def __init__(self, driver, by, value): """This initializes the values :param driver: arg1 and is driver which runs chrome :param value: arg2 and is element value :param by: arg3 and is element locator""" <|body_0|> def find(self): """This finds the eleme...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseElement: def __init__(self, driver, by, value): """This initializes the values :param driver: arg1 and is driver which runs chrome :param value: arg2 and is element value :param by: arg3 and is element locator""" self.driver = driver self.value = value self.by = by ...
the_stack_v2_python_sparse
Page_Object_Model2/base_element.py
gsudarshan1990/Training_Projects
train
0
bbf771a38895a27528da1f5fce3587b4fa42e030
[ "self.post_parser = reqparse.RequestParser()\nself.post_parser.add_argument('Name', type=str, required=True, help='No rule object name provided', location='json')\nself.post_parser.add_argument('Method', type=str, required=True, help='No rule method provided', location='json')\nself.post_parser.add_argument('Role',...
<|body_start_0|> self.post_parser = reqparse.RequestParser() self.post_parser.add_argument('Name', type=str, required=True, help='No rule object name provided', location='json') self.post_parser.add_argument('Method', type=str, required=True, help='No rule method provided', location='json') ...
DefaultRules
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultRules: def __init__(self): """Constructeur: liste les champs attendus dans le corps HTML""" <|body_0|> def get(self): """affiche toutes les regles par defaut associees aux noms d'objets""" <|body_1|> def post(self): """ajoute une regle par...
stack_v2_sparse_classes_36k_train_008948
2,623
no_license
[ { "docstring": "Constructeur: liste les champs attendus dans le corps HTML", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "affiche toutes les regles par defaut associees aux noms d'objets", "name": "get", "signature": "def get(self)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_020199
Implement the Python class `DefaultRules` described below. Class description: Implement the DefaultRules class. Method signatures and docstrings: - def __init__(self): Constructeur: liste les champs attendus dans le corps HTML - def get(self): affiche toutes les regles par defaut associees aux noms d'objets - def pos...
Implement the Python class `DefaultRules` described below. Class description: Implement the DefaultRules class. Method signatures and docstrings: - def __init__(self): Constructeur: liste les champs attendus dans le corps HTML - def get(self): affiche toutes les regles par defaut associees aux noms d'objets - def pos...
8f107644a74fe46827ec5ed53d0457022bd1608b
<|skeleton|> class DefaultRules: def __init__(self): """Constructeur: liste les champs attendus dans le corps HTML""" <|body_0|> def get(self): """affiche toutes les regles par defaut associees aux noms d'objets""" <|body_1|> def post(self): """ajoute une regle par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultRules: def __init__(self): """Constructeur: liste les champs attendus dans le corps HTML""" self.post_parser = reqparse.RequestParser() self.post_parser.add_argument('Name', type=str, required=True, help='No rule object name provided', location='json') self.post_parser.a...
the_stack_v2_python_sparse
authapp/view_def_rules.py
ldurandadomia/Flask-Restful
train
0
b503371719c19983f130de0cad10ad51b0deb2c8
[ "rules = [['(?i)([aeiou])x$', '\\\\1x'], ['(?i)([])([ns])$', '|1\\\\2es'], ['(?i)(^[bcdfghjklmnpqrstvwxyz]*)an$', '\\\\1anes'], ['(?i)([])s$', '|1ses'], ['(?i)(^[bcdfghjklmnpqrstvwxyz]*)([aeiou])([ns])$', '\\\\1\\\\2\\\\3es'], ['(?i)([aeiou])$', '\\\\1s'], ['(?i)([aeiou])s$', '\\\\1s'], ['(?i)([])(s)$', '|1\\\\2es'...
<|body_start_0|> rules = [['(?i)([aeiou])x$', '\\1x'], ['(?i)([])([ns])$', '|1\\2es'], ['(?i)(^[bcdfghjklmnpqrstvwxyz]*)an$', '\\1anes'], ['(?i)([])s$', '|1ses'], ['(?i)(^[bcdfghjklmnpqrstvwxyz]*)([aeiou])([ns])$', '\\1\\2\\3es'], ['(?i)([aeiou])$', '\\1s'], ['(?i)([aeiou])s$', '\\1s'], ['(?i)([])(s)$', '|1\\2e...
Inflector for pluralize and singularize Spanish nouns.
Spanish
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Spanish: """Inflector for pluralize and singularize Spanish nouns.""" def pluralize(self, word): """Pluralizes Spanish nouns.""" <|body_0|> def singularize(self, word): """Singularizes Spanish nouns.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_008949
36,915
no_license
[ { "docstring": "Pluralizes Spanish nouns.", "name": "pluralize", "signature": "def pluralize(self, word)" }, { "docstring": "Singularizes Spanish nouns.", "name": "singularize", "signature": "def singularize(self, word)" } ]
2
stack_v2_sparse_classes_30k_val_000162
Implement the Python class `Spanish` described below. Class description: Inflector for pluralize and singularize Spanish nouns. Method signatures and docstrings: - def pluralize(self, word): Pluralizes Spanish nouns. - def singularize(self, word): Singularizes Spanish nouns.
Implement the Python class `Spanish` described below. Class description: Inflector for pluralize and singularize Spanish nouns. Method signatures and docstrings: - def pluralize(self, word): Pluralizes Spanish nouns. - def singularize(self, word): Singularizes Spanish nouns. <|skeleton|> class Spanish: """Inflec...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class Spanish: """Inflector for pluralize and singularize Spanish nouns.""" def pluralize(self, word): """Pluralizes Spanish nouns.""" <|body_0|> def singularize(self, word): """Singularizes Spanish nouns.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Spanish: """Inflector for pluralize and singularize Spanish nouns.""" def pluralize(self, word): """Pluralizes Spanish nouns.""" rules = [['(?i)([aeiou])x$', '\\1x'], ['(?i)([])([ns])$', '|1\\2es'], ['(?i)(^[bcdfghjklmnpqrstvwxyz]*)an$', '\\1anes'], ['(?i)([])s$', '|1ses'], ['(?i)(^[bcdfg...
the_stack_v2_python_sparse
repoData/noklesta-SublimeRailsNav/allPythonContent.py
aCoffeeYin/pyreco
train
0
88c10e162d8c9e4f32954becb73f9742e39f2479
[ "super(AdbShellSshConnectionBuilder, self).__init__(*args, **kwargs)\nself._serial_number = None\nreturn", "if self._serial_number is None:\n if hasattr(self.parameters, 'serial_number'):\n self._serial_number = self.parameters.serial_number\nreturn self._serial_number", "if self._connection is None:\...
<|body_start_0|> super(AdbShellSshConnectionBuilder, self).__init__(*args, **kwargs) self._serial_number = None return <|end_body_0|> <|body_start_1|> if self._serial_number is None: if hasattr(self.parameters, 'serial_number'): self._serial_number = self.par...
A class to build an adb-shell connection over ssh
AdbShellSshConnectionBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdbShellSshConnectionBuilder: """A class to build an adb-shell connection over ssh""" def __init__(self, *args, **kwargs): """:param: - `parameters`: An object with `hostname`, `username`, and `password` attributes""" <|body_0|> def serial_number(self): """A seri...
stack_v2_sparse_classes_36k_train_008950
10,538
permissive
[ { "docstring": ":param: - `parameters`: An object with `hostname`, `username`, and `password` attributes", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "A serial number for the USB connection", "name": "serial_number", "signature": "def serial_...
3
stack_v2_sparse_classes_30k_train_016716
Implement the Python class `AdbShellSshConnectionBuilder` described below. Class description: A class to build an adb-shell connection over ssh Method signatures and docstrings: - def __init__(self, *args, **kwargs): :param: - `parameters`: An object with `hostname`, `username`, and `password` attributes - def serial...
Implement the Python class `AdbShellSshConnectionBuilder` described below. Class description: A class to build an adb-shell connection over ssh Method signatures and docstrings: - def __init__(self, *args, **kwargs): :param: - `parameters`: An object with `hostname`, `username`, and `password` attributes - def serial...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class AdbShellSshConnectionBuilder: """A class to build an adb-shell connection over ssh""" def __init__(self, *args, **kwargs): """:param: - `parameters`: An object with `hostname`, `username`, and `password` attributes""" <|body_0|> def serial_number(self): """A seri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdbShellSshConnectionBuilder: """A class to build an adb-shell connection over ssh""" def __init__(self, *args, **kwargs): """:param: - `parameters`: An object with `hostname`, `username`, and `password` attributes""" super(AdbShellSshConnectionBuilder, self).__init__(*args, **kwargs) ...
the_stack_v2_python_sparse
apetools/builders/subbuilders/connectionbuilder.py
russell-n/oldape
train
0
a68ac4fff2c6dd140f5baecc0b0d38453e065515
[ "datafile = open(trace_file, 'r')\ntrace_list = []\nwhile True:\n line = datafile.readline()\n if not line:\n break\n PC, TNT = line.split()\n PC = int(PC, 16)\n TNT = int(TNT)\n trace = Trace(PC, TNT)\n trace_list.append(trace)\nreturn trace_list", "binary_address = bin(int(address))[...
<|body_start_0|> datafile = open(trace_file, 'r') trace_list = [] while True: line = datafile.readline() if not line: break PC, TNT = line.split() PC = int(PC, 16) TNT = int(TNT) trace = Trace(PC, TNT) ...
TraceGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TraceGenerator: def trace_list_generator(trace_file): """Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace""" <|body_0|> def input_vector_generator(global_hr, local...
stack_v2_sparse_classes_36k_train_008951
1,596
no_license
[ { "docstring": "Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace", "name": "trace_list_generator", "signature": "def trace_list_generator(trace_file)" }, { "docstring": ":param global_...
2
null
Implement the Python class `TraceGenerator` described below. Class description: Implement the TraceGenerator class. Method signatures and docstrings: - def trace_list_generator(trace_file): Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: tr...
Implement the Python class `TraceGenerator` described below. Class description: Implement the TraceGenerator class. Method signatures and docstrings: - def trace_list_generator(trace_file): Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: tr...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class TraceGenerator: def trace_list_generator(trace_file): """Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace""" <|body_0|> def input_vector_generator(global_hr, local...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TraceGenerator: def trace_list_generator(trace_file): """Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace""" datafile = open(trace_file, 'r') trace_list = [] while Tr...
the_stack_v2_python_sparse
6.基于机器学习的CPU分支预测/Trace_Initializer.py
unlimitediw/CheckCode
train
0
3244bf8ea0d56d10eea595fbe67aa8ccbe21fafd
[ "super(KeepLaneTest, self).__init__(name, actor, 0, None, optional)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nworld = self.actor.get_world()\nblueprint = world.get_blueprint_library().find('sensor.other.lane_invasion')\nself._lane_sensor = world.spawn_actor(blueprint, carla.Transform(), attach_...
<|body_start_0|> super(KeepLaneTest, self).__init__(name, actor, 0, None, optional) self.logger.debug('%s.__init__()' % self.__class__.__name__) world = self.actor.get_world() blueprint = world.get_blueprint_library().find('sensor.other.lane_invasion') self._lane_sensor = world.s...
This class contains an atomic test for keeping lane. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result
KeepLaneTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeepLaneTest: """This class contains an atomic test for keeping lane. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result""" def __init__(self, actor, optional=False, name='CheckKeepL...
stack_v2_sparse_classes_36k_train_008952
44,616
permissive
[ { "docstring": "Construction with sensor setup", "name": "__init__", "signature": "def __init__(self, actor, optional=False, name='CheckKeepLane')" }, { "docstring": "Check lane invasion count", "name": "update", "signature": "def update(self)" }, { "docstring": "Cleanup sensor",...
4
null
Implement the Python class `KeepLaneTest` described below. Class description: This class contains an atomic test for keeping lane. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result Method signatures and docs...
Implement the Python class `KeepLaneTest` described below. Class description: This class contains an atomic test for keeping lane. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result Method signatures and docs...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class KeepLaneTest: """This class contains an atomic test for keeping lane. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result""" def __init__(self, actor, optional=False, name='CheckKeepL...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeepLaneTest: """This class contains an atomic test for keeping lane. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result""" def __init__(self, actor, optional=False, name='CheckKeepLane'): ...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_criteria.py
TinaMenke/Deep-Reinforcement-Learning
train
9
d1de51861655c5b6f23ac101ab5a67507e31988a
[ "self.shooters_total = difficulty\nself.asteroids_total = difficulty\nsuper().__init__(**kwargs)", "player = GamePlayer.random()\nshooters = HunterGroup.random(n=self.shooters_total)\nshooters.spread(100)\nplayers = PlayerGroup(player, activate=True, shooting=True)\nspaceships = SuperSpaceShipGroup(players, shoot...
<|body_start_0|> self.shooters_total = difficulty self.asteroids_total = difficulty super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> player = GamePlayer.random() shooters = HunterGroup.random(n=self.shooters_total) shooters.spread(100) players = PlayerG...
Level in which the goal is to destroy all hunters.
DestroyHunters
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestroyHunters: """Level in which the goal is to destroy all hunters.""" def __init__(self, difficulty, **kwargs): """Create the level by creating the groups.""" <|body_0|> def start(self): """Start the game by creating the game group with hunters.""" <|b...
stack_v2_sparse_classes_36k_train_008953
10,293
no_license
[ { "docstring": "Create the level by creating the groups.", "name": "__init__", "signature": "def __init__(self, difficulty, **kwargs)" }, { "docstring": "Start the game by creating the game group with hunters.", "name": "start", "signature": "def start(self)" }, { "docstring": "S...
3
null
Implement the Python class `DestroyHunters` described below. Class description: Level in which the goal is to destroy all hunters. Method signatures and docstrings: - def __init__(self, difficulty, **kwargs): Create the level by creating the groups. - def start(self): Start the game by creating the game group with hu...
Implement the Python class `DestroyHunters` described below. Class description: Level in which the goal is to destroy all hunters. Method signatures and docstrings: - def __init__(self, difficulty, **kwargs): Create the level by creating the groups. - def start(self): Start the game by creating the game group with hu...
ebfcaaf4a028eddb36bbc99184eb3f7a86eb24ed
<|skeleton|> class DestroyHunters: """Level in which the goal is to destroy all hunters.""" def __init__(self, difficulty, **kwargs): """Create the level by creating the groups.""" <|body_0|> def start(self): """Start the game by creating the game group with hunters.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DestroyHunters: """Level in which the goal is to destroy all hunters.""" def __init__(self, difficulty, **kwargs): """Create the level by creating the groups.""" self.shooters_total = difficulty self.asteroids_total = difficulty super().__init__(**kwargs) def start(se...
the_stack_v2_python_sparse
Game Structure/geometry/version5/myasteroidgame.py
MarcPartensky/Python-Games
train
2
aa511bcdceb466eae4e2a0f0e3d087b8dd1413b0
[ "super(ChannelIncreaseBlock, self).__init__()\nself.layers = list()\nfor block_name in blocks:\n self.layers.append(NAME_BLOCKS[block_name](base_channel=base_channel))\nself.layers = Sequential(*self.layers)\nself.blocks = self.layers.children() if isinstance(self.layers.children(), list) else list(self.layers.c...
<|body_start_0|> super(ChannelIncreaseBlock, self).__init__() self.layers = list() for block_name in blocks: self.layers.append(NAME_BLOCKS[block_name](base_channel=base_channel)) self.layers = Sequential(*self.layers) self.blocks = self.layers.children() if isinstanc...
Channel increase block, which passes several blocks, and concat the result on channel dim.
ChannelIncreaseBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChannelIncreaseBlock: """Channel increase block, which passes several blocks, and concat the result on channel dim.""" def __init__(self, blocks, base_channel): """Construct the class ChannelIncreaseBlock. :param blocks: list of string of the blocks :param base_channel: number of inp...
stack_v2_sparse_classes_36k_train_008954
5,337
permissive
[ { "docstring": "Construct the class ChannelIncreaseBlock. :param blocks: list of string of the blocks :param base_channel: number of input channels", "name": "__init__", "signature": "def __init__(self, blocks, base_channel)" }, { "docstring": "Calculate the output of the model. :param x: input ...
2
null
Implement the Python class `ChannelIncreaseBlock` described below. Class description: Channel increase block, which passes several blocks, and concat the result on channel dim. Method signatures and docstrings: - def __init__(self, blocks, base_channel): Construct the class ChannelIncreaseBlock. :param blocks: list o...
Implement the Python class `ChannelIncreaseBlock` described below. Class description: Channel increase block, which passes several blocks, and concat the result on channel dim. Method signatures and docstrings: - def __init__(self, blocks, base_channel): Construct the class ChannelIncreaseBlock. :param blocks: list o...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ChannelIncreaseBlock: """Channel increase block, which passes several blocks, and concat the result on channel dim.""" def __init__(self, blocks, base_channel): """Construct the class ChannelIncreaseBlock. :param blocks: list of string of the blocks :param base_channel: number of inp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChannelIncreaseBlock: """Channel increase block, which passes several blocks, and concat the result on channel dim.""" def __init__(self, blocks, base_channel): """Construct the class ChannelIncreaseBlock. :param blocks: list of string of the blocks :param base_channel: number of input channels""...
the_stack_v2_python_sparse
zeus/networks/mtm_sr.py
huawei-noah/xingtian
train
308
d9f8ac579e96ff4f0e71ccbd81d1691530d6cea7
[ "values = super(website_sale, self).checkout_values(data)\nif data:\n values['checkout'].update({'accept_invoice': bool(data.get('accept_invoice', False))})\nreturn values", "cr, uid, context, registry = (request.cr, request.uid, request.context, request.registry)\npartner_obj = registry.get('res.partner')\nsu...
<|body_start_0|> values = super(website_sale, self).checkout_values(data) if data: values['checkout'].update({'accept_invoice': bool(data.get('accept_invoice', False))}) return values <|end_body_0|> <|body_start_1|> cr, uid, context, registry = (request.cr, request.uid, requ...
website_sale
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class website_sale: def checkout_values(self, data=None): """Overload to add invoice param""" <|body_0|> def checkout_form_save(self, checkout): """overload to store accept invoice checkbox""" <|body_1|> <|end_skeleton|> <|body_start_0|> values = super(we...
stack_v2_sparse_classes_36k_train_008955
1,461
no_license
[ { "docstring": "Overload to add invoice param", "name": "checkout_values", "signature": "def checkout_values(self, data=None)" }, { "docstring": "overload to store accept invoice checkbox", "name": "checkout_form_save", "signature": "def checkout_form_save(self, checkout)" } ]
2
null
Implement the Python class `website_sale` described below. Class description: Implement the website_sale class. Method signatures and docstrings: - def checkout_values(self, data=None): Overload to add invoice param - def checkout_form_save(self, checkout): overload to store accept invoice checkbox
Implement the Python class `website_sale` described below. Class description: Implement the website_sale class. Method signatures and docstrings: - def checkout_values(self, data=None): Overload to add invoice param - def checkout_form_save(self, checkout): overload to store accept invoice checkbox <|skeleton|> clas...
3681cbad05d5748198318fc1774be77b5f6b420e
<|skeleton|> class website_sale: def checkout_values(self, data=None): """Overload to add invoice param""" <|body_0|> def checkout_form_save(self, checkout): """overload to store accept invoice checkbox""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class website_sale: def checkout_values(self, data=None): """Overload to add invoice param""" values = super(website_sale, self).checkout_values(data) if data: values['checkout'].update({'accept_invoice': bool(data.get('accept_invoice', False))}) return values def ch...
the_stack_v2_python_sparse
website_sale_request_invoice/controllers/main.py
dbertha/odoo-addons
train
1
70c1a75cd41ccf9d1878125313543b58ef428e0a
[ "similarity_calc = region_similarity_calculator.IouSimilarity()\nmatcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=unmatched_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True)\nbox_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder()\nself._target_assigner = targe...
<|body_start_0|> similarity_calc = region_similarity_calculator.IouSimilarity() matcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=unmatched_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True) box_coder = faster_rcnn_box_coder.FasterRcnnBoxCode...
Labeler for multiscale anchor boxes.
AnchorLabeler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of cl...
stack_v2_sparse_classes_36k_train_008956
23,318
permissive
[ { "docstring": "Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset. match_threshold: a float number between 0 and 1 representing the lower-bound threshold to assign positive labels for anch...
3
stack_v2_sparse_classes_30k_train_007407
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): Constructs anchor labeler to a...
Implement the Python class `AnchorLabeler` described below. Class description: Labeler for multiscale anchor boxes. Method signatures and docstrings: - def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): Constructs anchor labeler to a...
4b387b6ad1066f2ee67b112e152e15cf37038130
<|skeleton|> class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnchorLabeler: """Labeler for multiscale anchor boxes.""" def __init__(self, anchors, num_classes, match_threshold=0.7, unmatched_threshold=0.3, rpn_batch_size_per_im=256, rpn_fg_fraction=0.5): """Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. ...
the_stack_v2_python_sparse
models/experimental/mask_rcnn/anchors.py
boristown/tpu
train
5
70c31a39e9a68781adcf48ae144d5102247855eb
[ "self.__df = df\nself.__strategy = strategy\nself.__pos_func = pos_func\nself.__evaluate_func = evaluate_func\nself.__result_handler = result_handler\nself.__context = context", "if self.__strategy.available_to_calculate(self.__df):\n signal_df = self.__strategy.calculate_signals(self.__df)\n pos_df = self....
<|body_start_0|> self.__df = df self.__strategy = strategy self.__pos_func = pos_func self.__evaluate_func = evaluate_func self.__result_handler = result_handler self.__context = context <|end_body_0|> <|body_start_1|> if self.__strategy.available_to_calculate(se...
单次回测逻辑
StrategyBacktest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StrategyBacktest: """单次回测逻辑""" def __init__(self, df: pd.DataFrame, strategy: BaseExchangeStrategy, pos_func, evaluate_func, result_handler, context=None): """回测配置初始化 Parameters ---------- df : pd.DataFrame [candle_begin_time, open, high, low, close, volume] strategy : BaseExchangeSt...
stack_v2_sparse_classes_36k_train_008957
1,768
permissive
[ { "docstring": "回测配置初始化 Parameters ---------- df : pd.DataFrame [candle_begin_time, open, high, low, close, volume] strategy : BaseExchangeStrategy 策略 pos_func: (df) -> pos_df 仓位方法 evaluate_func : (pod_df) -> df_ev 评估方法 result_handler : (context, df_pos, df_ev, strategy, error_des) -> result_df 结果处理", "name...
2
stack_v2_sparse_classes_30k_train_011247
Implement the Python class `StrategyBacktest` described below. Class description: 单次回测逻辑 Method signatures and docstrings: - def __init__(self, df: pd.DataFrame, strategy: BaseExchangeStrategy, pos_func, evaluate_func, result_handler, context=None): 回测配置初始化 Parameters ---------- df : pd.DataFrame [candle_begin_time, ...
Implement the Python class `StrategyBacktest` described below. Class description: 单次回测逻辑 Method signatures and docstrings: - def __init__(self, df: pd.DataFrame, strategy: BaseExchangeStrategy, pos_func, evaluate_func, result_handler, context=None): 回测配置初始化 Parameters ---------- df : pd.DataFrame [candle_begin_time, ...
9a9a67d5298fe4e32c9419273f06cfa28b71b53a
<|skeleton|> class StrategyBacktest: """单次回测逻辑""" def __init__(self, df: pd.DataFrame, strategy: BaseExchangeStrategy, pos_func, evaluate_func, result_handler, context=None): """回测配置初始化 Parameters ---------- df : pd.DataFrame [candle_begin_time, open, high, low, close, volume] strategy : BaseExchangeSt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StrategyBacktest: """单次回测逻辑""" def __init__(self, df: pd.DataFrame, strategy: BaseExchangeStrategy, pos_func, evaluate_func, result_handler, context=None): """回测配置初始化 Parameters ---------- df : pd.DataFrame [candle_begin_time, open, high, low, close, volume] strategy : BaseExchangeStrategy 策略 pos...
the_stack_v2_python_sparse
cy_widgets/backtest/strategy.py
cragod/CYWidgets
train
1
1f6f4b9fdbc4758ecf8b23b43f45dfea993ffcb1
[ "from ..jobfolder.ordered_dict import OrderedDict\nsuper(RelaxExtract.IntermediateMassExtract, self).__init__(*args, **kwargs)\nself.dicttype = OrderedDict\n' Type of dictionary to use. \\n \\n Always ordered dictionary for intermediate mass extraction.\\n Makes it easier to explore ongoing c...
<|body_start_0|> from ..jobfolder.ordered_dict import OrderedDict super(RelaxExtract.IntermediateMassExtract, self).__init__(*args, **kwargs) self.dicttype = OrderedDict ' Type of dictionary to use. \n \n Always ordered dictionary for intermediate mass extraction.\n ...
Focuses on intermediate steps.
IntermediateMassExtract
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntermediateMassExtract: """Focuses on intermediate steps.""" def __init__(self, *args, **kwargs): """Makes sure we are using ordered dict.""" <|body_0|> def __getitem__(self, value): """Gets intermediate step. Adds ability to get runs as numbers: ``self.details[...
stack_v2_sparse_classes_36k_train_008958
6,637
no_license
[ { "docstring": "Makes sure we are using ordered dict.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Gets intermediate step. Adds ability to get runs as numbers: ``self.details[0]`` is equivalent to ``self.details['relax/0']``", "name": "__getitem...
4
null
Implement the Python class `IntermediateMassExtract` described below. Class description: Focuses on intermediate steps. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Makes sure we are using ordered dict. - def __getitem__(self, value): Gets intermediate step. Adds ability to get runs as num...
Implement the Python class `IntermediateMassExtract` described below. Class description: Focuses on intermediate steps. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Makes sure we are using ordered dict. - def __getitem__(self, value): Gets intermediate step. Adds ability to get runs as num...
9c0ab667f94dc4629404a8ec99cbeaa323f0c8b3
<|skeleton|> class IntermediateMassExtract: """Focuses on intermediate steps.""" def __init__(self, *args, **kwargs): """Makes sure we are using ordered dict.""" <|body_0|> def __getitem__(self, value): """Gets intermediate step. Adds ability to get runs as numbers: ``self.details[...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntermediateMassExtract: """Focuses on intermediate steps.""" def __init__(self, *args, **kwargs): """Makes sure we are using ordered dict.""" from ..jobfolder.ordered_dict import OrderedDict super(RelaxExtract.IntermediateMassExtract, self).__init__(*args, **kwargs) self....
the_stack_v2_python_sparse
dftcrystal/relax.py
Shibu778/LaDa
train
0
435b2f192cd22e0af748734c701b465bcc46ee9f
[ "agent = request.user.userinfo.agent\ndata = ModelMessage.get_smtp_info(agent_id=agent.id)\ndata['password'] = ''\ncontext = {'status': 200, 'msg': '获取数据成功', 'data': data}\nreturn Response(context)", "agent = request.user.userinfo.agent\nemail = ModelMessage.objects.get_or_create(agent=agent, type=1)[0]\nemail_se...
<|body_start_0|> agent = request.user.userinfo.agent data = ModelMessage.get_smtp_info(agent_id=agent.id) data['password'] = '' context = {'status': 200, 'msg': '获取数据成功', 'data': data} return Response(context) <|end_body_0|> <|body_start_1|> agent = request.user.userinfo...
邮件服务信息
SMTPinfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMTPinfo: """邮件服务信息""" def get(self, request): """获取邮件配置信息""" <|body_0|> def put(self, request): """修改邮件配置信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> agent = request.user.userinfo.agent data = ModelMessage.get_smtp_info(agent_id=a...
stack_v2_sparse_classes_36k_train_008959
32,690
no_license
[ { "docstring": "获取邮件配置信息", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改邮件配置信息", "name": "put", "signature": "def put(self, request)" } ]
2
null
Implement the Python class `SMTPinfo` described below. Class description: 邮件服务信息 Method signatures and docstrings: - def get(self, request): 获取邮件配置信息 - def put(self, request): 修改邮件配置信息
Implement the Python class `SMTPinfo` described below. Class description: 邮件服务信息 Method signatures and docstrings: - def get(self, request): 获取邮件配置信息 - def put(self, request): 修改邮件配置信息 <|skeleton|> class SMTPinfo: """邮件服务信息""" def get(self, request): """获取邮件配置信息""" <|body_0|> def put(se...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class SMTPinfo: """邮件服务信息""" def get(self, request): """获取邮件配置信息""" <|body_0|> def put(self, request): """修改邮件配置信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SMTPinfo: """邮件服务信息""" def get(self, request): """获取邮件配置信息""" agent = request.user.userinfo.agent data = ModelMessage.get_smtp_info(agent_id=agent.id) data['password'] = '' context = {'status': 200, 'msg': '获取数据成功', 'data': data} return Response(context) ...
the_stack_v2_python_sparse
soc_system/views/set_views.py
sundw2015/841
train
4
f5629e682fd4bc02a02a90ffed28960461a4f6c6
[ "event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_REQUEST', client=self.client_id, description=self.args.reason)\nflow.Events.PublishEvent('Audit', event, token=self.token)\nreturn self.ApprovalUrnBuilder(self.client_id.Path(), self.token.username, self.args.reason)", "client = aff4.F...
<|body_start_0|> event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_REQUEST', client=self.client_id, description=self.args.reason) flow.Events.PublishEvent('Audit', event, token=self.token) return self.ApprovalUrnBuilder(self.client_id.Path(), self.token.username, self...
A flow to request approval to access a client.
RequestClientApprovalFlow
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestClientApprovalFlow: """A flow to request approval to access a client.""" def BuildApprovalUrn(self): """Builds approval object urn.""" <|body_0|> def BuildSubjectTitle(self): """Returns the string with subject's title.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_008960
28,119
permissive
[ { "docstring": "Builds approval object urn.", "name": "BuildApprovalUrn", "signature": "def BuildApprovalUrn(self)" }, { "docstring": "Returns the string with subject's title.", "name": "BuildSubjectTitle", "signature": "def BuildSubjectTitle(self)" } ]
2
stack_v2_sparse_classes_30k_train_004607
Implement the Python class `RequestClientApprovalFlow` described below. Class description: A flow to request approval to access a client. Method signatures and docstrings: - def BuildApprovalUrn(self): Builds approval object urn. - def BuildSubjectTitle(self): Returns the string with subject's title.
Implement the Python class `RequestClientApprovalFlow` described below. Class description: A flow to request approval to access a client. Method signatures and docstrings: - def BuildApprovalUrn(self): Builds approval object urn. - def BuildSubjectTitle(self): Returns the string with subject's title. <|skeleton|> cl...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class RequestClientApprovalFlow: """A flow to request approval to access a client.""" def BuildApprovalUrn(self): """Builds approval object urn.""" <|body_0|> def BuildSubjectTitle(self): """Returns the string with subject's title.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestClientApprovalFlow: """A flow to request approval to access a client.""" def BuildApprovalUrn(self): """Builds approval object urn.""" event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_REQUEST', client=self.client_id, description=self.args.reason) ...
the_stack_v2_python_sparse
lib/aff4_objects/security.py
defaultnamehere/grr
train
3
3fbecc85055c7686cc1c130e31580696b39a86dd
[ "email = self.request.get('email')\ndate = self.request.get('date')\nself.hello_request(api_url='timeline/admin/{}/{}'.format(email, date), type='GET', api_info=self.suripu_app)", "email = self.request.get('email')\ndate = self.request.get('date')\nself.hello_request(api_url='timeline/admin/invalidate/{}/{}'.form...
<|body_start_0|> email = self.request.get('email') date = self.request.get('date') self.hello_request(api_url='timeline/admin/{}/{}'.format(email, date), type='GET', api_info=self.suripu_app) <|end_body_0|> <|body_start_1|> email = self.request.get('email') date = self.request.g...
TimelineAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimelineAPI: def get(self): """Retrieve user timeline""" <|body_0|> def post(self): """Invalidate cache for user timeline""" <|body_1|> <|end_skeleton|> <|body_start_0|> email = self.request.get('email') date = self.request.get('date') ...
stack_v2_sparse_classes_36k_train_008961
2,336
no_license
[ { "docstring": "Retrieve user timeline", "name": "get", "signature": "def get(self)" }, { "docstring": "Invalidate cache for user timeline", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `TimelineAPI` described below. Class description: Implement the TimelineAPI class. Method signatures and docstrings: - def get(self): Retrieve user timeline - def post(self): Invalidate cache for user timeline
Implement the Python class `TimelineAPI` described below. Class description: Implement the TimelineAPI class. Method signatures and docstrings: - def get(self): Retrieve user timeline - def post(self): Invalidate cache for user timeline <|skeleton|> class TimelineAPI: def get(self): """Retrieve user tim...
44a274372d72416d7f7f95d76b6882ca3b4baff7
<|skeleton|> class TimelineAPI: def get(self): """Retrieve user timeline""" <|body_0|> def post(self): """Invalidate cache for user timeline""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimelineAPI: def get(self): """Retrieve user timeline""" email = self.request.get('email') date = self.request.get('date') self.hello_request(api_url='timeline/admin/{}/{}'.format(email, date), type='GET', api_info=self.suripu_app) def post(self): """Invalidate cac...
the_stack_v2_python_sparse
api/timeline.py
hello/hello-admin
train
2
75a6d6c96d50acb40e177503a01403ea348a7e0e
[ "self.seed = 33\nreset(self.seed)\nself.testing = testing\nself.layer = layer\nself.case = case\nself.model_dtype = self.testing.get('model_dtype')\npaddle.set_default_dtype(self.model_dtype)\nself.layer_name = self.layer.get('Layer').get('layer_name')\nself.layer_param = self.layer.get('Layer').get('params')\nself...
<|body_start_0|> self.seed = 33 reset(self.seed) self.testing = testing self.layer = layer self.case = case self.model_dtype = self.testing.get('model_dtype') paddle.set_default_dtype(self.model_dtype) self.layer_name = self.layer.get('Layer').get('layer_n...
构建Layer导出的通用类
LayerExport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerExport: """构建Layer导出的通用类""" def __init__(self, testing, case, layer): """初始化""" <|body_0|> def jit_save(self): """jit.save(layer)""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.seed = 33 reset(self.seed) self.testing =...
stack_v2_sparse_classes_36k_train_008962
1,579
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, testing, case, layer)" }, { "docstring": "jit.save(layer)", "name": "jit_save", "signature": "def jit_save(self)" } ]
2
null
Implement the Python class `LayerExport` described below. Class description: 构建Layer导出的通用类 Method signatures and docstrings: - def __init__(self, testing, case, layer): 初始化 - def jit_save(self): jit.save(layer)
Implement the Python class `LayerExport` described below. Class description: 构建Layer导出的通用类 Method signatures and docstrings: - def __init__(self, testing, case, layer): 初始化 - def jit_save(self): jit.save(layer) <|skeleton|> class LayerExport: """构建Layer导出的通用类""" def __init__(self, testing, case, layer): ...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class LayerExport: """构建Layer导出的通用类""" def __init__(self, testing, case, layer): """初始化""" <|body_0|> def jit_save(self): """jit.save(layer)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerExport: """构建Layer导出的通用类""" def __init__(self, testing, case, layer): """初始化""" self.seed = 33 reset(self.seed) self.testing = testing self.layer = layer self.case = case self.model_dtype = self.testing.get('model_dtype') paddle.set_def...
the_stack_v2_python_sparse
framework/e2e/paddleLT/engine/export.py
PaddlePaddle/PaddleTest
train
42
c418ec166e1284e0d99225df099e1d7cc6ed9c54
[ "prefix_function = [0] * len(pattern)\nborder = 0\nfor i in range(1, len(pattern)):\n while border > 0 and pattern[i] != pattern[border]:\n border = prefix_function[border - 1]\n if pattern[i] == pattern[border]:\n border += 1\n else:\n border = 0\n prefix_function[i] = border\nretu...
<|body_start_0|> prefix_function = [0] * len(pattern) border = 0 for i in range(1, len(pattern)): while border > 0 and pattern[i] != pattern[border]: border = prefix_function[border - 1] if pattern[i] == pattern[border]: border += 1 ...
Util
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Util: def _compute_prefix_function(pattern): """Computes the prefix function on the pattern. Definition: The border of string S is a prefix, which is equal to a suffix of S, but not equal to the whole S. Examples: 'a' is a border of 'arba' 'ab' is a border of 'abcdab' 'abab' is a border ...
stack_v2_sparse_classes_36k_train_008963
3,748
no_license
[ { "docstring": "Computes the prefix function on the pattern. Definition: The border of string S is a prefix, which is equal to a suffix of S, but not equal to the whole S. Examples: 'a' is a border of 'arba' 'ab' is a border of 'abcdab' 'abab' is a border of 'ababab' 'ab' is not a border of 'ab' Definition: The...
3
stack_v2_sparse_classes_30k_train_010282
Implement the Python class `Util` described below. Class description: Implement the Util class. Method signatures and docstrings: - def _compute_prefix_function(pattern): Computes the prefix function on the pattern. Definition: The border of string S is a prefix, which is equal to a suffix of S, but not equal to the ...
Implement the Python class `Util` described below. Class description: Implement the Util class. Method signatures and docstrings: - def _compute_prefix_function(pattern): Computes the prefix function on the pattern. Definition: The border of string S is a prefix, which is equal to a suffix of S, but not equal to the ...
01dd6f0dadf62a520bcafafddf7bf2b79e8e2603
<|skeleton|> class Util: def _compute_prefix_function(pattern): """Computes the prefix function on the pattern. Definition: The border of string S is a prefix, which is equal to a suffix of S, but not equal to the whole S. Examples: 'a' is a border of 'arba' 'ab' is a border of 'abcdab' 'abab' is a border ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Util: def _compute_prefix_function(pattern): """Computes the prefix function on the pattern. Definition: The border of string S is a prefix, which is equal to a suffix of S, but not equal to the whole S. Examples: 'a' is a border of 'arba' 'ab' is a border of 'abcdab' 'abab' is a border of 'ababab' 'a...
the_stack_v2_python_sparse
course4-strings/assignments/assignment_003_suffix_array_matching/suffix_array_matching_with_kmp.py
dmitri-mamrukov/coursera-data-structures-and-algorithms
train
1
4bd2466bd0b7dd2a9cda0f53e216372bf9503a0a
[ "user_id = token_auth.current_user()\nsearch_dto = TeamSearchDTO()\nsearch_dto.team_name = request.args.get('team_name', None)\nsearch_dto.member = request.args.get('member', None)\nsearch_dto.manager = request.args.get('manager', None)\nsearch_dto.member_request = request.args.get('member_request', None)\nsearch_d...
<|body_start_0|> user_id = token_auth.current_user() search_dto = TeamSearchDTO() search_dto.team_name = request.args.get('team_name', None) search_dto.member = request.args.get('member', None) search_dto.manager = request.args.get('manager', None) search_dto.member_reque...
TeamsAllAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamsAllAPI: def get(self): """Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name ...
stack_v2_sparse_classes_36k_train_008964
12,780
permissive
[ { "docstring": "Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name of the team to filter by type: str defa...
2
stack_v2_sparse_classes_30k_train_020128
Implement the Python class `TeamsAllAPI` described below. Class description: Implement the TeamsAllAPI class. Method signatures and docstrings: - def get(self): Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required...
Implement the Python class `TeamsAllAPI` described below. Class description: Implement the TeamsAllAPI class. Method signatures and docstrings: - def get(self): Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class TeamsAllAPI: def get(self): """Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeamsAllAPI: def get(self): """Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name of the team to...
the_stack_v2_python_sparse
backend/api/teams/resources.py
hotosm/tasking-manager
train
526
7309c1a5226dcdfd7341a0e2d2b6bc5161404fc0
[ "enterprise_client = EnterpriseApiClient(auth_token)\nenterprise_data = enterprise_client.get_with_access_to(user, enterprise_id)\nif not enterprise_data:\n return None\nreturn enterprise_data", "enterprise_in_url = request.parser_context.get('kwargs', {}).get('enterprise_id', '')\nif 'enterprises_with_access'...
<|body_start_0|> enterprise_client = EnterpriseApiClient(auth_token) enterprise_data = enterprise_client.get_with_access_to(user, enterprise_id) if not enterprise_data: return None return enterprise_data <|end_body_0|> <|body_start_1|> enterprise_in_url = request.par...
Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise.
HasDataAPIDjangoGroupAccess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HasDataAPIDjangoGroupAccess: """Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise.""" def get_enterprise_with_access_to(self, auth_token, user, enterprise_id): """Get...
stack_v2_sparse_classes_36k_train_008965
4,847
no_license
[ { "docstring": "Get the enterprise customer data that the user has enterprise_data_api access to. Returns: enterprise or None if unable to get or user is not associated with an enterprise", "name": "get_enterprise_with_access_to", "signature": "def get_enterprise_with_access_to(self, auth_token, user, e...
2
stack_v2_sparse_classes_30k_train_011901
Implement the Python class `HasDataAPIDjangoGroupAccess` described below. Class description: Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise. Method signatures and docstrings: - def get_enterprise_w...
Implement the Python class `HasDataAPIDjangoGroupAccess` described below. Class description: Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise. Method signatures and docstrings: - def get_enterprise_w...
d16a25b035b2e810b8ab2b0a2ac032b216562e26
<|skeleton|> class HasDataAPIDjangoGroupAccess: """Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise.""" def get_enterprise_with_access_to(self, auth_token, user, enterprise_id): """Get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HasDataAPIDjangoGroupAccess: """Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise.""" def get_enterprise_with_access_to(self, auth_token, user, enterprise_id): """Get the enterpri...
the_stack_v2_python_sparse
edx/app/analytics_api/venvs/analytics_api/lib/python2.7/site-packages/enterprise_data/permissions.py
JosiahKennedy/openedx-branded
train
0
43bc742e88650eb5c8cbe3c29336985cf2a8c8c7
[ "super(KNNDist, self).__init__()\nself.k = k\nself.alpha = alpha", "B, K = pc.shape[:2]\npc = pc.transpose(2, 1)\ninner = -2.0 * torch.matmul(pc.transpose(2, 1), pc)\nxx = torch.sum(pc ** 2, dim=1, keepdim=True)\ndist = xx + inner + xx.transpose(2, 1)\nassert dist.min().item() >= -1e-06\nneg_value, _ = (-dist).to...
<|body_start_0|> super(KNNDist, self).__init__() self.k = k self.alpha = alpha <|end_body_0|> <|body_start_1|> B, K = pc.shape[:2] pc = pc.transpose(2, 1) inner = -2.0 * torch.matmul(pc.transpose(2, 1), pc) xx = torch.sum(pc ** 2, dim=1, keepdim=True) dis...
KNNDist
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KNNDist: def __init__(self, k=5, alpha=1.05): """Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.""" <|body_0|> def forward(self, pc, wei...
stack_v2_sparse_classes_36k_train_008966
11,583
permissive
[ { "docstring": "Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.", "name": "__init__", "signature": "def __init__(self, k=5, alpha=1.05)" }, { "docstring": "K...
2
stack_v2_sparse_classes_30k_train_011021
Implement the Python class `KNNDist` described below. Class description: Implement the KNNDist class. Method signatures and docstrings: - def __init__(self, k=5, alpha=1.05): Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): thresh...
Implement the Python class `KNNDist` described below. Class description: Implement the KNNDist class. Method signatures and docstrings: - def __init__(self, k=5, alpha=1.05): Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): thresh...
4e2462b66fa1eac90cfbf61fa0dc635d223fdf2f
<|skeleton|> class KNNDist: def __init__(self, k=5, alpha=1.05): """Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.""" <|body_0|> def forward(self, pc, wei...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KNNDist: def __init__(self, k=5, alpha=1.05): """Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.""" super(KNNDist, self).__init__() self.k = k ...
the_stack_v2_python_sparse
baselines/attack/util/dist_utils.py
code-roamer/IF-Defense
train
0
4c4cdde8d51657a733b6cadd0cbfae3f28cff9db
[ "path = os.path.join(settings.data_path, settings.DATA['file_name'])\ntest_data = read_test_data.ReadExcel().read_sheet(path, sheet)\nreturn test_data", "log_path = os.path.join(settings.test_log_path, settings.LOG['log_file'])\nlogger = test_log.get_log(name=settings.LOG['name'], level=settings.LOG['level'], log...
<|body_start_0|> path = os.path.join(settings.data_path, settings.DATA['file_name']) test_data = read_test_data.ReadExcel().read_sheet(path, sheet) return test_data <|end_body_0|> <|body_start_1|> log_path = os.path.join(settings.test_log_path, settings.LOG['log_file']) logger =...
MiddleHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MiddleHandler: def get_test_data(self, sheet): """读取data.xlsx的结果""" <|body_0|> def log_init(self): """log初始化""" <|body_1|> <|end_skeleton|> <|body_start_0|> path = os.path.join(settings.data_path, settings.DATA['file_name']) test_data = read...
stack_v2_sparse_classes_36k_train_008967
875
no_license
[ { "docstring": "读取data.xlsx的结果", "name": "get_test_data", "signature": "def get_test_data(self, sheet)" }, { "docstring": "log初始化", "name": "log_init", "signature": "def log_init(self)" } ]
2
stack_v2_sparse_classes_30k_train_017100
Implement the Python class `MiddleHandler` described below. Class description: Implement the MiddleHandler class. Method signatures and docstrings: - def get_test_data(self, sheet): 读取data.xlsx的结果 - def log_init(self): log初始化
Implement the Python class `MiddleHandler` described below. Class description: Implement the MiddleHandler class. Method signatures and docstrings: - def get_test_data(self, sheet): 读取data.xlsx的结果 - def log_init(self): log初始化 <|skeleton|> class MiddleHandler: def get_test_data(self, sheet): """读取data.xl...
abd4671b88b650a3b21d63ea50ffd5f64578826f
<|skeleton|> class MiddleHandler: def get_test_data(self, sheet): """读取data.xlsx的结果""" <|body_0|> def log_init(self): """log初始化""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MiddleHandler: def get_test_data(self, sheet): """读取data.xlsx的结果""" path = os.path.join(settings.data_path, settings.DATA['file_name']) test_data = read_test_data.ReadExcel().read_sheet(path, sheet) return test_data def log_init(self): """log初始化""" log_path...
the_stack_v2_python_sparse
middle_handler/middlehandler.py
wyuuu1210/autotest
train
0
39b9ed870d57e9cdc81824e3afec72738b037014
[ "super(MMFasterRCNN, self).__init__()\ncfg = ConfigManager(cfg)\nlogger.info('===== BUILDING MODEL ======')\nself.featurizer = Featurizer(cfg)\nlogger.info(f'Built backbone {cfg.BACKBONE}')\nlogger.info('Building downstream components via shape testing')\nN, D, H, W = get_shape_info(self.featurizer.backbone, (1, 3,...
<|body_start_0|> super(MMFasterRCNN, self).__init__() cfg = ConfigManager(cfg) logger.info('===== BUILDING MODEL ======') self.featurizer = Featurizer(cfg) logger.info(f'Built backbone {cfg.BACKBONE}') logger.info('Building downstream components via shape testing') ...
MMFasterRCNN
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MMFasterRCNN: def __init__(self, cfg): """Initialize a MMFasterRCNN network :param cfg: configuration file path for the network, see model configs""" <|body_0|> def forward(self, input_windows, neighbor_windows, radii, angles, colors, proposals, device): """Process a...
stack_v2_sparse_classes_36k_train_008968
3,533
permissive
[ { "docstring": "Initialize a MMFasterRCNN network :param cfg: configuration file path for the network, see model configs", "name": "__init__", "signature": "def __init__(self, cfg)" }, { "docstring": "Process an Image through the network :param input_windows: Tensor representing target window pi...
3
null
Implement the Python class `MMFasterRCNN` described below. Class description: Implement the MMFasterRCNN class. Method signatures and docstrings: - def __init__(self, cfg): Initialize a MMFasterRCNN network :param cfg: configuration file path for the network, see model configs - def forward(self, input_windows, neigh...
Implement the Python class `MMFasterRCNN` described below. Class description: Implement the MMFasterRCNN class. Method signatures and docstrings: - def __init__(self, cfg): Initialize a MMFasterRCNN network :param cfg: configuration file path for the network, see model configs - def forward(self, input_windows, neigh...
5ed4a4c149e03773690668437d2f93aa532453c6
<|skeleton|> class MMFasterRCNN: def __init__(self, cfg): """Initialize a MMFasterRCNN network :param cfg: configuration file path for the network, see model configs""" <|body_0|> def forward(self, input_windows, neighbor_windows, radii, angles, colors, proposals, device): """Process a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MMFasterRCNN: def __init__(self, cfg): """Initialize a MMFasterRCNN network :param cfg: configuration file path for the network, see model configs""" super(MMFasterRCNN, self).__init__() cfg = ConfigManager(cfg) logger.info('===== BUILDING MODEL ======') self.featurizer...
the_stack_v2_python_sparse
cosmos/ingestion/ingest/process/detection/src/torch_model/model/model.py
UW-COSMOS/Cosmos
train
39
e21a20afbea56534d5163025dc7f9af39c5520cd
[ "super().__init__()\naction_latent_features = 128\nif action_converter.is_singular_discrete:\n self.action_encoder = nn.Embedding(action_converter.shape[0], action_latent_features)\nelse:\n self.action_encoder = nn.Linear(action_converter.shape[0], action_latent_features)\nself.hidden = nn.Sequential(nn.Linea...
<|body_start_0|> super().__init__() action_latent_features = 128 if action_converter.is_singular_discrete: self.action_encoder = nn.Embedding(action_converter.shape[0], action_latent_features) else: self.action_encoder = nn.Linear(action_converter.shape[0], action...
ForwardModel
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardModel: def __init__(self, action_converter: ActionSpace, state_latent_features: int): """:param action_converter: :param state_latent_features:""" <|body_0|> def forward(self, state_latent: torch.Tensor, action: torch.Tensor) -> torch.Tensor: """:param state_l...
stack_v2_sparse_classes_36k_train_008969
8,668
permissive
[ { "docstring": ":param action_converter: :param state_latent_features:", "name": "__init__", "signature": "def __init__(self, action_converter: ActionSpace, state_latent_features: int)" }, { "docstring": ":param state_latent: :param action: :return:", "name": "forward", "signature": "def...
2
stack_v2_sparse_classes_30k_train_016635
Implement the Python class `ForwardModel` described below. Class description: Implement the ForwardModel class. Method signatures and docstrings: - def __init__(self, action_converter: ActionSpace, state_latent_features: int): :param action_converter: :param state_latent_features: - def forward(self, state_latent: to...
Implement the Python class `ForwardModel` described below. Class description: Implement the ForwardModel class. Method signatures and docstrings: - def __init__(self, action_converter: ActionSpace, state_latent_features: int): :param action_converter: :param state_latent_features: - def forward(self, state_latent: to...
21e3564696062b67151b013fd5e47df46cf44aa5
<|skeleton|> class ForwardModel: def __init__(self, action_converter: ActionSpace, state_latent_features: int): """:param action_converter: :param state_latent_features:""" <|body_0|> def forward(self, state_latent: torch.Tensor, action: torch.Tensor) -> torch.Tensor: """:param state_l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForwardModel: def __init__(self, action_converter: ActionSpace, state_latent_features: int): """:param action_converter: :param state_latent_features:""" super().__init__() action_latent_features = 128 if action_converter.is_singular_discrete: self.action_encoder = ...
the_stack_v2_python_sparse
neodroidagent/utilities/exploration/intrinsic_signals/torch_isp/curiosity/icm.py
sintefneodroid/agent
train
9
1b3e7f27d35d4cd44bcb551bb2488bde2c8c119a
[ "super(UserSettings, self).AssertBasePermission(mr)\nif not mr.auth.user_id:\n raise permissions.PermissionException('Anonymous users are not allowed to edit user settings')", "page_data = {'user_tab_mode': 'st3', 'logged_in_user_pb': template_helpers.PBProxy(mr.auth.user_pb), 'viewed_user': mr.auth.user_view,...
<|body_start_0|> super(UserSettings, self).AssertBasePermission(mr) if not mr.auth.user_id: raise permissions.PermissionException('Anonymous users are not allowed to edit user settings') <|end_body_0|> <|body_start_1|> page_data = {'user_tab_mode': 'st3', 'logged_in_user_pb': templa...
Shows a page with a simple form to edit user preferences.
UserSettings
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSettings: """Shows a page with a simple form to edit user preferences.""" def AssertBasePermission(self, mr): """Assert that the user has the permissions needed to view this page.""" <|body_0|> def GatherPageData(self, mr): """Build up a dictionary of data va...
stack_v2_sparse_classes_36k_train_008970
2,299
permissive
[ { "docstring": "Assert that the user has the permissions needed to view this page.", "name": "AssertBasePermission", "signature": "def AssertBasePermission(self, mr)" }, { "docstring": "Build up a dictionary of data values to use when rendering the page.", "name": "GatherPageData", "sign...
3
null
Implement the Python class `UserSettings` described below. Class description: Shows a page with a simple form to edit user preferences. Method signatures and docstrings: - def AssertBasePermission(self, mr): Assert that the user has the permissions needed to view this page. - def GatherPageData(self, mr): Build up a ...
Implement the Python class `UserSettings` described below. Class description: Shows a page with a simple form to edit user preferences. Method signatures and docstrings: - def AssertBasePermission(self, mr): Assert that the user has the permissions needed to view this page. - def GatherPageData(self, mr): Build up a ...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class UserSettings: """Shows a page with a simple form to edit user preferences.""" def AssertBasePermission(self, mr): """Assert that the user has the permissions needed to view this page.""" <|body_0|> def GatherPageData(self, mr): """Build up a dictionary of data va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSettings: """Shows a page with a simple form to edit user preferences.""" def AssertBasePermission(self, mr): """Assert that the user has the permissions needed to view this page.""" super(UserSettings, self).AssertBasePermission(mr) if not mr.auth.user_id: raise p...
the_stack_v2_python_sparse
appengine/monorail/sitewide/usersettings.py
xinghun61/infra
train
2
c2bc0651b395535a5535f985ac288ef282f7f7e2
[ "date_time = dfdatetime_time_elements.TimeElementsInMilliseconds()\ntry:\n date_time.CopyFromDateTimeString(date_time_string)\nexcept ValueError:\n raise errors.ParseError('Unsupported date and time string: {0!s}'.format(date_time_string))\nreturn date_time", "if len(row) < self._MINIMUM_NUMBER_OF_COLUMNS:\...
<|body_start_0|> date_time = dfdatetime_time_elements.TimeElementsInMilliseconds() try: date_time.CopyFromDateTimeString(date_time_string) except ValueError: raise errors.ParseError('Unsupported date and time string: {0!s}'.format(date_time_string)) return date_ti...
Shared code for parsing Program Compatibility Assistant (PCA) log files.
WindowsPCABaseParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsPCABaseParser: """Shared code for parsing Program Compatibility Assistant (PCA) log files.""" def _ParseDateTime(self, date_time_string): """Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: da...
stack_v2_sparse_classes_36k_train_008971
5,467
permissive
[ { "docstring": "Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: date and time value. Raises: ParseError: if a valid date and time value cannot be derived from the time elements.", "name": "_ParseDateTime", "signature":...
2
null
Implement the Python class `WindowsPCABaseParser` described below. Class description: Shared code for parsing Program Compatibility Assistant (PCA) log files. Method signatures and docstrings: - def _ParseDateTime(self, date_time_string): Parses date and time elements of a log line. Args: date_time_string (string): d...
Implement the Python class `WindowsPCABaseParser` described below. Class description: Shared code for parsing Program Compatibility Assistant (PCA) log files. Method signatures and docstrings: - def _ParseDateTime(self, date_time_string): Parses date and time elements of a log line. Args: date_time_string (string): d...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class WindowsPCABaseParser: """Shared code for parsing Program Compatibility Assistant (PCA) log files.""" def _ParseDateTime(self, date_time_string): """Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowsPCABaseParser: """Shared code for parsing Program Compatibility Assistant (PCA) log files.""" def _ParseDateTime(self, date_time_string): """Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: date and time v...
the_stack_v2_python_sparse
plaso/parsers/winpca.py
log2timeline/plaso
train
1,506
9fddf09f3eb4f7f344d45d8d5714b720e817d9cb
[ "self.master_unit = master_unit\nself.target_position = target_position\nself._identity = identity\nself._set_external_identity = set_external_identity\nself.set_identity(self._identity)", "self._identity = identity\nif self._set_external_identity is not None:\n self._set_external_identity(self._identity)" ]
<|body_start_0|> self.master_unit = master_unit self.target_position = target_position self._identity = identity self._set_external_identity = set_external_identity self.set_identity(self._identity) <|end_body_0|> <|body_start_1|> self._identity = identity if sel...
Container for data about robot's position in formation.
Configurator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configurator: """Container for data about robot's position in formation.""" def __init__(self, master_unit, target_position, identity, set_external_identity=None): """Parameters ---------- master_unit : Any ID of master unit. It has to be compatible with locator. target_position : (d...
stack_v2_sparse_classes_36k_train_008972
1,612
permissive
[ { "docstring": "Parameters ---------- master_unit : Any ID of master unit. It has to be compatible with locator. target_position : (double, double) Target position relative to master unit. First field is distance, second is angle. identity : Any ID of robot. It has to be compatible with locator. set_external_id...
2
stack_v2_sparse_classes_30k_train_007209
Implement the Python class `Configurator` described below. Class description: Container for data about robot's position in formation. Method signatures and docstrings: - def __init__(self, master_unit, target_position, identity, set_external_identity=None): Parameters ---------- master_unit : Any ID of master unit. I...
Implement the Python class `Configurator` described below. Class description: Container for data about robot's position in formation. Method signatures and docstrings: - def __init__(self, master_unit, target_position, identity, set_external_identity=None): Parameters ---------- master_unit : Any ID of master unit. I...
81820b35dab10b14f58d66079b0a8f82ef819bee
<|skeleton|> class Configurator: """Container for data about robot's position in formation.""" def __init__(self, master_unit, target_position, identity, set_external_identity=None): """Parameters ---------- master_unit : Any ID of master unit. It has to be compatible with locator. target_position : (d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Configurator: """Container for data about robot's position in formation.""" def __init__(self, master_unit, target_position, identity, set_external_identity=None): """Parameters ---------- master_unit : Any ID of master unit. It has to be compatible with locator. target_position : (double, double...
the_stack_v2_python_sparse
mrc/configuration/configurator.py
Lukasz1928/mobile-robots-control
train
2
566425f72b89d3774592112a96d59f00997f63ba
[ "options = webdriver.ChromeOptions()\noptions.add_argument('headless')\noptions.add_argument('window-size=1920x1080')\noptions.add_argument('disable-gpu')\noptions.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36')\nop...
<|body_start_0|> options = webdriver.ChromeOptions() options.add_argument('headless') options.add_argument('window-size=1920x1080') options.add_argument('disable-gpu') options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like...
GetUsePoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetUsePoint: def get_selenium_driver(self): """Selenium Option을 설정하고 드라이버를 리턴""" <|body_0|> def make_dirs(self): """site-images 폴더가 없다면 생성""" <|body_1|> def download_images(self, img_url, img_path): """이미지를 다운받는 함수""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k_train_008973
1,410
no_license
[ { "docstring": "Selenium Option을 설정하고 드라이버를 리턴", "name": "get_selenium_driver", "signature": "def get_selenium_driver(self)" }, { "docstring": "site-images 폴더가 없다면 생성", "name": "make_dirs", "signature": "def make_dirs(self)" }, { "docstring": "이미지를 다운받는 함수", "name": "download...
3
stack_v2_sparse_classes_30k_train_007914
Implement the Python class `GetUsePoint` described below. Class description: Implement the GetUsePoint class. Method signatures and docstrings: - def get_selenium_driver(self): Selenium Option을 설정하고 드라이버를 리턴 - def make_dirs(self): site-images 폴더가 없다면 생성 - def download_images(self, img_url, img_path): 이미지를 다운받는 함수
Implement the Python class `GetUsePoint` described below. Class description: Implement the GetUsePoint class. Method signatures and docstrings: - def get_selenium_driver(self): Selenium Option을 설정하고 드라이버를 리턴 - def make_dirs(self): site-images 폴더가 없다면 생성 - def download_images(self, img_url, img_path): 이미지를 다운받는 함수 <|...
36b870d85ef43325713cac4fdebdcb476aac082c
<|skeleton|> class GetUsePoint: def get_selenium_driver(self): """Selenium Option을 설정하고 드라이버를 리턴""" <|body_0|> def make_dirs(self): """site-images 폴더가 없다면 생성""" <|body_1|> def download_images(self, img_url, img_path): """이미지를 다운받는 함수""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetUsePoint: def get_selenium_driver(self): """Selenium Option을 설정하고 드라이버를 리턴""" options = webdriver.ChromeOptions() options.add_argument('headless') options.add_argument('window-size=1920x1080') options.add_argument('disable-gpu') options.add_argument('user-age...
the_stack_v2_python_sparse
app/use_point/management/commands/_private.py
AsheKR/HappyMoney-backend
train
0
3e6f32a588102959ab0fe0f4a52a48c8a835e990
[ "conn = serial_asyncio.open_serial_connection(**self.serial_settings)\nreader, _ = await conn\nwhile True:\n data = await reader.readline()\n self.telegram_buffer.append(data.decode('ascii'))\n for telegram in self.telegram_buffer.get_all():\n try:\n queue.put_nowait(self.telegram_parser....
<|body_start_0|> conn = serial_asyncio.open_serial_connection(**self.serial_settings) reader, _ = await conn while True: data = await reader.readline() self.telegram_buffer.append(data.decode('ascii')) for telegram in self.telegram_buffer.get_all(): ...
Serial reader using asyncio pyserial.
AsyncSerialReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncSerialReader: """Serial reader using asyncio pyserial.""" async def read(self, queue): """Read complete DSMR telegram's from the serial interface and parse it into CosemObject's and MbusObject's. Instead of being a generator, values are pushed to provided queue for asynchronous ...
stack_v2_sparse_classes_36k_train_008974
4,520
permissive
[ { "docstring": "Read complete DSMR telegram's from the serial interface and parse it into CosemObject's and MbusObject's. Instead of being a generator, values are pushed to provided queue for asynchronous processing. :rtype: None", "name": "read", "signature": "async def read(self, queue)" }, { ...
2
stack_v2_sparse_classes_30k_train_011644
Implement the Python class `AsyncSerialReader` described below. Class description: Serial reader using asyncio pyserial. Method signatures and docstrings: - async def read(self, queue): Read complete DSMR telegram's from the serial interface and parse it into CosemObject's and MbusObject's. Instead of being a generat...
Implement the Python class `AsyncSerialReader` described below. Class description: Serial reader using asyncio pyserial. Method signatures and docstrings: - async def read(self, queue): Read complete DSMR telegram's from the serial interface and parse it into CosemObject's and MbusObject's. Instead of being a generat...
88923622a916877cf264de2b849bba0b94c3a347
<|skeleton|> class AsyncSerialReader: """Serial reader using asyncio pyserial.""" async def read(self, queue): """Read complete DSMR telegram's from the serial interface and parse it into CosemObject's and MbusObject's. Instead of being a generator, values are pushed to provided queue for asynchronous ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncSerialReader: """Serial reader using asyncio pyserial.""" async def read(self, queue): """Read complete DSMR telegram's from the serial interface and parse it into CosemObject's and MbusObject's. Instead of being a generator, values are pushed to provided queue for asynchronous processing. :...
the_stack_v2_python_sparse
dsmr_parser/clients/serial_.py
ndokter/dsmr_parser
train
105
a8904f2c319ee5ca143ec31fb7a53c891df28290
[ "result = {'result': 'NG'}\nctrl_obj = CtrlGroup()\ncontent = ctrl_obj.get_groups(group_name)\nif content:\n result['result'] = 'OK'\n result['content'] = content\nreturn result", "json_data = request.get_json(force=True)\nctrl_obj = CtrlGroup()\nresult = {'result': 'NG', 'error': ''}\ntry:\n ctrl_obj.ad...
<|body_start_0|> result = {'result': 'NG'} ctrl_obj = CtrlGroup() content = ctrl_obj.get_groups(group_name) if content: result['result'] = 'OK' result['content'] = content return result <|end_body_0|> <|body_start_1|> json_data = request.get_json(...
ApiGroup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiGroup: def get(self, group_name=None): """获取组的信息 :param group_name: :return:""" <|body_0|> def post(self): """新增组 :return:""" <|body_1|> def put(self): """修改组信息 :return:""" <|body_2|> def delete(self, group_id): """删除组 :pa...
stack_v2_sparse_classes_36k_train_008975
5,041
no_license
[ { "docstring": "获取组的信息 :param group_name: :return:", "name": "get", "signature": "def get(self, group_name=None)" }, { "docstring": "新增组 :return:", "name": "post", "signature": "def post(self)" }, { "docstring": "修改组信息 :return:", "name": "put", "signature": "def put(self)...
4
stack_v2_sparse_classes_30k_train_012000
Implement the Python class `ApiGroup` described below. Class description: Implement the ApiGroup class. Method signatures and docstrings: - def get(self, group_name=None): 获取组的信息 :param group_name: :return: - def post(self): 新增组 :return: - def put(self): 修改组信息 :return: - def delete(self, group_id): 删除组 :param group_i...
Implement the Python class `ApiGroup` described below. Class description: Implement the ApiGroup class. Method signatures and docstrings: - def get(self, group_name=None): 获取组的信息 :param group_name: :return: - def post(self): 新增组 :return: - def put(self): 修改组信息 :return: - def delete(self, group_id): 删除组 :param group_i...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiGroup: def get(self, group_name=None): """获取组的信息 :param group_name: :return:""" <|body_0|> def post(self): """新增组 :return:""" <|body_1|> def put(self): """修改组信息 :return:""" <|body_2|> def delete(self, group_id): """删除组 :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiGroup: def get(self, group_name=None): """获取组的信息 :param group_name: :return:""" result = {'result': 'NG'} ctrl_obj = CtrlGroup() content = ctrl_obj.get_groups(group_name) if content: result['result'] = 'OK' result['content'] = content ...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_group_members.py
lsn1183/web_project
train
0
b03ccf1b0e8d9d2df0b3bd90204089ab1d592506
[ "super(Basic, self).__init__()\nself.cfg = cfg\nself.agent = agent\nself.policy_net = build_policy(cfg, self.agent)\nself.agent.unwrapped.policy_net = self.policy_net\nself.dynamics_block = mj_torch_block_factory(agent, 'dynamics').apply\nself.reward_block = mj_torch_block_factory(agent, 'reward').apply", "action...
<|body_start_0|> super(Basic, self).__init__() self.cfg = cfg self.agent = agent self.policy_net = build_policy(cfg, self.agent) self.agent.unwrapped.policy_net = self.policy_net self.dynamics_block = mj_torch_block_factory(agent, 'dynamics').apply self.reward_blo...
Basic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Basic: def __init__(self, cfg, agent): """Build the model from the fed config node. :param cfg: CfgNode containing the configurations of everything.""" <|body_0|> def forward(self, state): """Single pass. :param state: :return:""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_008976
1,643
no_license
[ { "docstring": "Build the model from the fed config node. :param cfg: CfgNode containing the configurations of everything.", "name": "__init__", "signature": "def __init__(self, cfg, agent)" }, { "docstring": "Single pass. :param state: :return:", "name": "forward", "signature": "def for...
2
stack_v2_sparse_classes_30k_val_000416
Implement the Python class `Basic` described below. Class description: Implement the Basic class. Method signatures and docstrings: - def __init__(self, cfg, agent): Build the model from the fed config node. :param cfg: CfgNode containing the configurations of everything. - def forward(self, state): Single pass. :par...
Implement the Python class `Basic` described below. Class description: Implement the Basic class. Method signatures and docstrings: - def __init__(self, cfg, agent): Build the model from the fed config node. :param cfg: CfgNode containing the configurations of everything. - def forward(self, state): Single pass. :par...
b7d69c3bea44748411b259ddda1b7e9bb42985e0
<|skeleton|> class Basic: def __init__(self, cfg, agent): """Build the model from the fed config node. :param cfg: CfgNode containing the configurations of everything.""" <|body_0|> def forward(self, state): """Single pass. :param state: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Basic: def __init__(self, cfg, agent): """Build the model from the fed config node. :param cfg: CfgNode containing the configurations of everything.""" super(Basic, self).__init__() self.cfg = cfg self.agent = agent self.policy_net = build_policy(cfg, self.agent) ...
the_stack_v2_python_sparse
model/archs/basic.py
btilmon/Model-Based-RL
train
0
5dbcada26174abe15d3fab2e2fa678c1c8888d83
[ "super().__init__(config or {}, *args, config_key=config_key, **kwargs)\nself.yes = yes\nself.no = no\nself.hide_value = hide_value", "result = self.yes if str(value).lower() in self.yes_values else self.no\nif result == self.hide_value:\n return None\nreturn super().handle(result, context) if self.mapping els...
<|body_start_0|> super().__init__(config or {}, *args, config_key=config_key, **kwargs) self.yes = yes self.no = no self.hide_value = hide_value <|end_body_0|> <|body_start_1|> result = self.yes if str(value).lower() in self.yes_values else self.no if result == self.hide...
Yes or No handler.
YesNo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YesNo: """Yes or No handler.""" def __init__(self, *args: str, yes=True, no=False, hide_value=None, config: typing.Optional[typing.Mapping[str, typing.Mapping]]=None, config_key: typing.Optional[str]=None, **kwargs): """Init method.""" <|body_0|> def handle(self, value, ...
stack_v2_sparse_classes_36k_train_008977
4,580
permissive
[ { "docstring": "Init method.", "name": "__init__", "signature": "def __init__(self, *args: str, yes=True, no=False, hide_value=None, config: typing.Optional[typing.Mapping[str, typing.Mapping]]=None, config_key: typing.Optional[str]=None, **kwargs)" }, { "docstring": "Handle boolean values.", ...
2
stack_v2_sparse_classes_30k_train_009209
Implement the Python class `YesNo` described below. Class description: Yes or No handler. Method signatures and docstrings: - def __init__(self, *args: str, yes=True, no=False, hide_value=None, config: typing.Optional[typing.Mapping[str, typing.Mapping]]=None, config_key: typing.Optional[str]=None, **kwargs): Init me...
Implement the Python class `YesNo` described below. Class description: Yes or No handler. Method signatures and docstrings: - def __init__(self, *args: str, yes=True, no=False, hide_value=None, config: typing.Optional[typing.Mapping[str, typing.Mapping]]=None, config_key: typing.Optional[str]=None, **kwargs): Init me...
00909d2c47d158bfeac300e1d7477c4f87c52096
<|skeleton|> class YesNo: """Yes or No handler.""" def __init__(self, *args: str, yes=True, no=False, hide_value=None, config: typing.Optional[typing.Mapping[str, typing.Mapping]]=None, config_key: typing.Optional[str]=None, **kwargs): """Init method.""" <|body_0|> def handle(self, value, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class YesNo: """Yes or No handler.""" def __init__(self, *args: str, yes=True, no=False, hide_value=None, config: typing.Optional[typing.Mapping[str, typing.Mapping]]=None, config_key: typing.Optional[str]=None, **kwargs): """Init method.""" super().__init__(config or {}, *args, config_key=conf...
the_stack_v2_python_sparse
knowit/properties/general.py
ratoaq2/knowit
train
27
f75fcb224e5b2562f7f0a73d60a59430b7b0ef59
[ "if not callable(self.val):\n raise TypeError('val must be callable')\nif not issubclass(ex, BaseException):\n raise TypeError('given arg must be exception')\nreturn self.builder(self.val, self.description, self.kind, ex)", "if not self.expected:\n raise TypeError('expected exception not set, raises() mu...
<|body_start_0|> if not callable(self.val): raise TypeError('val must be callable') if not issubclass(ex, BaseException): raise TypeError('given arg must be exception') return self.builder(self.val, self.description, self.kind, ex) <|end_body_0|> <|body_start_1|> ...
Expected exception mixin.
ExceptionMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExceptionMixin: """Expected exception mixin.""" def raises(self, ex): """Asserts that val is callable and set the expected exception. Just sets the expected exception, but never calls val, and therefore never failes. You must chain to :meth:`~when_called_with` to invoke ``val()``. Ar...
stack_v2_sparse_classes_36k_train_008978
4,692
permissive
[ { "docstring": "Asserts that val is callable and set the expected exception. Just sets the expected exception, but never calls val, and therefore never failes. You must chain to :meth:`~when_called_with` to invoke ``val()``. Args: ex: the expected exception Examples: Usage:: assert_that(some_func).raises(Runtim...
2
stack_v2_sparse_classes_30k_train_008342
Implement the Python class `ExceptionMixin` described below. Class description: Expected exception mixin. Method signatures and docstrings: - def raises(self, ex): Asserts that val is callable and set the expected exception. Just sets the expected exception, but never calls val, and therefore never failes. You must c...
Implement the Python class `ExceptionMixin` described below. Class description: Expected exception mixin. Method signatures and docstrings: - def raises(self, ex): Asserts that val is callable and set the expected exception. Just sets the expected exception, but never calls val, and therefore never failes. You must c...
4f830045d78004946db562536b0c875b1a2180c4
<|skeleton|> class ExceptionMixin: """Expected exception mixin.""" def raises(self, ex): """Asserts that val is callable and set the expected exception. Just sets the expected exception, but never calls val, and therefore never failes. You must chain to :meth:`~when_called_with` to invoke ``val()``. Ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExceptionMixin: """Expected exception mixin.""" def raises(self, ex): """Asserts that val is callable and set the expected exception. Just sets the expected exception, but never calls val, and therefore never failes. You must chain to :meth:`~when_called_with` to invoke ``val()``. Args: ex: the e...
the_stack_v2_python_sparse
assertpy/exception.py
assertpy/assertpy
train
222
cbf9cb914cdf007e086f81c14499767dc7b0bfdb
[ "obj = convert_array(array).view(cls)\nobj.VTKObject = array\nobj.table = _vtk.vtkWeakReference()\nobj.table.Set(table)\nreturn obj", "_vtk.VTKArray.__array_finalize__(self, obj)\nif np.shares_memory(self, obj):\n self.table = getattr(obj, 'table', None)\n self.VTKObject = getattr(obj, 'VTKObject', None)\ne...
<|body_start_0|> obj = convert_array(array).view(cls) obj.VTKObject = array obj.table = _vtk.vtkWeakReference() obj.table.Set(table) return obj <|end_body_0|> <|body_start_1|> _vtk.VTKArray.__array_finalize__(self, obj) if np.shares_memory(self, obj): ...
An ndarray which references the owning table and the underlying vtkArray. This class is used to ensure that the internal vtkLookupTable updates when the values array is updated.
lookup_table_ndarray
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lookup_table_ndarray: """An ndarray which references the owning table and the underlying vtkArray. This class is used to ensure that the internal vtkLookupTable updates when the values array is updated.""" def __new__(cls, array, table=None): """Allocate the array.""" <|body_...
stack_v2_sparse_classes_36k_train_008979
34,948
permissive
[ { "docstring": "Allocate the array.", "name": "__new__", "signature": "def __new__(cls, array, table=None)" }, { "docstring": "Finalize array (associate with parent metadata).", "name": "__array_finalize__", "signature": "def __array_finalize__(self, obj)" }, { "docstring": "Impl...
4
null
Implement the Python class `lookup_table_ndarray` described below. Class description: An ndarray which references the owning table and the underlying vtkArray. This class is used to ensure that the internal vtkLookupTable updates when the values array is updated. Method signatures and docstrings: - def __new__(cls, a...
Implement the Python class `lookup_table_ndarray` described below. Class description: An ndarray which references the owning table and the underlying vtkArray. This class is used to ensure that the internal vtkLookupTable updates when the values array is updated. Method signatures and docstrings: - def __new__(cls, a...
1b450b23340f367315fc914075d551e0a4df8cc3
<|skeleton|> class lookup_table_ndarray: """An ndarray which references the owning table and the underlying vtkArray. This class is used to ensure that the internal vtkLookupTable updates when the values array is updated.""" def __new__(cls, array, table=None): """Allocate the array.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lookup_table_ndarray: """An ndarray which references the owning table and the underlying vtkArray. This class is used to ensure that the internal vtkLookupTable updates when the values array is updated.""" def __new__(cls, array, table=None): """Allocate the array.""" obj = convert_array(...
the_stack_v2_python_sparse
pyvista/plotting/lookup_table.py
pyvista/pyvista
train
1,885
03d529ce12700fdafae2f792bb8b44968fe53cab
[ "embed_url = None\nyoutube_embed_url = 'https://www.youtube.com/embed/{}'\nvimeo_embed_url = 'https://player.vimeo.com/video/{}'\nif re.match(YOUTUBE_URL_RE, self.url):\n embed_url = youtube_embed_url.format(re.match(YOUTUBE_URL_RE, self.url).group(2))\nif re.match(VIMEO_URL_RE, self.url):\n embed_url = vimeo...
<|body_start_0|> embed_url = None youtube_embed_url = 'https://www.youtube.com/embed/{}' vimeo_embed_url = 'https://player.vimeo.com/video/{}' if re.match(YOUTUBE_URL_RE, self.url): embed_url = youtube_embed_url.format(re.match(YOUTUBE_URL_RE, self.url).group(2)) if r...
Video
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Video: def get_embed_url(self): """Get correct embed url for Youtube or Vimeo.""" <|body_0|> def save(self, force_insert=False, force_update=False, using=None, update_fields=None): """Set html field with correct iframe.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_008980
1,528
permissive
[ { "docstring": "Get correct embed url for Youtube or Vimeo.", "name": "get_embed_url", "signature": "def get_embed_url(self)" }, { "docstring": "Set html field with correct iframe.", "name": "save", "signature": "def save(self, force_insert=False, force_update=False, using=None, update_f...
2
stack_v2_sparse_classes_30k_train_018679
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def get_embed_url(self): Get correct embed url for Youtube or Vimeo. - def save(self, force_insert=False, force_update=False, using=None, update_fields=None): Set html field with corre...
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def get_embed_url(self): Get correct embed url for Youtube or Vimeo. - def save(self, force_insert=False, force_update=False, using=None, update_fields=None): Set html field with corre...
b9b0a3d8b49d5d9b840656f84564ba0a6e016f98
<|skeleton|> class Video: def get_embed_url(self): """Get correct embed url for Youtube or Vimeo.""" <|body_0|> def save(self, force_insert=False, force_update=False, using=None, update_fields=None): """Set html field with correct iframe.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Video: def get_embed_url(self): """Get correct embed url for Youtube or Vimeo.""" embed_url = None youtube_embed_url = 'https://www.youtube.com/embed/{}' vimeo_embed_url = 'https://player.vimeo.com/video/{}' if re.match(YOUTUBE_URL_RE, self.url): embed_url =...
the_stack_v2_python_sparse
glitter/blocks/video/models.py
developersociety/django-glitter
train
3
f5b603fbc7175286e8c21c1ad03fa3ed870cf7fc
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('gasparde_ljmcgann', 'gasparde_ljmcgann')\ncrimes = repo.gasparde_ljmcgann.crimes\nfor data in crimes.find():\n GeoLocation = Point(data['location'])\n neighBorhood = [neighborhood['Name'] for neigh...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('gasparde_ljmcgann', 'gasparde_ljmcgann') crimes = repo.gasparde_ljmcgann.crimes for data in crimes.find(): GeoLocation = Point(data['l...
crimeNeighborhood
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class crimeNeighborhood: 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 everyt...
stack_v2_sparse_classes_36k_train_008981
4,427
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
null
Implement the Python class `crimeNeighborhood` described below. Class description: Implement the crimeNeighborhood class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime...
Implement the Python class `crimeNeighborhood` described below. Class description: Implement the crimeNeighborhood class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class crimeNeighborhood: 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 everyt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class crimeNeighborhood: 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('gasparde_ljmcgann', 'gasparde_ljm...
the_stack_v2_python_sparse
gasparde_ljmcgann/crimeNeighborhood.py
maximega/course-2019-spr-proj
train
2
8dfa800e5b3a51003d1289d75b35c24108b5c493
[ "self.type = kwargs.pop('type', None)\nself.serializer = kwargs.pop('serializer', None)\nself._serializer = None\nif not isinstance(self.serializer, str):\n self._serializer = self.serializer\nassert self.type or self.serializer, 'JSONAPIRelationshipField must either specify a `type` or `serializer`.'\nsuper()._...
<|body_start_0|> self.type = kwargs.pop('type', None) self.serializer = kwargs.pop('serializer', None) self._serializer = None if not isinstance(self.serializer, str): self._serializer = self.serializer assert self.type or self.serializer, 'JSONAPIRelationshipField mu...
Extends PrimaryKeyRelatedField to support various JSON API operations. This looks to see if the relationship will be included as a related resource, and returns a :ResourceIdField: along with the related serializer. It also accesses the related resource's schema to identify the JSON API type.
JSONAPIRelationshipField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONAPIRelationshipField: """Extends PrimaryKeyRelatedField to support various JSON API operations. This looks to see if the relationship will be included as a related resource, and returns a :ResourceIdField: along with the related serializer. It also accesses the related resource's schema to id...
stack_v2_sparse_classes_36k_train_008982
4,253
permissive
[ { "docstring": "Create an object. kwargs must contain either a `type` or `serializer` parameter. :param kwargs: Relationship field parameters.", "name": "__init__", "signature": "def __init__(self, **kwargs: Any) -> None" }, { "docstring": "Decide whether to use pk only optimization.", "name...
5
stack_v2_sparse_classes_30k_train_013497
Implement the Python class `JSONAPIRelationshipField` described below. Class description: Extends PrimaryKeyRelatedField to support various JSON API operations. This looks to see if the relationship will be included as a related resource, and returns a :ResourceIdField: along with the related serializer. It also acces...
Implement the Python class `JSONAPIRelationshipField` described below. Class description: Extends PrimaryKeyRelatedField to support various JSON API operations. This looks to see if the relationship will be included as a related resource, and returns a :ResourceIdField: along with the related serializer. It also acces...
a7f4bddbaf55dbe68e9346005cf16442eb48024d
<|skeleton|> class JSONAPIRelationshipField: """Extends PrimaryKeyRelatedField to support various JSON API operations. This looks to see if the relationship will be included as a related resource, and returns a :ResourceIdField: along with the related serializer. It also accesses the related resource's schema to id...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONAPIRelationshipField: """Extends PrimaryKeyRelatedField to support various JSON API operations. This looks to see if the relationship will be included as a related resource, and returns a :ResourceIdField: along with the related serializer. It also accesses the related resource's schema to identify the JS...
the_stack_v2_python_sparse
rest_framework_json_schema/relations.py
paulcwatts/drf-json-schema
train
15
c6eaf6a3db319e9e138d71a77d7bd5f67da7aeb0
[ "self.session: Session = session\nself.event_types: Iterable[core_pb2.EventType] = event_types\nself.queue: Queue = Queue()\nself.add_handlers()", "if core_pb2.EventType.NODE in self.event_types:\n self.session.node_handlers.append(self.queue.put)\nif core_pb2.EventType.LINK in self.event_types:\n self.sess...
<|body_start_0|> self.session: Session = session self.event_types: Iterable[core_pb2.EventType] = event_types self.queue: Queue = Queue() self.add_handlers() <|end_body_0|> <|body_start_1|> if core_pb2.EventType.NODE in self.event_types: self.session.node_handlers.ap...
Processes session events to generate grpc events.
EventStreamer
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventStreamer: """Processes session events to generate grpc events.""" def __init__(self, session: Session, event_types: Iterable[core_pb2.EventType]) -> None: """Create a EventStreamer instance. :param session: session to process events for :param event_types: types of events to pro...
stack_v2_sparse_classes_36k_train_008983
7,519
permissive
[ { "docstring": "Create a EventStreamer instance. :param session: session to process events for :param event_types: types of events to process", "name": "__init__", "signature": "def __init__(self, session: Session, event_types: Iterable[core_pb2.EventType]) -> None" }, { "docstring": "Add a sess...
4
null
Implement the Python class `EventStreamer` described below. Class description: Processes session events to generate grpc events. Method signatures and docstrings: - def __init__(self, session: Session, event_types: Iterable[core_pb2.EventType]) -> None: Create a EventStreamer instance. :param session: session to proc...
Implement the Python class `EventStreamer` described below. Class description: Processes session events to generate grpc events. Method signatures and docstrings: - def __init__(self, session: Session, event_types: Iterable[core_pb2.EventType]) -> None: Create a EventStreamer instance. :param session: session to proc...
20071eed2e73a2287aa385698dd604f4933ae7ff
<|skeleton|> class EventStreamer: """Processes session events to generate grpc events.""" def __init__(self, session: Session, event_types: Iterable[core_pb2.EventType]) -> None: """Create a EventStreamer instance. :param session: session to process events for :param event_types: types of events to pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventStreamer: """Processes session events to generate grpc events.""" def __init__(self, session: Session, event_types: Iterable[core_pb2.EventType]) -> None: """Create a EventStreamer instance. :param session: session to process events for :param event_types: types of events to process""" ...
the_stack_v2_python_sparse
daemon/core/api/grpc/events.py
coreemu/core
train
606
43db75528a0ab1e0daf36efb161e70616ae17f6f
[ "if root is None:\n return []\ncolHash = {}\nself.bfsGetColumn(root, colHash)\nreturn [t[1] for t in sorted(colHash.iteritems())]", "hashTable.setdefault(col, []).append(node.val)\nif node.left is not None:\n self.dfsGetColumn(node.left, col - 1, hashTable)\nif node.right is not None:\n self.dfsGetColumn...
<|body_start_0|> if root is None: return [] colHash = {} self.bfsGetColumn(root, colHash) return [t[1] for t in sorted(colHash.iteritems())] <|end_body_0|> <|body_start_1|> hashTable.setdefault(col, []).append(node.val) if node.left is not None: s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def verticalOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def dfsGetColumn(self, node, col, hashTable): """:type node: TreeNode :type col: int, the column number for node""" <|body_1|> def bfsGetColumn(self, r...
stack_v2_sparse_classes_36k_train_008984
4,136
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "verticalOrder", "signature": "def verticalOrder(self, root)" }, { "docstring": ":type node: TreeNode :type col: int, the column number for node", "name": "dfsGetColumn", "signature": "def dfsGetColumn(self, node, col...
3
stack_v2_sparse_classes_30k_train_010173
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def verticalOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def dfsGetColumn(self, node, col, hashTable): :type node: TreeNode :type col: int, the column number...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def verticalOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def dfsGetColumn(self, node, col, hashTable): :type node: TreeNode :type col: int, the column number...
d2cbfb1022b1ee5bce8083c9940ba10320fc2d43
<|skeleton|> class Solution: def verticalOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def dfsGetColumn(self, node, col, hashTable): """:type node: TreeNode :type col: int, the column number for node""" <|body_1|> def bfsGetColumn(self, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def verticalOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if root is None: return [] colHash = {} self.bfsGetColumn(root, colHash) return [t[1] for t in sorted(colHash.iteritems())] def dfsGetColumn(self, node, col, has...
the_stack_v2_python_sparse
314_Vertical_Traverse_BTree/vTraverseBTree.py
VividLiu/LeeCode_Practice
train
1
33a82a1eb768ebabecd91cdc41e51f48ab21c6cc
[ "au = 'aeiou'\nm = len(au)\nself.ans = 0\n\ndef helper(s, start):\n if len(s) == n:\n self.ans += 1\n return\n for i in range(start, m):\n helper(s + au[i], i)\nhelper('', 0)\nreturn self.ans", "m = 5\nmemo = [[-1 for _ in range(n)] for _ in range(m)]\n\ndef helper(k, start):\n if k ...
<|body_start_0|> au = 'aeiou' m = len(au) self.ans = 0 def helper(s, start): if len(s) == n: self.ans += 1 return for i in range(start, m): helper(s + au[i], i) helper('', 0) return self.ans <|end_bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countVowelStrings(self, n): """:type n: int :rtype: int""" <|body_0|> def countVowelStringsMemo(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> au = 'aeiou' m = len(au) self.ans = 0...
stack_v2_sparse_classes_36k_train_008985
2,040
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "countVowelStrings", "signature": "def countVowelStrings(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "countVowelStringsMemo", "signature": "def countVowelStringsMemo(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countVowelStrings(self, n): :type n: int :rtype: int - def countVowelStringsMemo(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countVowelStrings(self, n): :type n: int :rtype: int - def countVowelStringsMemo(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def countVowelStrings(s...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def countVowelStrings(self, n): """:type n: int :rtype: int""" <|body_0|> def countVowelStringsMemo(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countVowelStrings(self, n): """:type n: int :rtype: int""" au = 'aeiou' m = len(au) self.ans = 0 def helper(s, start): if len(s) == n: self.ans += 1 return for i in range(start, m): h...
the_stack_v2_python_sparse
C/CountSortedVowelStrings.py
bssrdf/pyleet
train
2
a41e69dbc219275f93c39902dba2361cafa1b604
[ "self.username = username\nself.email = email\nself.password = bcrypt.generate_password_hash(password, current_app.config.get('BCRYPT_LOG_ROUNDS')).decode()\nself.created_at = created_at", "try:\n days = current_app.config.get('TOKEN_EXPIRATION_DAYS')\n seconds = current_app.config.get('TOKEN_EXPIRATION_SEC...
<|body_start_0|> self.username = username self.email = email self.password = bcrypt.generate_password_hash(password, current_app.config.get('BCRYPT_LOG_ROUNDS')).decode() self.created_at = created_at <|end_body_0|> <|body_start_1|> try: days = current_app.config.get(...
MetaGenScope User model.
User
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """MetaGenScope User model.""" def __init__(self, username, email, password, created_at=datetime.datetime.utcnow()): """Initialize MetaGenScope User model.""" <|body_0|> def encode_auth_token(cls, user_id): """Generate the auth token.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_008986
3,155
permissive
[ { "docstring": "Initialize MetaGenScope User model.", "name": "__init__", "signature": "def __init__(self, username, email, password, created_at=datetime.datetime.utcnow())" }, { "docstring": "Generate the auth token.", "name": "encode_auth_token", "signature": "def encode_auth_token(cls...
3
stack_v2_sparse_classes_30k_train_000545
Implement the Python class `User` described below. Class description: MetaGenScope User model. Method signatures and docstrings: - def __init__(self, username, email, password, created_at=datetime.datetime.utcnow()): Initialize MetaGenScope User model. - def encode_auth_token(cls, user_id): Generate the auth token. -...
Implement the Python class `User` described below. Class description: MetaGenScope User model. Method signatures and docstrings: - def __init__(self, username, email, password, created_at=datetime.datetime.utcnow()): Initialize MetaGenScope User model. - def encode_auth_token(cls, user_id): Generate the auth token. -...
609cd57c626c857c8efde8237a1f22f4d1e6065d
<|skeleton|> class User: """MetaGenScope User model.""" def __init__(self, username, email, password, created_at=datetime.datetime.utcnow()): """Initialize MetaGenScope User model.""" <|body_0|> def encode_auth_token(cls, user_id): """Generate the auth token.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: """MetaGenScope User model.""" def __init__(self, username, email, password, created_at=datetime.datetime.utcnow()): """Initialize MetaGenScope User model.""" self.username = username self.email = email self.password = bcrypt.generate_password_hash(password, current_...
the_stack_v2_python_sparse
app/users/user_models.py
MetaGenScope/metagenscope-server
train
0
e751118729eed74d92ecbb67d8c0ce81e348b972
[ "if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nself.color = dict(((node, None) for node in self.graph.iternodes()))\nfor edge in self.graph.iteredges():\n if edge.source == edge.target:\n raise ValueError('a loop detected')\nself.saturation = dict(((node, set(...
<|body_start_0|> if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph self.color = dict(((node, None) for node in self.graph.iternodes())) for edge in self.graph.iteredges(): if edge.source == edge.target: raise Valu...
Find a saturated largest first (SLF) node coloring. Computational complexity is O(V^2). Attributes ---------- graph : input undirected graph or multigraph color : dict with nodes (values are colors) Notes ----- Colors are 0, 1, 2, ...
SLFNodeColoring
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SLFNodeColoring: """Find a saturated largest first (SLF) node coloring. Computational complexity is O(V^2). Attributes ---------- graph : input undirected graph or multigraph color : dict with nodes (values are colors) Notes ----- Colors are 0, 1, 2, ...""" def __init__(self, graph): ...
stack_v2_sparse_classes_36k_train_008987
1,809
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self)" }, { "docstring": "Give node the smallest possible color.", "name": "_greedy_co...
3
stack_v2_sparse_classes_30k_train_009091
Implement the Python class `SLFNodeColoring` described below. Class description: Find a saturated largest first (SLF) node coloring. Computational complexity is O(V^2). Attributes ---------- graph : input undirected graph or multigraph color : dict with nodes (values are colors) Notes ----- Colors are 0, 1, 2, ... Me...
Implement the Python class `SLFNodeColoring` described below. Class description: Find a saturated largest first (SLF) node coloring. Computational complexity is O(V^2). Attributes ---------- graph : input undirected graph or multigraph color : dict with nodes (values are colors) Notes ----- Colors are 0, 1, 2, ... Me...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class SLFNodeColoring: """Find a saturated largest first (SLF) node coloring. Computational complexity is O(V^2). Attributes ---------- graph : input undirected graph or multigraph color : dict with nodes (values are colors) Notes ----- Colors are 0, 1, 2, ...""" def __init__(self, graph): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SLFNodeColoring: """Find a saturated largest first (SLF) node coloring. Computational complexity is O(V^2). Attributes ---------- graph : input undirected graph or multigraph color : dict with nodes (values are colors) Notes ----- Colors are 0, 1, 2, ...""" def __init__(self, graph): """The algor...
the_stack_v2_python_sparse
graphtheory/coloring/nodecolorslf.py
kgashok/graphs-dict
train
0
cb087d50974c918d07ba42b15f7f3f5e05f52eb5
[ "k = CArray.zeros(shape=(x.shape[0], self._rv.shape[0]))\nx_nd, rv_nd = (x.tondarray(), self._rv.tondarray())\nif x.shape[0] <= self._rv.shape[0]:\n for i in range(k.shape[0]):\n k[i, :] = CArray(np.minimum(x_nd[i, :], rv_nd).sum(axis=1))\nelse:\n for j in range(k.shape[1]):\n k[:, j] = CArray(n...
<|body_start_0|> k = CArray.zeros(shape=(x.shape[0], self._rv.shape[0])) x_nd, rv_nd = (x.tondarray(), self._rv.tondarray()) if x.shape[0] <= self._rv.shape[0]: for i in range(k.shape[0]): k[i, :] = CArray(np.minimum(x_nd[i, :], rv_nd).sum(axis=1)) else: ...
Histogram Intersection Kernel. Given matrices X and RV, this is computed by:: K(x, rv) = sum_i ( min(x[i], rv[i]) ) for each pair of rows in X and in RV. Attributes ---------- class_type : 'hist-intersect' Examples -------- >>> from secml.array import CArray >>> from secml.ml.kernels.c_kernel_histintersect import CKern...
CKernelHistIntersect
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CKernelHistIntersect: """Histogram Intersection Kernel. Given matrices X and RV, this is computed by:: K(x, rv) = sum_i ( min(x[i], rv[i]) ) for each pair of rows in X and in RV. Attributes ---------- class_type : 'hist-intersect' Examples -------- >>> from secml.array import CArray >>> from secm...
stack_v2_sparse_classes_36k_train_008988
3,623
permissive
[ { "docstring": "Compute the histogram intersection kernel between x and cached rv. Parameters ---------- x : CArray or array_like Array of shape (n_x, n_features). Returns ------- kernel : CArray Kernel between x and cached rv. Array of shape (n_x, n_rv).", "name": "_forward", "signature": "def _forward...
2
stack_v2_sparse_classes_30k_train_006748
Implement the Python class `CKernelHistIntersect` described below. Class description: Histogram Intersection Kernel. Given matrices X and RV, this is computed by:: K(x, rv) = sum_i ( min(x[i], rv[i]) ) for each pair of rows in X and in RV. Attributes ---------- class_type : 'hist-intersect' Examples -------- >>> from ...
Implement the Python class `CKernelHistIntersect` described below. Class description: Histogram Intersection Kernel. Given matrices X and RV, this is computed by:: K(x, rv) = sum_i ( min(x[i], rv[i]) ) for each pair of rows in X and in RV. Attributes ---------- class_type : 'hist-intersect' Examples -------- >>> from ...
431373e65d8cfe2cb7cf042ce1a6c9519ea5a14a
<|skeleton|> class CKernelHistIntersect: """Histogram Intersection Kernel. Given matrices X and RV, this is computed by:: K(x, rv) = sum_i ( min(x[i], rv[i]) ) for each pair of rows in X and in RV. Attributes ---------- class_type : 'hist-intersect' Examples -------- >>> from secml.array import CArray >>> from secm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CKernelHistIntersect: """Histogram Intersection Kernel. Given matrices X and RV, this is computed by:: K(x, rv) = sum_i ( min(x[i], rv[i]) ) for each pair of rows in X and in RV. Attributes ---------- class_type : 'hist-intersect' Examples -------- >>> from secml.array import CArray >>> from secml.ml.kernels....
the_stack_v2_python_sparse
src/secml/ml/kernels/c_kernel_histintersect.py
Cinofix/secml
train
0
f94b8702b2bdd4ff7731f6cd356025dd1625696e
[ "self.trade_days = trade_days\nself.trade_strategy = trade_strategy\nself.profit_array = []", "for ind, day in enumerate(self.trade_days):\n '\\n 以时间驱动,完成交易回测\\n '\n if hasattr(self.trade_strategy, 'buy_strategy'):\n self.trade_strategy.buy_strategy(ind, day, self.trade_days)\n ...
<|body_start_0|> self.trade_days = trade_days self.trade_strategy = trade_strategy self.profit_array = [] <|end_body_0|> <|body_start_1|> for ind, day in enumerate(self.trade_days): '\n 以时间驱动,完成交易回测\n ' if hasattr(self.trade_strategy, 'buy_s...
交易回测系统
TradeLoopBack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TradeLoopBack: """交易回测系统""" def __init__(self, trade_days, trade_strategy): """使用前面封装的StockTradeDays类和本节编写的交易策略类 TradeStrategyBase类初始化交易系统 :param trade_days: StockTradeDays交易数据序列 :param trade_strategy: TradeStrategyBase交易策略""" <|body_0|> def execute_trade(self): ...
stack_v2_sparse_classes_36k_train_008989
1,479
no_license
[ { "docstring": "使用前面封装的StockTradeDays类和本节编写的交易策略类 TradeStrategyBase类初始化交易系统 :param trade_days: StockTradeDays交易数据序列 :param trade_strategy: TradeStrategyBase交易策略", "name": "__init__", "signature": "def __init__(self, trade_days, trade_strategy)" }, { "docstring": "执行交易回测 :return:", "name": "e...
2
stack_v2_sparse_classes_30k_train_016464
Implement the Python class `TradeLoopBack` described below. Class description: 交易回测系统 Method signatures and docstrings: - def __init__(self, trade_days, trade_strategy): 使用前面封装的StockTradeDays类和本节编写的交易策略类 TradeStrategyBase类初始化交易系统 :param trade_days: StockTradeDays交易数据序列 :param trade_strategy: TradeStrategyBase交易策略 - d...
Implement the Python class `TradeLoopBack` described below. Class description: 交易回测系统 Method signatures and docstrings: - def __init__(self, trade_days, trade_strategy): 使用前面封装的StockTradeDays类和本节编写的交易策略类 TradeStrategyBase类初始化交易系统 :param trade_days: StockTradeDays交易数据序列 :param trade_strategy: TradeStrategyBase交易策略 - d...
2294a4bbc38b3c5a0f978c4a6144d5aa4e5eefab
<|skeleton|> class TradeLoopBack: """交易回测系统""" def __init__(self, trade_days, trade_strategy): """使用前面封装的StockTradeDays类和本节编写的交易策略类 TradeStrategyBase类初始化交易系统 :param trade_days: StockTradeDays交易数据序列 :param trade_strategy: TradeStrategyBase交易策略""" <|body_0|> def execute_trade(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TradeLoopBack: """交易回测系统""" def __init__(self, trade_days, trade_strategy): """使用前面封装的StockTradeDays类和本节编写的交易策略类 TradeStrategyBase类初始化交易系统 :param trade_days: StockTradeDays交易数据序列 :param trade_strategy: TradeStrategyBase交易策略""" self.trade_days = trade_days self.trade_strategy = tra...
the_stack_v2_python_sparse
trade/stock/trade_loop_back.py
13936292023/trade
train
0
0b3068aec1ecc933b9a2f6b3b587809c033a5e3e
[ "if xsID in self:\n return dict.__getitem__(self, xsID)\nxsType = xsID[0]\nbuGroup = xsID[1]\nexistingXsOpts = [xsOpt for xsOpt in self.values() if xsOpt.xsType == xsType and xsOpt.buGroup < buGroup]\nif not any(existingXsOpts):\n return self._getDefault(xsID)\nelse:\n return sorted(existingXsOpts, key=lam...
<|body_start_0|> if xsID in self: return dict.__getitem__(self, xsID) xsType = xsID[0] buGroup = xsID[1] existingXsOpts = [xsOpt for xsOpt in self.values() if xsOpt.xsType == xsType and xsOpt.buGroup < buGroup] if not any(existingXsOpts): return self._getD...
The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior.
XSSettings
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XSSettings: """The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior.""" def __getitem__(self, xsID): """Return the sto...
stack_v2_sparse_classes_36k_train_008990
11,956
permissive
[ { "docstring": "Return the stored settings of the same xs type and the lowest burnup group if they exist. Notes ----- 1. If `AA` and `AB` exist, but `AC` is created, then the intended behavior is that `AC` settings will be set to the settings in `AA`. 2. If only `YZ' exists and `YA` is created, then the intende...
3
stack_v2_sparse_classes_30k_train_003869
Implement the Python class `XSSettings` described below. Class description: The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior. Method signatures and ...
Implement the Python class `XSSettings` described below. Class description: The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior. Method signatures and ...
6c4fea1ca9d256a2599efd52af5e5ebe9860d192
<|skeleton|> class XSSettings: """The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior.""" def __getitem__(self, xsID): """Return the sto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XSSettings: """The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior.""" def __getitem__(self, xsID): """Return the stored settings ...
the_stack_v2_python_sparse
armi/physics/neutronics/crossSectionSettings.py
paulromano/armi
train
1
a42149a31282b1ddb2a6c372ba43732e3eb90a0c
[ "self.sensor = sensor\nself.pump = pump\nself.decider = decider\nself.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}", "cur_height = self.sensor.measure()\ncur_pump_status = self.pump.get_state()\nheight_status = self.decider.height_checker(cur_height)\nupdate = self.pum...
<|body_start_0|> self.sensor = sensor self.pump = pump self.decider = decider self.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF} <|end_body_0|> <|body_start_1|> cur_height = self.sensor.measure() cur_pump_status = self.pump.get...
Encapsulates command and coordination for the water-regulation module
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_36k_train_008991
1,896
no_license
[ { "docstring": "Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance of decider.Decider", "name": "__init__", "signature": "def __init__(self, sensor, pump, decider)" }, { "docstring": ...
3
null
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance...
the_stack_v2_python_sparse
students/SeanTasaki/Lesson06/water-regulation/waterregulation/controller.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
7dce5cd12017c97b489d6ae4e4be97d8792fce07
[ "self.restaurant = Restaurant.objects.create(name='RestA', address='123 Road', phone=None, email='RA@mail.com', city='Toronto', cuisine='Chinese', pricepoint='High', twitter='?', instagram='?', bio=None, GEO_location='?', external_delivery_link='?', cover_photo_url='picA', logo_url='urlA', rating='4.5')\nself.food ...
<|body_start_0|> self.restaurant = Restaurant.objects.create(name='RestA', address='123 Road', phone=None, email='RA@mail.com', city='Toronto', cuisine='Chinese', pricepoint='High', twitter='?', instagram='?', bio=None, GEO_location='?', external_delivery_link='?', cover_photo_url='picA', logo_url='urlA', ratin...
TagClearCases
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagClearCases: def setUp(self): """Create restaurant food, tag and food object for testing""" <|body_0|> def test_clear_tags(self): """Test if tag ids are cleared from food document""" <|body_1|> def test_clear_foods(self): """Test if food ids ar...
stack_v2_sparse_classes_36k_train_008992
24,925
no_license
[ { "docstring": "Create restaurant food, tag and food object for testing", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test if tag ids are cleared from food document", "name": "test_clear_tags", "signature": "def test_clear_tags(self)" }, { "docstring": "Tes...
3
stack_v2_sparse_classes_30k_train_000334
Implement the Python class `TagClearCases` described below. Class description: Implement the TagClearCases class. Method signatures and docstrings: - def setUp(self): Create restaurant food, tag and food object for testing - def test_clear_tags(self): Test if tag ids are cleared from food document - def test_clear_fo...
Implement the Python class `TagClearCases` described below. Class description: Implement the TagClearCases class. Method signatures and docstrings: - def setUp(self): Create restaurant food, tag and food object for testing - def test_clear_tags(self): Test if tag ids are cleared from food document - def test_clear_fo...
97242c072ab64704fd250a3ac2b62da05b0d3ca5
<|skeleton|> class TagClearCases: def setUp(self): """Create restaurant food, tag and food object for testing""" <|body_0|> def test_clear_tags(self): """Test if tag ids are cleared from food document""" <|body_1|> def test_clear_foods(self): """Test if food ids ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagClearCases: def setUp(self): """Create restaurant food, tag and food object for testing""" self.restaurant = Restaurant.objects.create(name='RestA', address='123 Road', phone=None, email='RA@mail.com', city='Toronto', cuisine='Chinese', pricepoint='High', twitter='?', instagram='?', bio=Non...
the_stack_v2_python_sparse
server/restaurant/tests.py
CSCC01/team_08-project
train
0
6f9ff68b4f80ab7936346f58065c57756ea9ab4d
[ "self.fets_eval = FETS2D58H(mats_eval=self.mats_eval)\nsupport_slices = [[(0, slice(None), slice(None), 0, slice(None), slice(None))], [(slice(None), 0, slice(None), slice(None), 0, slice(None))]]\nsupport_dirs = [[0, 1, 2]]\nloading_slices = [(-1, slice(None), slice(None), -1, slice(None), slice(None)), (slice(Non...
<|body_start_0|> self.fets_eval = FETS2D58H(mats_eval=self.mats_eval) support_slices = [[(0, slice(None), slice(None), 0, slice(None), slice(None))], [(slice(None), 0, slice(None), slice(None), 0, slice(None))]] support_dirs = [[0, 1, 2]] loading_slices = [(-1, slice(None), slice(None), ...
TestMATS2D5
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMATS2D5: def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): """Assert that the symmetry is given for the applied loadings.""" <|body_0|> def assert_stress_value(self, sig_expected, n_steps=3, load=0.0001): """Assert that the symmetry is given for t...
stack_v2_sparse_classes_36k_train_008993
4,336
no_license
[ { "docstring": "Assert that the symmetry is given for the applied loadings.", "name": "assert_2D_symmetry_clamped_cube", "signature": "def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001)" }, { "docstring": "Assert that the symmetry is given for the applied loadings.", "name": "a...
2
null
Implement the Python class `TestMATS2D5` described below. Class description: Implement the TestMATS2D5 class. Method signatures and docstrings: - def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): Assert that the symmetry is given for the applied loadings. - def assert_stress_value(self, sig_expected, ...
Implement the Python class `TestMATS2D5` described below. Class description: Implement the TestMATS2D5 class. Method signatures and docstrings: - def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): Assert that the symmetry is given for the applied loadings. - def assert_stress_value(self, sig_expected, ...
00de9f0eec52835d839a3c6c1407cac11a496339
<|skeleton|> class TestMATS2D5: def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): """Assert that the symmetry is given for the applied loadings.""" <|body_0|> def assert_stress_value(self, sig_expected, n_steps=3, load=0.0001): """Assert that the symmetry is given for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMATS2D5: def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): """Assert that the symmetry is given for the applied loadings.""" self.fets_eval = FETS2D58H(mats_eval=self.mats_eval) support_slices = [[(0, slice(None), slice(None), 0, slice(None), slice(None))], [(slice(...
the_stack_v2_python_sparse
ibvpy/mats/mats2D5/__test__.py
simvisage/bmcs
train
1
b8c7c97b09145b1b580d8f8a55d1d7a4bdc0d47e
[ "text = ''\nwith open(file_path, 'r') as file:\n for line in file.readlines():\n text += line\nreturn text", "read = sys.stdin.readlines()\ntext = ''\nfor line in read:\n text += line\nreturn text" ]
<|body_start_0|> text = '' with open(file_path, 'r') as file: for line in file.readlines(): text += line return text <|end_body_0|> <|body_start_1|> read = sys.stdin.readlines() text = '' for line in read: text += line retu...
Used in handling reading input.
Reader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Used in handling reading input.""" def read_file(file_path): """Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string""" <|body_0|> def read_input(): """Reads a direct input. An input...
stack_v2_sparse_classes_36k_train_008994
855
permissive
[ { "docstring": "Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string", "name": "read_file", "signature": "def read_file(file_path)" }, { "docstring": "Reads a direct input. An input ends with CTRL+D. Enables inputting from a f...
2
stack_v2_sparse_classes_30k_train_012170
Implement the Python class `Reader` described below. Class description: Used in handling reading input. Method signatures and docstrings: - def read_file(file_path): Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string - def read_input(): Reads a d...
Implement the Python class `Reader` described below. Class description: Used in handling reading input. Method signatures and docstrings: - def read_file(file_path): Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string - def read_input(): Reads a d...
1f7bea099dac93696d5d2ebb8d76926efe5ceda4
<|skeleton|> class Reader: """Used in handling reading input.""" def read_file(file_path): """Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string""" <|body_0|> def read_input(): """Reads a direct input. An input...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reader: """Used in handling reading input.""" def read_file(file_path): """Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string""" text = '' with open(file_path, 'r') as file: for line in file.readli...
the_stack_v2_python_sparse
form/readers.py
ffhan/lingua
train
0
4cd77b2e2bfd6f309db6ae8950497597b4a5f82b
[ "if num != 0 and num & num - 1 == 0 and (len(bin(num).split('1')[-1]) & 1 == 0):\n return True\nelse:\n return False", "while num:\n num = num / 4.0\n if num == 4:\n return True\n elif num < 4:\n break\nreturn False" ]
<|body_start_0|> if num != 0 and num & num - 1 == 0 and (len(bin(num).split('1')[-1]) & 1 == 0): return True else: return False <|end_body_0|> <|body_start_1|> while num: num = num / 4.0 if num == 4: return True elif nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPowerOfFour(self, num): """:type num: int :rtype: bool 位运算 特点除了只有一个1外 而且后面的0个数为偶数""" <|body_0|> def isPowerOfFour1(self, num): """:type num: int :rtype: bool 循环""" <|body_1|> <|end_skeleton|> <|body_start_0|> if num != 0 and num & nu...
stack_v2_sparse_classes_36k_train_008995
949
no_license
[ { "docstring": ":type num: int :rtype: bool 位运算 特点除了只有一个1外 而且后面的0个数为偶数", "name": "isPowerOfFour", "signature": "def isPowerOfFour(self, num)" }, { "docstring": ":type num: int :rtype: bool 循环", "name": "isPowerOfFour1", "signature": "def isPowerOfFour1(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_018573
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfFour(self, num): :type num: int :rtype: bool 位运算 特点除了只有一个1外 而且后面的0个数为偶数 - def isPowerOfFour1(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 isPowerOfFour(self, num): :type num: int :rtype: bool 位运算 特点除了只有一个1外 而且后面的0个数为偶数 - def isPowerOfFour1(self, num): :type num: int :rtype: bool 循环 <|skeleton|> class Solution:...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def isPowerOfFour(self, num): """:type num: int :rtype: bool 位运算 特点除了只有一个1外 而且后面的0个数为偶数""" <|body_0|> def isPowerOfFour1(self, num): """:type num: int :rtype: bool 循环""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPowerOfFour(self, num): """:type num: int :rtype: bool 位运算 特点除了只有一个1外 而且后面的0个数为偶数""" if num != 0 and num & num - 1 == 0 and (len(bin(num).split('1')[-1]) & 1 == 0): return True else: return False def isPowerOfFour1(self, num): """:ty...
the_stack_v2_python_sparse
算法/位运算/4的幂.py
RichieSong/algorithm
train
0
d675ffb926b6f8f2fb131440c062b5fa10eee2f4
[ "super().__init__()\nchannels = [input_channel] + channel_list\nmodules = list()\nfor i in range(1, len(channels)):\n modules.append(DownConvBlock(in_channels=channels[i - 1], out_channels=channels[i]))\nself.conv = nn.Sequential(*modules)\nfactor = 2 ** len(channel_list)\nself.fc_size = int(channel_list[-1] * H...
<|body_start_0|> super().__init__() channels = [input_channel] + channel_list modules = list() for i in range(1, len(channels)): modules.append(DownConvBlock(in_channels=channels[i - 1], out_channels=channels[i])) self.conv = nn.Sequential(*modules) factor = 2...
Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.
ConvEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvEncoder: """Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.""" def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_dim): """Init. Args: H(int): Height of the input data. W(int...
stack_v2_sparse_classes_36k_train_008996
10,936
no_license
[ { "docstring": "Init. Args: H(int): Height of the input data. W(int): Width of the input data input_channel(int): Number of channels in the input data. Typically 1 for grayscale and 3 for RGB. channel_list(List[int]): List of channels. Determines the number of convolutional layers and associated channels. ex: [...
2
stack_v2_sparse_classes_30k_train_013775
Implement the Python class `ConvEncoder` described below. Class description: Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network. Method signatures and docstrings: - def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_...
Implement the Python class `ConvEncoder` described below. Class description: Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network. Method signatures and docstrings: - def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_...
9027b529eaa4cf0a38f25512141810f92db99639
<|skeleton|> class ConvEncoder: """Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.""" def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_dim): """Init. Args: H(int): Height of the input data. W(int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvEncoder: """Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.""" def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_dim): """Init. Args: H(int): Height of the input data. W(int): Width of t...
the_stack_v2_python_sparse
grae/models/torch_modules.py
jakerhodes/GRAE
train
0
2f63d7bbb540347bc8af6a2cb9cabf9c4c17954d
[ "profile = Shop_User(id=current_user.id).profile\nif profile:\n profile = marshal(profile, output_userProfile)\n return Response(data=profile)\nelse:\n return Response(code=HttpStatus.HTTP_404_NOT_FOUND, message='无资料')", "args = reqparse.RequestParser().add_argument('building', type=str, location='json',...
<|body_start_0|> profile = Shop_User(id=current_user.id).profile if profile: profile = marshal(profile, output_userProfile) return Response(data=profile) else: return Response(code=HttpStatus.HTTP_404_NOT_FOUND, message='无资料') <|end_body_0|> <|body_start_1|> ...
Profile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profile: def get(self): """获取个人资料 :return:""" <|body_0|> def put(self): """修改个人资料 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> profile = Shop_User(id=current_user.id).profile if profile: profile = marshal(profile, out...
stack_v2_sparse_classes_36k_train_008997
2,760
no_license
[ { "docstring": "获取个人资料 :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "修改个人资料 :return:", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_014913
Implement the Python class `Profile` described below. Class description: Implement the Profile class. Method signatures and docstrings: - def get(self): 获取个人资料 :return: - def put(self): 修改个人资料 :return:
Implement the Python class `Profile` described below. Class description: Implement the Profile class. Method signatures and docstrings: - def get(self): 获取个人资料 :return: - def put(self): 修改个人资料 :return: <|skeleton|> class Profile: def get(self): """获取个人资料 :return:""" <|body_0|> def put(self)...
34a2bf4a51cc40a22dd43cb5eb88af7c2f2c5120
<|skeleton|> class Profile: def get(self): """获取个人资料 :return:""" <|body_0|> def put(self): """修改个人资料 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Profile: def get(self): """获取个人资料 :return:""" profile = Shop_User(id=current_user.id).profile if profile: profile = marshal(profile, output_userProfile) return Response(data=profile) else: return Response(code=HttpStatus.HTTP_404_NOT_FOUND, m...
the_stack_v2_python_sparse
App/Shop/Controller/UserResource.py
Vulcanhy/api.grooo-master
train
0
31a0b3dc75b96d5dfd42e7cfccf7cc338e2a6a42
[ "if dtype == np.int8 or dtype == np.int32:\n return DTYPE.INT\nelif dtype == np.uint or dtype == np.uint64:\n return DTYPE.ULONG\nelif dtype == np.int64:\n return DTYPE.LONG\nelif dtype == np.float32:\n return DTYPE.FLOAT\nelif dtype == np.float64:\n return DTYPE.DOUBLE\nelif dtype == np.bool:\n r...
<|body_start_0|> if dtype == np.int8 or dtype == np.int32: return DTYPE.INT elif dtype == np.uint or dtype == np.uint64: return DTYPE.ULONG elif dtype == np.int64: return DTYPE.LONG elif dtype == np.float32: return DTYPE.FLOAT elif ...
TypeUtil
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeUtil: def to_id_dtype(dtype): """to_numpy_dtype""" <|body_0|> def to_numpy_dtype(dtype): """to_numpy_dtype""" <|body_1|> <|end_skeleton|> <|body_start_0|> if dtype == np.int8 or dtype == np.int32: return DTYPE.INT elif dtype ...
stack_v2_sparse_classes_36k_train_008998
2,769
permissive
[ { "docstring": "to_numpy_dtype", "name": "to_id_dtype", "signature": "def to_id_dtype(dtype)" }, { "docstring": "to_numpy_dtype", "name": "to_numpy_dtype", "signature": "def to_numpy_dtype(dtype)" } ]
2
null
Implement the Python class `TypeUtil` described below. Class description: Implement the TypeUtil class. Method signatures and docstrings: - def to_id_dtype(dtype): to_numpy_dtype - def to_numpy_dtype(dtype): to_numpy_dtype
Implement the Python class `TypeUtil` described below. Class description: Implement the TypeUtil class. Method signatures and docstrings: - def to_id_dtype(dtype): to_numpy_dtype - def to_numpy_dtype(dtype): to_numpy_dtype <|skeleton|> class TypeUtil: def to_id_dtype(dtype): """to_numpy_dtype""" ...
875ae298dfa84ee9815f53db5bf7a8b76a379a6f
<|skeleton|> class TypeUtil: def to_id_dtype(dtype): """to_numpy_dtype""" <|body_0|> def to_numpy_dtype(dtype): """to_numpy_dtype""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypeUtil: def to_id_dtype(dtype): """to_numpy_dtype""" if dtype == np.int8 or dtype == np.int32: return DTYPE.INT elif dtype == np.uint or dtype == np.uint64: return DTYPE.ULONG elif dtype == np.int64: return DTYPE.LONG elif dtype == ...
the_stack_v2_python_sparse
src/foreign_if/python/main/python/frovedis/matrix/dtype.py
frovedis/frovedis
train
68
62b6b015d08e3d1fa302ec62d95e94250b82c7f5
[ "if not root:\n return True\nreturn self.check(root) != -1", "if not root:\n return 0\nelse:\n left = self.check(root.left)\n right = self.check(root.right)\n if left == -1 or right == -1 or abs(left - right) > 1:\n return -1\n else:\n return max(left, right) + 1" ]
<|body_start_0|> if not root: return True return self.check(root) != -1 <|end_body_0|> <|body_start_1|> if not root: return 0 else: left = self.check(root.left) right = self.check(root.right) if left == -1 or right == -1 or abs...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def check(self, root): """combine calculate depth of a tree (subtree) and examine whether subtrees are balanced together. If return -1 means current node is not balanced, else re...
stack_v2_sparse_classes_36k_train_008999
1,768
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": "combine calculate depth of a tree (subtree) and examine whether subtrees are balanced together. If return -1 means current node is not balanced, else return actu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def check(self, root): combine calculate depth of a tree (subtree) and examine whether subtrees are balanced toget...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def check(self, root): combine calculate depth of a tree (subtree) and examine whether subtrees are balanced toget...
2bcd0f6a704346cdac4ecccd6c0baef579d38fac
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def check(self, root): """combine calculate depth of a tree (subtree) and examine whether subtrees are balanced together. If return -1 means current node is not balanced, else re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" if not root: return True return self.check(root) != -1 def check(self, root): """combine calculate depth of a tree (subtree) and examine whether subtrees are balanced together. If ret...
the_stack_v2_python_sparse
BalancedBinaryTree.py
marsunique/LeetCodeOJ
train
1