blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
e485d15ba9140bb22e30b9c72e18bd6fd5a8b19a
[ "self.quant_bit = quant_bit\nOperatorSerializable.__init__(self)\nModule.__init__(self)\nQuantConv2d.__init__(self, in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias, padding_mode=padding_mode)", "input = input....
<|body_start_0|> self.quant_bit = quant_bit OperatorSerializable.__init__(self) Module.__init__(self) QuantConv2d.__init__(self, in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias, paddi...
QuantizeConv2d Module inherit nn.Module.
QuantizeConv2d
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantizeConv2d: """QuantizeConv2d Module inherit nn.Module.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): """Construct Identity class.""" <|body_0|> def forward(s...
stack_v2_sparse_classes_10k_train_005600
25,894
permissive
[ { "docstring": "Construct Identity class.", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None)" }, { "docstring": "Do an inference on Identity.", "name": "for...
2
stack_v2_sparse_classes_30k_train_001807
Implement the Python class `QuantizeConv2d` described below. Class description: QuantizeConv2d Module inherit nn.Module. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): Construct...
Implement the Python class `QuantizeConv2d` described below. Class description: QuantizeConv2d Module inherit nn.Module. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): Construct...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class QuantizeConv2d: """QuantizeConv2d Module inherit nn.Module.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): """Construct Identity class.""" <|body_0|> def forward(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuantizeConv2d: """QuantizeConv2d Module inherit nn.Module.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): """Construct Identity class.""" self.quant_bit = quant_bit Operato...
the_stack_v2_python_sparse
zeus/modules/operators/functions/pytorch_fn.py
huawei-noah/xingtian
train
308
cf65cddbaf6ce41b97ee54d624d8a2053aa1df90
[ "self.pyr_scale = pyr_scale\nself.levels = levels\nself.winsize = winsize\nself.iterations = iterations\nself.poly_n = poly_n\nself.poly_sigma = poly_sigma\nself.motion_image = None\nself.magnitude_image = None\nself.direction_image = None", "hsv = np.zeros((prev.shape[0], prev.shape[1], 3))\nhsv[..., 1] = 255\nf...
<|body_start_0|> self.pyr_scale = pyr_scale self.levels = levels self.winsize = winsize self.iterations = iterations self.poly_n = poly_n self.poly_sigma = poly_sigma self.motion_image = None self.magnitude_image = None self.direction_image = None ...
Farneback
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Farneback: def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): """Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that comput...
stack_v2_sparse_classes_10k_train_005601
3,952
no_license
[ { "docstring": "Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that computes a dense optical flow using the Gunnar Farneback’s algorithm. :param float pyr_scale: scaling factor between images i...
2
stack_v2_sparse_classes_30k_test_000171
Implement the Python class `Farneback` described below. Class description: Implement the Farneback class. Method signatures and docstrings: - def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5...
Implement the Python class `Farneback` described below. Class description: Implement the Farneback class. Method signatures and docstrings: - def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5...
90531055691a094dd271966b53c40b7a097df375
<|skeleton|> class Farneback: def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): """Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that comput...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Farneback: def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): """Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that computes a dense opt...
the_stack_v2_python_sparse
OpticalFlow/Dense/Farneback.py
kmakantasis/CV-Tools
train
0
df8de9c85a93c2338de6fdd722ede1ea0a1f74cd
[ "self_dc = Idc.get_local_dc()\nself.clients = []\nfor dc, client in clients.iteritems():\n if self_dc == dc:\n self.clients.insert(0, client)\n else:\n self.clients.append(client)\nself.local_cmds = set(self.READ_CMDS)\nself.local_cmds.update(local_update_cmds)", "def wrap(*args, **kwargs):\n ...
<|body_start_0|> self_dc = Idc.get_local_dc() self.clients = [] for dc, client in clients.iteritems(): if self_dc == dc: self.clients.insert(0, client) else: self.clients.append(client) self.local_cmds = set(self.READ_CMDS) ...
MultiClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiClient: def __init__(self, clients, local_update_cmds=[]): """:param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to a...
stack_v2_sparse_classes_10k_train_005602
1,545
no_license
[ { "docstring": ":param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to all clients, except that listed in local_update_cmds :return:", "name": ...
2
stack_v2_sparse_classes_30k_train_003192
Implement the Python class `MultiClient` described below. Class description: Implement the MultiClient class. Method signatures and docstrings: - def __init__(self, clients, local_update_cmds=[]): :param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pyp...
Implement the Python class `MultiClient` described below. Class description: Implement the MultiClient class. Method signatures and docstrings: - def __init__(self, clients, local_update_cmds=[]): :param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pyp...
c592d879fd79da4e0816a4f909e5725e385b6160
<|skeleton|> class MultiClient: def __init__(self, clients, local_update_cmds=[]): """:param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiClient: def __init__(self, clients, local_update_cmds=[]): """:param clients: dict: idc->client where client should by compatible with memcache.Client @see https://pypi.python.org/pypi/python-memcached eg: {'hy':c1, 'lf':c2} :param local_update_cmds: all update commands will go to all clients, ex...
the_stack_v2_python_sparse
leetcode/venv/lib/python2.7/site-packages/pyutil/memcache/multi_client.py
KqSMea8/PycharmProjects
train
0
862c8250b34df1a532ee8a8bd5b21dfb8afda9e9
[ "super().__init__()\nself.conv1 = SuperGATConv(in_dim, hidden_dim, num_heads, attn_type, neg_sample_ratio, feat_drop, attn_drop, negative_slope, F.elu)\nself.conv2 = SuperGATConv(num_heads * hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio, 0, attn_drop, negative_slope)", "h = self.conv1(g, feat).flatt...
<|body_start_0|> super().__init__() self.conv1 = SuperGATConv(in_dim, hidden_dim, num_heads, attn_type, neg_sample_ratio, feat_drop, attn_drop, negative_slope, F.elu) self.conv2 = SuperGATConv(num_heads * hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio, 0, attn_drop, negative_slope) ...
SuperGAT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperGAT: def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): """两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param ...
stack_v2_sparse_classes_10k_train_005603
5,266
no_license
[ { "docstring": "两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param attn_type: str 注意力类型,可选择GO, DP, SD和MX :param neg_sample_ratio: float, optional 负样本边数量占正样本边数量的比例,默认0.5 :param feat_drop: float, optional 输入特征Dropout概率,默认为0 :param at...
2
stack_v2_sparse_classes_30k_train_006449
Implement the Python class `SuperGAT` described below. Class description: Implement the SuperGAT class. Method signatures and docstrings: - def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): 两层SuperGAT模型 :param in_dim: int 输入特...
Implement the Python class `SuperGAT` described below. Class description: Implement the SuperGAT class. Method signatures and docstrings: - def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): 两层SuperGAT模型 :param in_dim: int 输入特...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class SuperGAT: def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): """两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SuperGAT: def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): """两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param attn_type: str...
the_stack_v2_python_sparse
gnn/supergat/model.py
deepdumbo/pytorch-tutorial-1
train
0
61ec6565de9752f5c567aa81cf1e4c403c4d9b24
[ "if ref is not None:\n if not isinstance(ref, pd.Index):\n if hasattr(ref, 'columns') and isinstance(ref.index, pd.Index):\n ref = ref.columns\n else:\n ref = pd.Index(ref)\n obj = self._get_indices(ref, obj)\nif np.issubdtype(type(obj), np.integer):\n obj = int(obj)\nif isinsta...
<|body_start_0|> if ref is not None: if not isinstance(ref, pd.Index): if hasattr(ref, 'columns') and isinstance(ref.index, pd.Index): ref = ref.columns else: ref = pd.Index(ref) obj = self._get_indices(ref, obj) if ...
Mixin class with utilities for by-column applicates.
_ColumnEstimator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ColumnEstimator: """Mixin class with utilities for by-column applicates.""" def _coerce_to_pd_index(self, obj, ref=None): """Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference ...
stack_v2_sparse_classes_10k_train_005604
36,566
permissive
[ { "docstring": "Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference index, coercible to pd.Index, optional, default=None Returns ------- obj coerced to pd.Index if ref was passed, and if obj had int or np.i...
4
null
Implement the Python class `_ColumnEstimator` described below. Class description: Mixin class with utilities for by-column applicates. Method signatures and docstrings: - def _coerce_to_pd_index(self, obj, ref=None): Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of...
Implement the Python class `_ColumnEstimator` described below. Class description: Mixin class with utilities for by-column applicates. Method signatures and docstrings: - def _coerce_to_pd_index(self, obj, ref=None): Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of...
70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f
<|skeleton|> class _ColumnEstimator: """Mixin class with utilities for by-column applicates.""" def _coerce_to_pd_index(self, obj, ref=None): """Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _ColumnEstimator: """Mixin class with utilities for by-column applicates.""" def _coerce_to_pd_index(self, obj, ref=None): """Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference index, coerci...
the_stack_v2_python_sparse
sktime/base/_meta.py
sktime/sktime
train
1,117
cf383b0a14facd053a7f82595112f8823ddf2042
[ "path = '/'.join([self.REQUEST_BASEURL, 'list']) + '?' + '&'.join(['src_rse={}'.format(src_rse), 'dst_rse={}'.format(dst_rse), 'request_states={}'.format(request_states)])\nurl = build_url(choice(self.list_hosts), path=path)\nr = self._send_request(url, type_='GET')\nif r.status_code == codes.ok:\n return self._...
<|body_start_0|> path = '/'.join([self.REQUEST_BASEURL, 'list']) + '?' + '&'.join(['src_rse={}'.format(src_rse), 'dst_rse={}'.format(dst_rse), 'request_states={}'.format(request_states)]) url = build_url(choice(self.list_hosts), path=path) r = self._send_request(url, type_='GET') if r.st...
RequestClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestClient: def list_requests(self, src_rse, dst_rse, request_states): """Return latest request details :return: request information :rtype: dict""" <|body_0|> def list_requests_history(self, src_rse, dst_rse, request_states, offset=0, limit=100): """Return histor...
stack_v2_sparse_classes_10k_train_005605
4,256
permissive
[ { "docstring": "Return latest request details :return: request information :rtype: dict", "name": "list_requests", "signature": "def list_requests(self, src_rse, dst_rse, request_states)" }, { "docstring": "Return historical request details :return: request information :rtype: dict", "name":...
4
stack_v2_sparse_classes_30k_train_002047
Implement the Python class `RequestClient` described below. Class description: Implement the RequestClient class. Method signatures and docstrings: - def list_requests(self, src_rse, dst_rse, request_states): Return latest request details :return: request information :rtype: dict - def list_requests_history(self, src...
Implement the Python class `RequestClient` described below. Class description: Implement the RequestClient class. Method signatures and docstrings: - def list_requests(self, src_rse, dst_rse, request_states): Return latest request details :return: request information :rtype: dict - def list_requests_history(self, src...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class RequestClient: def list_requests(self, src_rse, dst_rse, request_states): """Return latest request details :return: request information :rtype: dict""" <|body_0|> def list_requests_history(self, src_rse, dst_rse, request_states, offset=0, limit=100): """Return histor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RequestClient: def list_requests(self, src_rse, dst_rse, request_states): """Return latest request details :return: request information :rtype: dict""" path = '/'.join([self.REQUEST_BASEURL, 'list']) + '?' + '&'.join(['src_rse={}'.format(src_rse), 'dst_rse={}'.format(dst_rse), 'request_states=...
the_stack_v2_python_sparse
lib/rucio/client/requestclient.py
rucio/rucio
train
232
607153bdb517be58178440b07e85fecf7e3c9e91
[ "if not self.supports_type_lookup():\n raise Unimplemented()\ntry:\n from . import sessions\nexcept ImportError:\n raise\ntry:\n session = sessions.TypeLookupSession(runtime=self._runtime)\nexcept AttributeError:\n raise\nreturn session", "pass\nif not self.supports_type_admin():\n raise Unimple...
<|body_start_0|> if not self.supports_type_lookup(): raise Unimplemented() try: from . import sessions except ImportError: raise try: session = sessions.TypeLookupSession(runtime=self._runtime) except AttributeError: rai...
This manager provides access to the available sessions of the type service. The TypeLookupSession is used for looking up Types and the TypeAdminSession is used for managing and registering new Types.
TypeManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeManager: """This manager provides access to the available sessions of the type service. The TypeLookupSession is used for looking up Types and the TypeAdminSession is used for managing and registering new Types.""" def get_type_lookup_session(self): """Gets the OsidSession associ...
stack_v2_sparse_classes_10k_train_005606
3,429
permissive
[ { "docstring": "Gets the OsidSession associated with the type lookup service. return: (osid.type.TypeLookupSession) - a TypeLookupSession raise: OperationFailed - unable to complete request raise: Unimplemented - supports_type_lookup() is false compliance: optional - This method must be implemented if supports_...
2
stack_v2_sparse_classes_30k_train_003233
Implement the Python class `TypeManager` described below. Class description: This manager provides access to the available sessions of the type service. The TypeLookupSession is used for looking up Types and the TypeAdminSession is used for managing and registering new Types. Method signatures and docstrings: - def g...
Implement the Python class `TypeManager` described below. Class description: This manager provides access to the available sessions of the type service. The TypeLookupSession is used for looking up Types and the TypeAdminSession is used for managing and registering new Types. Method signatures and docstrings: - def g...
445f968a175d61c8d92c0f617a3c17dc1dc7c584
<|skeleton|> class TypeManager: """This manager provides access to the available sessions of the type service. The TypeLookupSession is used for looking up Types and the TypeAdminSession is used for managing and registering new Types.""" def get_type_lookup_session(self): """Gets the OsidSession associ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TypeManager: """This manager provides access to the available sessions of the type service. The TypeLookupSession is used for looking up Types and the TypeAdminSession is used for managing and registering new Types.""" def get_type_lookup_session(self): """Gets the OsidSession associated with the...
the_stack_v2_python_sparse
dlkit/handcar/type/managers.py
mitsei/dlkit
train
2
9cea73822853a0a1d73761413469a847fd3efd1f
[ "self.description = description\nself.domain = domain\nself.object_class = object_class\nself.principal_name = principal_name\nself.restricted = restricted\nself.roles = roles", "if dictionary is None:\n return None\ndescription = dictionary.get('description')\ndomain = dictionary.get('domain')\nobject_class =...
<|body_start_0|> self.description = description self.domain = domain self.object_class = object_class self.principal_name = principal_name self.restricted = restricted self.roles = roles <|end_body_0|> <|body_start_1|> if dictionary is None: return No...
Implementation of the 'ActiveDirectoryPrincipalsAddParameters' model. Specifies the settings for adding new users and groups for Active Directory principals. These users and groups are added to the Cohesity Cluster. You cannot create users and groups in the default Cohesity domain called 'LOCAL' using this operation. A...
ActiveDirectoryPrincipalsAddParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActiveDirectoryPrincipalsAddParameters: """Implementation of the 'ActiveDirectoryPrincipalsAddParameters' model. Specifies the settings for adding new users and groups for Active Directory principals. These users and groups are added to the Cohesity Cluster. You cannot create users and groups in ...
stack_v2_sparse_classes_10k_train_005607
4,214
permissive
[ { "docstring": "Constructor for the ActiveDirectoryPrincipalsAddParameters class", "name": "__init__", "signature": "def __init__(self, description=None, domain=None, object_class=None, principal_name=None, restricted=None, roles=None)" }, { "docstring": "Creates an instance of this model from a...
2
null
Implement the Python class `ActiveDirectoryPrincipalsAddParameters` described below. Class description: Implementation of the 'ActiveDirectoryPrincipalsAddParameters' model. Specifies the settings for adding new users and groups for Active Directory principals. These users and groups are added to the Cohesity Cluster....
Implement the Python class `ActiveDirectoryPrincipalsAddParameters` described below. Class description: Implementation of the 'ActiveDirectoryPrincipalsAddParameters' model. Specifies the settings for adding new users and groups for Active Directory principals. These users and groups are added to the Cohesity Cluster....
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ActiveDirectoryPrincipalsAddParameters: """Implementation of the 'ActiveDirectoryPrincipalsAddParameters' model. Specifies the settings for adding new users and groups for Active Directory principals. These users and groups are added to the Cohesity Cluster. You cannot create users and groups in ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ActiveDirectoryPrincipalsAddParameters: """Implementation of the 'ActiveDirectoryPrincipalsAddParameters' model. Specifies the settings for adding new users and groups for Active Directory principals. These users and groups are added to the Cohesity Cluster. You cannot create users and groups in the default C...
the_stack_v2_python_sparse
cohesity_management_sdk/models/active_directory_principals_add_parameters.py
cohesity/management-sdk-python
train
24
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__(pooling_class, N, depth, laplacian_type, kernel_size, ratio)\nself.sequence_length = sequence_length\nn_pixels = self.laps[0].size(0)\nn_features = self.encoder.enc_l0.spherical_cheb.chebconv.in_channels\nself.lstm_l0 = nn.LSTM(input_size=n_pixels * n_features, hidden_size=n_pixels * n_features, b...
<|body_start_0|> super().__init__(pooling_class, N, depth, laplacian_type, kernel_size, ratio) self.sequence_length = sequence_length n_pixels = self.laps[0].size(0) n_features = self.encoder.enc_l0.spherical_cheb.chebconv.in_channels self.lstm_l0 = nn.LSTM(input_size=n_pixels * ...
Sphericall GCNN Autoencoder with LSTM.
SphericalUNetTemporalLSTM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalUNetTemporalLSTM: """Sphericall GCNN Autoencoder with LSTM.""" def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels ...
stack_v2_sparse_classes_10k_train_005608
41,403
no_license
[ { "docstring": "Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input image depth (int): The depth of the UNet, which is bounded by the N and the type of pooling sequence_length (int): The number of images used per sample kernel_size (int): che...
2
null
Implement the Python class `SphericalUNetTemporalLSTM` described below. Class description: Sphericall GCNN Autoencoder with LSTM. Method signatures and docstrings: - def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): Initialization. Args: pooling_class (obj): One of th...
Implement the Python class `SphericalUNetTemporalLSTM` described below. Class description: Sphericall GCNN Autoencoder with LSTM. Method signatures and docstrings: - def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): Initialization. Args: pooling_class (obj): One of th...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class SphericalUNetTemporalLSTM: """Sphericall GCNN Autoencoder with LSTM.""" def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SphericalUNetTemporalLSTM: """Sphericall GCNN Autoencoder with LSTM.""" def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input ...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
669ba5d3ddcb833f1e01465ccec198b7daee4b80
[ "super(SupportingOutputLayer, self).__init__()\nself.linear_1 = Linear(linear_weight_shape=linear_1_weight_shape, linear_bias_shape=linear_1_bias_shape)\nself.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_layer_norm_bias_shape)\nself.matmu...
<|body_start_0|> super(SupportingOutputLayer, self).__init__() self.linear_1 = Linear(linear_weight_shape=linear_1_weight_shape, linear_bias_shape=linear_1_bias_shape) self.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_...
module of reader downstream
SupportingOutputLayer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupportingOutputLayer: """module of reader downstream""" def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" <|body_0|> def construct(self, x): """construct function""" ...
stack_v2_sparse_classes_10k_train_005609
9,011
permissive
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape)" }, { "docstring": "construct function", "name": "construct", "signature": "def construct(self, x)" ...
2
stack_v2_sparse_classes_30k_train_003372
Implement the Python class `SupportingOutputLayer` described below. Class description: module of reader downstream Method signatures and docstrings: - def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function - def construct(self, x): const...
Implement the Python class `SupportingOutputLayer` described below. Class description: module of reader downstream Method signatures and docstrings: - def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function - def construct(self, x): const...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class SupportingOutputLayer: """module of reader downstream""" def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" <|body_0|> def construct(self, x): """construct function""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SupportingOutputLayer: """module of reader downstream""" def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" super(SupportingOutputLayer, self).__init__() self.linear_1 = Linear(linear_weight...
the_stack_v2_python_sparse
research/nlp/tprr/src/reader_downstream.py
mindspore-ai/models
train
301
98bf45fc42191d2dda1bc092ef79ee7a213d185e
[ "self.a = nums\nself.to = range(0, len(nums))\nself.n = len(nums)", "b = [0] * self.n\nfor i in xrange(self.n):\n b[self.to[i]] = self.a[i]\nself.a = b\nself.to = range(self.n)\nreturn self.a", "for i in xrange(self.n - 1):\n pos = random.randint(i, self.n - 1)\n self.to[i], self.to[pos] = (self.to[pos...
<|body_start_0|> self.a = nums self.to = range(0, len(nums)) self.n = len(nums) <|end_body_0|> <|body_start_1|> b = [0] * self.n for i in xrange(self.n): b[self.to[i]] = self.a[i] self.a = b self.to = range(self.n) return self.a <|end_body_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type size: int""" <|body_0|> def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" <|body_1|> def shuffle(self): """Returns a random sh...
stack_v2_sparse_classes_10k_train_005610
1,065
no_license
[ { "docstring": ":type nums: List[int] :type size: int", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "Resets the array to its original configuration and return it. :rtype: List[int]", "name": "reset", "signature": "def reset(self)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_001544
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type size: int - def reset(self): Resets the array to its original configuration and return it. :rtype: List[int] - def shuffle(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type size: int - def reset(self): Resets the array to its original configuration and return it. :rtype: List[int] - def shuffle(s...
58dcb51f183ac9bf5e825e8cd5c311852c231538
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type size: int""" <|body_0|> def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" <|body_1|> def shuffle(self): """Returns a random sh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int] :type size: int""" self.a = nums self.to = range(0, len(nums)) self.n = len(nums) def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" b = [0] * s...
the_stack_v2_python_sparse
384 Shuffle an Array.py
jianminchen/LeetCode-30
train
0
b10502290abd996fcefeaca9860475321a342501
[ "self.id = id\nself.name = name\nself.last_edited = APIHelper.RFC3339DateTime(last_edited) if last_edited else None\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nid = dictionary.get('Id')\nname = dictionary.get('Name')\nlast_edited = APIHelper.RFC3339DateTime.from...
<|body_start_0|> self.id = id self.name = name self.last_edited = APIHelper.RFC3339DateTime(last_edited) if last_edited else None self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None id = dictio...
Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited
PdfTemplateListItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PdfTemplateListItem: """Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited""" def __ini...
stack_v2_sparse_classes_10k_train_005611
2,450
permissive
[ { "docstring": "Constructor for the PdfTemplateListItem class", "name": "__init__", "signature": "def __init__(self, id=None, name=None, last_edited=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary...
2
stack_v2_sparse_classes_30k_test_000207
Implement the Python class `PdfTemplateListItem` described below. Class description: Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the te...
Implement the Python class `PdfTemplateListItem` described below. Class description: Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the te...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class PdfTemplateListItem: """Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited""" def __ini...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PdfTemplateListItem: """Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited""" def __init__(self, id=...
the_stack_v2_python_sparse
idfy_rest_client/models/pdf_template_list_item.py
dealflowteam/Idfy
train
0
664fe45bd864945570a7fd4ac5223c603e32bc3a
[ "conv1 = nn.Conv3d(Cin, Cin, kernel_size=(3, 2, 2), stride=(2, 2, 2))\nconv2 = nn.Conv3d(Cin, Cin, kernel_size=(3, 3, 2), stride=(2, 2, 2), padding=(0, 0, 1))\nconv3 = nn.Conv3d(Cin, Cin, kernel_size=(3, 3, 3), stride=(2, 2, 1), padding=(0, 0, 0))\nreturn nn.Sequential(conv1, activation_constructor(Cin, False), con...
<|body_start_0|> conv1 = nn.Conv3d(Cin, Cin, kernel_size=(3, 2, 2), stride=(2, 2, 2)) conv2 = nn.Conv3d(Cin, Cin, kernel_size=(3, 3, 2), stride=(2, 2, 2), padding=(0, 0, 1)) conv3 = nn.Conv3d(Cin, Cin, kernel_size=(3, 3, 3), stride=(2, 2, 1), padding=(0, 0, 0)) return nn.Sequential(conv1...
DownUp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownUp: def downsample1(activation_constructor, Cin, channel_small): """First RAB downsample""" <|body_0|> def upsample1(activation_constructor, Cin, channel_small): """First RAB upsample""" <|body_1|> def downsample2(activation_constructor, Cin, channel...
stack_v2_sparse_classes_10k_train_005612
7,226
permissive
[ { "docstring": "First RAB downsample", "name": "downsample1", "signature": "def downsample1(activation_constructor, Cin, channel_small)" }, { "docstring": "First RAB upsample", "name": "upsample1", "signature": "def upsample1(activation_constructor, Cin, channel_small)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_007127
Implement the Python class `DownUp` described below. Class description: Implement the DownUp class. Method signatures and docstrings: - def downsample1(activation_constructor, Cin, channel_small): First RAB downsample - def upsample1(activation_constructor, Cin, channel_small): First RAB upsample - def downsample2(ac...
Implement the Python class `DownUp` described below. Class description: Implement the DownUp class. Method signatures and docstrings: - def downsample1(activation_constructor, Cin, channel_small): First RAB downsample - def upsample1(activation_constructor, Cin, channel_small): First RAB upsample - def downsample2(ac...
b4d43895229205ee2cd16b15ee20beccb33b71d6
<|skeleton|> class DownUp: def downsample1(activation_constructor, Cin, channel_small): """First RAB downsample""" <|body_0|> def upsample1(activation_constructor, Cin, channel_small): """First RAB upsample""" <|body_1|> def downsample2(activation_constructor, Cin, channel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DownUp: def downsample1(activation_constructor, Cin, channel_small): """First RAB downsample""" conv1 = nn.Conv3d(Cin, Cin, kernel_size=(3, 2, 2), stride=(2, 2, 2)) conv2 = nn.Conv3d(Cin, Cin, kernel_size=(3, 3, 2), stride=(2, 2, 2), padding=(0, 0, 1)) conv3 = nn.Conv3d(Cin, Ci...
the_stack_v2_python_sparse
src/VarDACAE/nn/CLIC_models/tucodec.py
kikyoiii/Data_Assimilation
train
0
d1fb5f84538822f6219b18608e3ece32372eef08
[ "super().__init__(max_n_sources)\nself.matching_threshold = matching_threshold\nself.thresh = thresh", "wcs = blend_batch.wcs\nimage = blend_batch.blend_images[ii]\nbkg = sep.Background(image[0])\ncatalog = sep.extract(image[0], self.thresh, err=bkg.globalrms, segmentation_map=False)\nra_coordinates, dec_coordina...
<|body_start_0|> super().__init__(max_n_sources) self.matching_threshold = matching_threshold self.thresh = thresh <|end_body_0|> <|body_start_1|> wcs = blend_batch.wcs image = blend_batch.blend_images[ii] bkg = sep.Background(image[0]) catalog = sep.extract(imag...
This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algorithm to calculate the angular distance ...
SepMultiband
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SepMultiband: """This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algo...
stack_v2_sparse_classes_10k_train_005613
24,907
permissive
[ { "docstring": "Initialize the SepMultiband measurement function. Args: max_n_sources: See parent class. matching_threshold: Threshold value for match detections that are close (arcsecs). thresh: See `SepSingleBand` class.", "name": "__init__", "signature": "def __init__(self, max_n_sources: int, matchi...
2
stack_v2_sparse_classes_30k_train_000059
Implement the Python class `SepMultiband` described below. Class description: This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repe...
Implement the Python class `SepMultiband` described below. Class description: This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repe...
f5b716a373f130238100db8980aa0d282822983a
<|skeleton|> class SepMultiband: """This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SepMultiband: """This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algorithm to calc...
the_stack_v2_python_sparse
btk/deblend.py
LSSTDESC/BlendingToolKit
train
22
ac6bd7d74c96158fb125a67695b9ef3d2d73ac33
[ "dp = [0, 1, 2, 3]\nres = [0, 1, 1, 2]\nif n < 4:\n return res[n]\nres = 0\nfor i in range(4, n + 1):\n temp = 0\n for j in range(1, i // 2 + 1):\n temp = max(temp, dp[j] * dp[i - j])\n dp.append(temp)\nreturn dp[-1]", "res = [0, 1, 1, 2]\nif n < 4:\n return res[n]\nif n % 3 == 1:\n num3 ...
<|body_start_0|> dp = [0, 1, 2, 3] res = [0, 1, 1, 2] if n < 4: return res[n] res = 0 for i in range(4, n + 1): temp = 0 for j in range(1, i // 2 + 1): temp = max(temp, dp[j] * dp[i - j]) dp.append(temp) retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def cuttingRope(self, n): """动态规划: dp[j] 长度为j的最大积; dp[j] = max(dp[i]*dp[j-i]) i = 0, 1_最短回文串.py, ... ,j//2. 边界 dp[0] = 0 dp[1_最短回文串.py] = 1_最短回文串.py dp[2] = 2 dp[3] = 3 res = dp[-1_最短回文串.py] 时间 O(n^2) 空间 O(n)""" <|body_0|> def cuttingRope(self, n): """贪心算法:...
stack_v2_sparse_classes_10k_train_005614
1,430
no_license
[ { "docstring": "动态规划: dp[j] 长度为j的最大积; dp[j] = max(dp[i]*dp[j-i]) i = 0, 1_最短回文串.py, ... ,j//2. 边界 dp[0] = 0 dp[1_最短回文串.py] = 1_最短回文串.py dp[2] = 2 dp[3] = 3 res = dp[-1_最短回文串.py] 时间 O(n^2) 空间 O(n)", "name": "cuttingRope", "signature": "def cuttingRope(self, n)" }, { "docstring": "贪心算法: i = 1_最短回文...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope(self, n): 动态规划: dp[j] 长度为j的最大积; dp[j] = max(dp[i]*dp[j-i]) i = 0, 1_最短回文串.py, ... ,j//2. 边界 dp[0] = 0 dp[1_最短回文串.py] = 1_最短回文串.py dp[2] = 2 dp[3] = 3 res = dp[-1_...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope(self, n): 动态规划: dp[j] 长度为j的最大积; dp[j] = max(dp[i]*dp[j-i]) i = 0, 1_最短回文串.py, ... ,j//2. 边界 dp[0] = 0 dp[1_最短回文串.py] = 1_最短回文串.py dp[2] = 2 dp[3] = 3 res = dp[-1_...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def cuttingRope(self, n): """动态规划: dp[j] 长度为j的最大积; dp[j] = max(dp[i]*dp[j-i]) i = 0, 1_最短回文串.py, ... ,j//2. 边界 dp[0] = 0 dp[1_最短回文串.py] = 1_最短回文串.py dp[2] = 2 dp[3] = 3 res = dp[-1_最短回文串.py] 时间 O(n^2) 空间 O(n)""" <|body_0|> def cuttingRope(self, n): """贪心算法:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def cuttingRope(self, n): """动态规划: dp[j] 长度为j的最大积; dp[j] = max(dp[i]*dp[j-i]) i = 0, 1_最短回文串.py, ... ,j//2. 边界 dp[0] = 0 dp[1_最短回文串.py] = 1_最短回文串.py dp[2] = 2 dp[3] = 3 res = dp[-1_最短回文串.py] 时间 O(n^2) 空间 O(n)""" dp = [0, 1, 2, 3] res = [0, 1, 1, 2] if n < 4: ...
the_stack_v2_python_sparse
4_LEETCODE/7_MATH/剪绳子.py
fzingithub/SwordRefers2Offer
train
1
1e76a3c1c36a4743b60513081e1b28e6cb68ee10
[ "self.d = collections.defaultdict(set)\nself.u = collections.defaultdict(set)\nself.pool = []", "idx = len(self.u) + 1\nif self.pool:\n idx = heapq.heappop(self.pool)\nself.u[idx] = set(ownedChunks)\nfor x in ownedChunks:\n self.d[x].add(idx)\nreturn idx", "if userID not in self.u:\n return\nfor c in s...
<|body_start_0|> self.d = collections.defaultdict(set) self.u = collections.defaultdict(set) self.pool = [] <|end_body_0|> <|body_start_1|> idx = len(self.u) + 1 if self.pool: idx = heapq.heappop(self.pool) self.u[idx] = set(ownedChunks) for x in owne...
FileSharing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSharing: def __init__(self, m): """:type m: int""" <|body_0|> def join(self, ownedChunks): """:type ownedChunks: List[int] :rtype: int""" <|body_1|> def leave(self, userID): """:type userID: int :rtype: None""" <|body_2|> def req...
stack_v2_sparse_classes_10k_train_005615
1,412
no_license
[ { "docstring": ":type m: int", "name": "__init__", "signature": "def __init__(self, m)" }, { "docstring": ":type ownedChunks: List[int] :rtype: int", "name": "join", "signature": "def join(self, ownedChunks)" }, { "docstring": ":type userID: int :rtype: None", "name": "leave"...
4
null
Implement the Python class `FileSharing` described below. Class description: Implement the FileSharing class. Method signatures and docstrings: - def __init__(self, m): :type m: int - def join(self, ownedChunks): :type ownedChunks: List[int] :rtype: int - def leave(self, userID): :type userID: int :rtype: None - def ...
Implement the Python class `FileSharing` described below. Class description: Implement the FileSharing class. Method signatures and docstrings: - def __init__(self, m): :type m: int - def join(self, ownedChunks): :type ownedChunks: List[int] :rtype: int - def leave(self, userID): :type userID: int :rtype: None - def ...
20623defecf65cbc35b194d8b60d8b211816ee4f
<|skeleton|> class FileSharing: def __init__(self, m): """:type m: int""" <|body_0|> def join(self, ownedChunks): """:type ownedChunks: List[int] :rtype: int""" <|body_1|> def leave(self, userID): """:type userID: int :rtype: None""" <|body_2|> def req...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileSharing: def __init__(self, m): """:type m: int""" self.d = collections.defaultdict(set) self.u = collections.defaultdict(set) self.pool = [] def join(self, ownedChunks): """:type ownedChunks: List[int] :rtype: int""" idx = len(self.u) + 1 if se...
the_stack_v2_python_sparse
in_Python/1500 Design a File Sharing System.py
YangLiyli131/Leetcode2020
train
0
927b0c960263c119595be0c7410d4ed40e6b0e9d
[ "nums = [i for i in range(1, k + 1)]\nnums.append(n + 1)\nleft, output = (0, [])\nwhile left < k:\n output.append(nums[:k])\n left = 0\n while left < k and nums[left] + 1 == nums[left + 1]:\n nums[left] = left + 1\n left += 1\n nums[left] += 1\nreturn output", "def back_track(first=1, co...
<|body_start_0|> nums = [i for i in range(1, k + 1)] nums.append(n + 1) left, output = (0, []) while left < k: output.append(nums[:k]) left = 0 while left < k and nums[left] + 1 == nums[left + 1]: nums[left] = left + 1 l...
Combination
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Combination: def get_all(self, n: int, k: int) -> List[List[int]]: """Approach: Lexographic Binary Sorted Combinations Time Complexity: O (k C(k, n)) Space Complexity: O (C(k, n)) :param n: :param k: :return:""" <|body_0|> def get_all_(self, n: int, k: int) -> List[List[int]...
stack_v2_sparse_classes_10k_train_005616
1,812
no_license
[ { "docstring": "Approach: Lexographic Binary Sorted Combinations Time Complexity: O (k C(k, n)) Space Complexity: O (C(k, n)) :param n: :param k: :return:", "name": "get_all", "signature": "def get_all(self, n: int, k: int) -> List[List[int]]" }, { "docstring": "Approach: Back Tracking Time Comp...
2
null
Implement the Python class `Combination` described below. Class description: Implement the Combination class. Method signatures and docstrings: - def get_all(self, n: int, k: int) -> List[List[int]]: Approach: Lexographic Binary Sorted Combinations Time Complexity: O (k C(k, n)) Space Complexity: O (C(k, n)) :param n...
Implement the Python class `Combination` described below. Class description: Implement the Combination class. Method signatures and docstrings: - def get_all(self, n: int, k: int) -> List[List[int]]: Approach: Lexographic Binary Sorted Combinations Time Complexity: O (k C(k, n)) Space Complexity: O (C(k, n)) :param n...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Combination: def get_all(self, n: int, k: int) -> List[List[int]]: """Approach: Lexographic Binary Sorted Combinations Time Complexity: O (k C(k, n)) Space Complexity: O (C(k, n)) :param n: :param k: :return:""" <|body_0|> def get_all_(self, n: int, k: int) -> List[List[int]...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Combination: def get_all(self, n: int, k: int) -> List[List[int]]: """Approach: Lexographic Binary Sorted Combinations Time Complexity: O (k C(k, n)) Space Complexity: O (C(k, n)) :param n: :param k: :return:""" nums = [i for i in range(1, k + 1)] nums.append(n + 1) left, outpu...
the_stack_v2_python_sparse
revisited/permutations_combinations_subsets/combinations.py
Shiv2157k/leet_code
train
1
bc0c37a5a6bf26fda0a65dfba39db72884249506
[ "from ..document import DocumentArray\nfrom ....helper import dunder_get\nrv = defaultdict(DocumentArray)\nfor doc in self:\n if '__' in tag:\n value = dunder_get(doc.tags, tag)\n elif tag in doc.tags:\n value = doc.tags[tag]\n else:\n continue\n rv[value].append(doc)\nreturn dict(r...
<|body_start_0|> from ..document import DocumentArray from ....helper import dunder_get rv = defaultdict(DocumentArray) for doc in self: if '__' in tag: value = dunder_get(doc.tags, tag) elif tag in doc.tags: value = doc.tags[tag] ...
These helpers yield groups of :class:`DocumentArray` from a source :class:`DocumentArray` or :class:`DocumentArrayMemmap`.
GroupMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupMixin: """These helpers yield groups of :class:`DocumentArray` from a source :class:`DocumentArray` or :class:`DocumentArrayMemmap`.""" def split(self, tag: str) -> Dict[Any, 'DocumentArray']: """Split the `DocumentArray` into multiple DocumentArray according to the tag value of...
stack_v2_sparse_classes_10k_train_005617
2,509
permissive
[ { "docstring": "Split the `DocumentArray` into multiple DocumentArray according to the tag value of each `Document`. :param tag: the tag name to split stored in tags. :return: a dict where Documents with the same value on `tag` are grouped together, their orders are preserved from the original :class:`DocumentA...
2
stack_v2_sparse_classes_30k_train_003526
Implement the Python class `GroupMixin` described below. Class description: These helpers yield groups of :class:`DocumentArray` from a source :class:`DocumentArray` or :class:`DocumentArrayMemmap`. Method signatures and docstrings: - def split(self, tag: str) -> Dict[Any, 'DocumentArray']: Split the `DocumentArray` ...
Implement the Python class `GroupMixin` described below. Class description: These helpers yield groups of :class:`DocumentArray` from a source :class:`DocumentArray` or :class:`DocumentArrayMemmap`. Method signatures and docstrings: - def split(self, tag: str) -> Dict[Any, 'DocumentArray']: Split the `DocumentArray` ...
34c34acfb0115ad2ec4cc8e2e9a86c521855612f
<|skeleton|> class GroupMixin: """These helpers yield groups of :class:`DocumentArray` from a source :class:`DocumentArray` or :class:`DocumentArrayMemmap`.""" def split(self, tag: str) -> Dict[Any, 'DocumentArray']: """Split the `DocumentArray` into multiple DocumentArray according to the tag value of...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupMixin: """These helpers yield groups of :class:`DocumentArray` from a source :class:`DocumentArray` or :class:`DocumentArrayMemmap`.""" def split(self, tag: str) -> Dict[Any, 'DocumentArray']: """Split the `DocumentArray` into multiple DocumentArray according to the tag value of each `Docume...
the_stack_v2_python_sparse
jina/types/arrays/mixins/group.py
amitesh1as/jina
train
0
d675ffb926b6f8f2fb131440c062b5fa10eee2f4
[ "super().__init__()\nself.up = nn.ConvTranspose2d(in_channels, in_channels, kernel_size=2, stride=2)\nself.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)", "x = self.up(x)\nx = self.conv(x)\nx = F.relu(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.up = nn.ConvTranspose2d(in_channels, in_channels, kernel_size=2, stride=2) self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1) <|end_body_0|> <|body_start_1|> x = self.up(x) x = self.conv(x) x = F.relu(x) ...
Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.
UpConvBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpConvBlock: """Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.""" def __init__(self, in_channels, out_channels): """Init. ...
stack_v2_sparse_classes_10k_train_005618
10,936
no_license
[ { "docstring": "Init. Args: in_channels(int): Input channels. out_channels(int): Output channels.", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels)" }, { "docstring": "Forward pass. Args: x(torch.Tensor): Input data. Returns: torch.Tensor: Activations.", "name...
2
stack_v2_sparse_classes_30k_train_000074
Implement the Python class `UpConvBlock` described below. Class description: Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user. Method signatures and docstrings...
Implement the Python class `UpConvBlock` described below. Class description: Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user. Method signatures and docstrings...
9027b529eaa4cf0a38f25512141810f92db99639
<|skeleton|> class UpConvBlock: """Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.""" def __init__(self, in_channels, out_channels): """Init. ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpConvBlock: """Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.""" def __init__(self, in_channels, out_channels): """Init. Args: in_chan...
the_stack_v2_python_sparse
grae/models/torch_modules.py
jakerhodes/GRAE
train
0
e5d62b559d6e309344d0247a1420de4adffcd386
[ "super(FramePredNet, self).__init__()\ndim = len(vol_size)\nself.unet_model = Unet(vol_size, [enc_nf, dec_nf])\nconv_fn = getattr(nn, 'Conv%dd' % dim)\nself.flow = conv_fn(dec_nf[-1], dim, kernel_size=3, padding=1)\nnd = Normal(0, 1e-05)\nself.flow.weight = nn.Parameter(nd.sample(self.flow.weight.shape))\nself.flow...
<|body_start_0|> super(FramePredNet, self).__init__() dim = len(vol_size) self.unet_model = Unet(vol_size, [enc_nf, dec_nf]) conv_fn = getattr(nn, 'Conv%dd' % dim) self.flow = conv_fn(dec_nf[-1], dim, kernel_size=3, padding=1) nd = Normal(0, 1e-05) self.flow.weigh...
"" implementation of voxelmorph.
FramePredNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FramePredNet: """"" implementation of voxelmorph.""" def __init__(self, vol_size, enc_nf, dec_nf, full_size=True): """:param vol_size: volume size of the atlas :param enc_nf: the number of features maps for encoding stages :param dec_nf: the number of features maps for decoding stage...
stack_v2_sparse_classes_10k_train_005619
8,888
permissive
[ { "docstring": ":param vol_size: volume size of the atlas :param enc_nf: the number of features maps for encoding stages :param dec_nf: the number of features maps for decoding stages :param full_size: boolean value full amount of decoding layers", "name": "__init__", "signature": "def __init__(self, vo...
2
stack_v2_sparse_classes_30k_train_002454
Implement the Python class `FramePredNet` described below. Class description: "" implementation of voxelmorph. Method signatures and docstrings: - def __init__(self, vol_size, enc_nf, dec_nf, full_size=True): :param vol_size: volume size of the atlas :param enc_nf: the number of features maps for encoding stages :par...
Implement the Python class `FramePredNet` described below. Class description: "" implementation of voxelmorph. Method signatures and docstrings: - def __init__(self, vol_size, enc_nf, dec_nf, full_size=True): :param vol_size: volume size of the atlas :param enc_nf: the number of features maps for encoding stages :par...
730f7dff2239ef716841390311b5b9250149acaf
<|skeleton|> class FramePredNet: """"" implementation of voxelmorph.""" def __init__(self, vol_size, enc_nf, dec_nf, full_size=True): """:param vol_size: volume size of the atlas :param enc_nf: the number of features maps for encoding stages :param dec_nf: the number of features maps for decoding stage...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FramePredNet: """"" implementation of voxelmorph.""" def __init__(self, vol_size, enc_nf, dec_nf, full_size=True): """:param vol_size: volume size of the atlas :param enc_nf: the number of features maps for encoding stages :param dec_nf: the number of features maps for decoding stages :param full...
the_stack_v2_python_sparse
annolid/motion/deformation.py
healthonrails/annolid
train
25
375710431123c81b4a5cb981bcca1f4ecbc9bf97
[ "address = quote_plus(address, safe=',')\nmaps_address = 'http://maps.apple.com/?address=' + address\nprocess = Popen(['open', '-a', 'Maps', maps_address], stdout=PIPE, stderr=PIPE)\nstdout, stderr = process.communicate()", "name = kwargs.get('name', 'Selected Location')\nmaps_address = 'http://maps.apple.com/?ll...
<|body_start_0|> address = quote_plus(address, safe=',') maps_address = 'http://maps.apple.com/?address=' + address process = Popen(['open', '-a', 'Maps', maps_address], stdout=PIPE, stderr=PIPE) stdout, stderr = process.communicate() <|end_body_0|> <|body_start_1|> name = kwarg...
Implementation of MacOS Maps API.
MacOSMaps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSMaps: """Implementation of MacOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" <|body_0|> def _open_by_lat_long(self, latitude, longitude, **kwargs): """Open a coordinate ...
stack_v2_sparse_classes_10k_train_005620
2,777
permissive
[ { "docstring": ":param address: An address string that geolocation can understand.", "name": "_open_by_address", "signature": "def _open_by_address(self, address, **kwargs)" }, { "docstring": "Open a coordinate span denoting a latitudinal delta and a longitudinal delta (similar to MKCoordinateSp...
4
stack_v2_sparse_classes_30k_test_000293
Implement the Python class `MacOSMaps` described below. Class description: Implementation of MacOS Maps API. Method signatures and docstrings: - def _open_by_address(self, address, **kwargs): :param address: An address string that geolocation can understand. - def _open_by_lat_long(self, latitude, longitude, **kwargs...
Implement the Python class `MacOSMaps` described below. Class description: Implementation of MacOS Maps API. Method signatures and docstrings: - def _open_by_address(self, address, **kwargs): :param address: An address string that geolocation can understand. - def _open_by_lat_long(self, latitude, longitude, **kwargs...
d8a2b3d16b12fc54667744a092a453ad007c9448
<|skeleton|> class MacOSMaps: """Implementation of MacOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" <|body_0|> def _open_by_lat_long(self, latitude, longitude, **kwargs): """Open a coordinate ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MacOSMaps: """Implementation of MacOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" address = quote_plus(address, safe=',') maps_address = 'http://maps.apple.com/?address=' + address pro...
the_stack_v2_python_sparse
plyer/platforms/macosx/maps.py
kivy/plyer
train
1,516
66b0d04f9ff8ff6a25a73968d0081278f7593e60
[ "context = super(EntitiesView, self).get_context_data(**kwargs)\ncontext['entities'] = get_entities_list(self.request.session.get('token', False), self.kwargs.get('aiid')).get('entities')\ncontext['allow_regex'] = get_experiments_list(self.request.session.get('token', False), self.kwargs.get('aiid', False), 'regex-...
<|body_start_0|> context = super(EntitiesView, self).get_context_data(**kwargs) context['entities'] = get_entities_list(self.request.session.get('token', False), self.kwargs.get('aiid')).get('entities') context['allow_regex'] = get_experiments_list(self.request.session.get('token', False), self....
Manage AI Entities
EntitiesView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitiesView: """Manage AI Entities""" def get_context_data(self, **kwargs): """Update context with Entities list""" <|body_0|> def form_valid(self, form): """Try to save Entity, can still be invalid""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_005621
39,842
permissive
[ { "docstring": "Update context with Entities list", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Try to save Entity, can still be invalid", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_004029
Implement the Python class `EntitiesView` described below. Class description: Manage AI Entities Method signatures and docstrings: - def get_context_data(self, **kwargs): Update context with Entities list - def form_valid(self, form): Try to save Entity, can still be invalid
Implement the Python class `EntitiesView` described below. Class description: Manage AI Entities Method signatures and docstrings: - def get_context_data(self, **kwargs): Update context with Entities list - def form_valid(self, form): Try to save Entity, can still be invalid <|skeleton|> class EntitiesView: """M...
d632d00f9a22a7a826bba4896a7102b2ac8690ff
<|skeleton|> class EntitiesView: """Manage AI Entities""" def get_context_data(self, **kwargs): """Update context with Entities list""" <|body_0|> def form_valid(self, form): """Try to save Entity, can still be invalid""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EntitiesView: """Manage AI Entities""" def get_context_data(self, **kwargs): """Update context with Entities list""" context = super(EntitiesView, self).get_context_data(**kwargs) context['entities'] = get_entities_list(self.request.session.get('token', False), self.kwargs.get('ai...
the_stack_v2_python_sparse
src/studio/views.py
hutomadotAI/web-console
train
6
108f43c66759048a97dae04fec1ee194899ac6f6
[ "param_names = ['C10', 'C01', 'D1']\nself.params = {}\nfor param_name in param_names:\n value = parameters.pop(param_name, 0.0)\n self.params[param_name] = value\nif parameters:\n unused = ', '.join(parameters.keys())\n logger.warning('Unused parameters: {0}'.format(unused))\nC10 = self.params['C10']\nC...
<|body_start_0|> param_names = ['C10', 'C01', 'D1'] self.params = {} for param_name in param_names: value = parameters.pop(param_name, 0.0) self.params[param_name] = value if parameters: unused = ', '.join(parameters.keys()) logger.warning(...
MooneyRivlinMaterial
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MooneyRivlinMaterial: def __init__(self, **parameters): """Set up the Mooney Rivlin material""" <|body_0|> def eval(self, time, dtime, temp, dtemp, F0, F, stran, d, stress, statev, **kwargs): """Compute updated stress given the updated deformation""" <|body_1...
stack_v2_sparse_classes_10k_train_005622
2,427
permissive
[ { "docstring": "Set up the Mooney Rivlin material", "name": "__init__", "signature": "def __init__(self, **parameters)" }, { "docstring": "Compute updated stress given the updated deformation", "name": "eval", "signature": "def eval(self, time, dtime, temp, dtemp, F0, F, stran, d, stress...
2
stack_v2_sparse_classes_30k_train_005842
Implement the Python class `MooneyRivlinMaterial` described below. Class description: Implement the MooneyRivlinMaterial class. Method signatures and docstrings: - def __init__(self, **parameters): Set up the Mooney Rivlin material - def eval(self, time, dtime, temp, dtemp, F0, F, stran, d, stress, statev, **kwargs):...
Implement the Python class `MooneyRivlinMaterial` described below. Class description: Implement the MooneyRivlinMaterial class. Method signatures and docstrings: - def __init__(self, **parameters): Set up the Mooney Rivlin material - def eval(self, time, dtime, temp, dtemp, F0, F, stran, d, stress, statev, **kwargs):...
e411b010eead10d74825589ba94ab5e99368acef
<|skeleton|> class MooneyRivlinMaterial: def __init__(self, **parameters): """Set up the Mooney Rivlin material""" <|body_0|> def eval(self, time, dtime, temp, dtemp, F0, F, stran, d, stress, statev, **kwargs): """Compute updated stress given the updated deformation""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MooneyRivlinMaterial: def __init__(self, **parameters): """Set up the Mooney Rivlin material""" param_names = ['C10', 'C01', 'D1'] self.params = {} for param_name in param_names: value = parameters.pop(param_name, 0.0) self.params[param_name] = value ...
the_stack_v2_python_sparse
matmodlab2/materials/mooney_rivlin.py
matmodlab/matmodlab2
train
9
1ab47f31e7f5c7a58b9712232d5a075a35518333
[ "indexes = []\nfor collection_name in self.collections():\n if collection and collection != collection_name:\n continue\n for index_name in self.db[collection_name].index_information():\n if index_name != '_id_':\n indexes.append(index_name)\nreturn indexes", "LOG.info(f'Adding inde...
<|body_start_0|> indexes = [] for collection_name in self.collections(): if collection and collection != collection_name: continue for index_name in self.db[collection_name].index_information(): if index_name != '_id_': indexes....
IndexHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexHandler: def indexes(self, collection=None): """Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection(str) Returns: indexes(list)""" <|body_0|> def load_indexes(self, collections=[]): """Add the proper indexes to the scout insta...
stack_v2_sparse_classes_10k_train_005623
3,577
permissive
[ { "docstring": "Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection(str) Returns: indexes(list)", "name": "indexes", "signature": "def indexes(self, collection=None)" }, { "docstring": "Add the proper indexes to the scout instance. Args: collections(list): lis...
4
stack_v2_sparse_classes_30k_train_004383
Implement the Python class `IndexHandler` described below. Class description: Implement the IndexHandler class. Method signatures and docstrings: - def indexes(self, collection=None): Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection(str) Returns: indexes(list) - def load_indexes...
Implement the Python class `IndexHandler` described below. Class description: Implement the IndexHandler class. Method signatures and docstrings: - def indexes(self, collection=None): Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection(str) Returns: indexes(list) - def load_indexes...
1e6a633ba0a83495047ee7b66db1ebf690ee465f
<|skeleton|> class IndexHandler: def indexes(self, collection=None): """Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection(str) Returns: indexes(list)""" <|body_0|> def load_indexes(self, collections=[]): """Add the proper indexes to the scout insta...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IndexHandler: def indexes(self, collection=None): """Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection(str) Returns: indexes(list)""" indexes = [] for collection_name in self.collections(): if collection and collection != collection_nam...
the_stack_v2_python_sparse
scout/adapter/mongo/index.py
Clinical-Genomics/scout
train
143
e24408eaacadad5351b7586dd9456db3eda5c912
[ "if not is_basic_identifier(object_type.name):\n raise BadRequest('Invalid object_type name: %s' % object_type.name)\nif not is_yaml_string_valid(object_type.definition):\n raise BadRequest('Invalid YAML definition')\nobject_type_id, version = self.clients.resource_registry.create(object_type)\nreturn object_...
<|body_start_0|> if not is_basic_identifier(object_type.name): raise BadRequest('Invalid object_type name: %s' % object_type.name) if not is_yaml_string_valid(object_type.definition): raise BadRequest('Invalid YAML definition') object_type_id, version = self.clients.resou...
A service for defining and managing object types used as resource, messages, etc.
ObjectManagementService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectManagementService: """A service for defining and managing object types used as resource, messages, etc.""" def create_object_type(self, object_type=None): """Should receive an ObjectType object""" <|body_0|> def update_object_type(self, object_type=None): "...
stack_v2_sparse_classes_10k_train_005624
2,353
no_license
[ { "docstring": "Should receive an ObjectType object", "name": "create_object_type", "signature": "def create_object_type(self, object_type=None)" }, { "docstring": "Should receive an ObjectType object", "name": "update_object_type", "signature": "def update_object_type(self, object_type=...
4
stack_v2_sparse_classes_30k_train_003843
Implement the Python class `ObjectManagementService` described below. Class description: A service for defining and managing object types used as resource, messages, etc. Method signatures and docstrings: - def create_object_type(self, object_type=None): Should receive an ObjectType object - def update_object_type(se...
Implement the Python class `ObjectManagementService` described below. Class description: A service for defining and managing object types used as resource, messages, etc. Method signatures and docstrings: - def create_object_type(self, object_type=None): Should receive an ObjectType object - def update_object_type(se...
1693081ddaacd4e72c75ab47c0289a04f08ca6c9
<|skeleton|> class ObjectManagementService: """A service for defining and managing object types used as resource, messages, etc.""" def create_object_type(self, object_type=None): """Should receive an ObjectType object""" <|body_0|> def update_object_type(self, object_type=None): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjectManagementService: """A service for defining and managing object types used as resource, messages, etc.""" def create_object_type(self, object_type=None): """Should receive an ObjectType object""" if not is_basic_identifier(object_type.name): raise BadRequest('Invalid ob...
the_stack_v2_python_sparse
ion/services/coi/object_management_service.py
sfoley/coi-services
train
1
6020c3f6d71c7685417a2b3493419b6c3a5f7197
[ "left, right = (0, len(nums) - 1)\nwhile right > left:\n if nums[right] > nums[left]:\n return nums[left]\n else:\n mid = (right + left) // 2\n if nums[mid] >= nums[left]:\n left = mid + 1\n else:\n right = mid\nreturn nums[left]", "left, right = (0, len(num...
<|body_start_0|> left, right = (0, len(nums) - 1) while right > left: if nums[right] > nums[left]: return nums[left] else: mid = (right + left) // 2 if nums[mid] >= nums[left]: left = mid + 1 else...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMin(self, nums): """no duplicate :type nums: List[int] :rtype: int""" <|body_0|> def findMin1(self, nums): """may have duplicates :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left, right = (0, l...
stack_v2_sparse_classes_10k_train_005625
1,244
no_license
[ { "docstring": "no duplicate :type nums: List[int] :rtype: int", "name": "findMin", "signature": "def findMin(self, nums)" }, { "docstring": "may have duplicates :type nums: List[int] :rtype: int", "name": "findMin1", "signature": "def findMin1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002349
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): no duplicate :type nums: List[int] :rtype: int - def findMin1(self, nums): may have duplicates :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): no duplicate :type nums: List[int] :rtype: int - def findMin1(self, nums): may have duplicates :type nums: List[int] :rtype: int <|skeleton|> class Solu...
c9fb0b623501b3746444b05da55405e3a6c42bbf
<|skeleton|> class Solution: def findMin(self, nums): """no duplicate :type nums: List[int] :rtype: int""" <|body_0|> def findMin1(self, nums): """may have duplicates :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMin(self, nums): """no duplicate :type nums: List[int] :rtype: int""" left, right = (0, len(nums) - 1) while right > left: if nums[right] > nums[left]: return nums[left] else: mid = (right + left) // 2 ...
the_stack_v2_python_sparse
Archive-1/FindMinimuminRotatedSortedArray.py
smsxgz/my-leetcode
train
0
1ff5cf19221fcaf3017c0cc3f48325da8afe2ce5
[ "args = entity_parser.parse_args()\npage = args['page']\nper_page = args['per_page']\nsort_order = args['order']\nif per_page > 100:\n per_page = 100\ndescending = sort_order == 'desc'\nstart = per_page * (page - 1)\nstop = start + per_page\nkwargs = {'start': start, 'stop': stop, 'descending': descending, 'sess...
<|body_start_0|> args = entity_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_order = args['order'] if per_page > 100: per_page = 100 descending = sort_order == 'desc' start = per_page * (page - 1) stop = start + per_p...
SeriesEpisodesAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeriesEpisodesAPI: def get(self, show_id, session): """Get episodes by show ID""" <|body_0|> def delete(self, show_id, session): """Deletes all episodes of a show""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = entity_parser.parse_args() ...
stack_v2_sparse_classes_10k_train_005626
47,001
permissive
[ { "docstring": "Get episodes by show ID", "name": "get", "signature": "def get(self, show_id, session)" }, { "docstring": "Deletes all episodes of a show", "name": "delete", "signature": "def delete(self, show_id, session)" } ]
2
stack_v2_sparse_classes_30k_train_002817
Implement the Python class `SeriesEpisodesAPI` described below. Class description: Implement the SeriesEpisodesAPI class. Method signatures and docstrings: - def get(self, show_id, session): Get episodes by show ID - def delete(self, show_id, session): Deletes all episodes of a show
Implement the Python class `SeriesEpisodesAPI` described below. Class description: Implement the SeriesEpisodesAPI class. Method signatures and docstrings: - def get(self, show_id, session): Get episodes by show ID - def delete(self, show_id, session): Deletes all episodes of a show <|skeleton|> class SeriesEpisodes...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class SeriesEpisodesAPI: def get(self, show_id, session): """Get episodes by show ID""" <|body_0|> def delete(self, show_id, session): """Deletes all episodes of a show""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SeriesEpisodesAPI: def get(self, show_id, session): """Get episodes by show ID""" args = entity_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_order = args['order'] if per_page > 100: per_page = 100 descending = sort...
the_stack_v2_python_sparse
flexget/components/series/api.py
BrutuZ/Flexget
train
1
a633699ff4bf888ffd3e50e4216654aabe4b0eff
[ "super().__init__(grid_sys, pi_star)\nself.name = 'Epsilon Greedy Controller'\nself.epsilon = epsilon", "x = y\nif np.random.uniform(0, 1) < self.epsilon:\n u = self.lookup_table_selection(x)\nelse:\n random_index = int(np.random.uniform(0, self.grid_sys.actions_n))\n u = self.grid_sys.input_from_action_...
<|body_start_0|> super().__init__(grid_sys, pi_star) self.name = 'Epsilon Greedy Controller' self.epsilon = epsilon <|end_body_0|> <|body_start_1|> x = y if np.random.uniform(0, 1) < self.epsilon: u = self.lookup_table_selection(x) else: random_in...
EpsilonGreedyController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpsilonGreedyController: def __init__(self, grid_sys, pi_star, epsilon=0.7): """Pyro controller based on a discretized lookpup table of optimal control inputs where the optimal action is taken with probability espsilon, else a random action is taken. Parameters ---------- grid_sys : pyro...
stack_v2_sparse_classes_10k_train_005627
7,663
permissive
[ { "docstring": "Pyro controller based on a discretized lookpup table of optimal control inputs where the optimal action is taken with probability espsilon, else a random action is taken. Parameters ---------- grid_sys : pyro GridDynamicSystem class A discretized dynamic system pi_star : numpy array, dim = self....
2
stack_v2_sparse_classes_30k_train_001116
Implement the Python class `EpsilonGreedyController` described below. Class description: Implement the EpsilonGreedyController class. Method signatures and docstrings: - def __init__(self, grid_sys, pi_star, epsilon=0.7): Pyro controller based on a discretized lookpup table of optimal control inputs where the optimal...
Implement the Python class `EpsilonGreedyController` described below. Class description: Implement the EpsilonGreedyController class. Method signatures and docstrings: - def __init__(self, grid_sys, pi_star, epsilon=0.7): Pyro controller based on a discretized lookpup table of optimal control inputs where the optimal...
baed84610d6090d42b814183931709fcdf61d012
<|skeleton|> class EpsilonGreedyController: def __init__(self, grid_sys, pi_star, epsilon=0.7): """Pyro controller based on a discretized lookpup table of optimal control inputs where the optimal action is taken with probability espsilon, else a random action is taken. Parameters ---------- grid_sys : pyro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EpsilonGreedyController: def __init__(self, grid_sys, pi_star, epsilon=0.7): """Pyro controller based on a discretized lookpup table of optimal control inputs where the optimal action is taken with probability espsilon, else a random action is taken. Parameters ---------- grid_sys : pyro GridDynamicSy...
the_stack_v2_python_sparse
dev/reinforcement_learning/rl_tests/reinforcementlearning.py
SherbyRobotics/pyro
train
35
6117b6be55b0572460a81b2633823993623b1741
[ "super(LevelTwo, self).__init__(screen)\nself.villain_one = None\nself.villain_two = None\nself._set_villain()", "self.villain_one = donkey.Donkey(100, constants.THREE_Y, 0, 500)\nself.active_sprite_list.add(self.villain_one)\nself.villain_two = donkey.Donkey(900, constants.TWO_Y, 700, 950)\nself.active_sprite_li...
<|body_start_0|> super(LevelTwo, self).__init__(screen) self.villain_one = None self.villain_two = None self._set_villain() <|end_body_0|> <|body_start_1|> self.villain_one = donkey.Donkey(100, constants.THREE_Y, 0, 500) self.active_sprite_list.add(self.villain_one) ...
Class which defines the second level of the game
LevelTwo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LevelTwo: """Class which defines the second level of the game""" def __init__(self, screen): """Constructor for the LevelTwo class""" <|body_0|> def _set_villain(self): """Sets the number of donkeys and their positions for the second level of the game.""" ...
stack_v2_sparse_classes_10k_train_005628
1,964
no_license
[ { "docstring": "Constructor for the LevelTwo class", "name": "__init__", "signature": "def __init__(self, screen)" }, { "docstring": "Sets the number of donkeys and their positions for the second level of the game.", "name": "_set_villain", "signature": "def _set_villain(self)" } ]
2
stack_v2_sparse_classes_30k_train_004287
Implement the Python class `LevelTwo` described below. Class description: Class which defines the second level of the game Method signatures and docstrings: - def __init__(self, screen): Constructor for the LevelTwo class - def _set_villain(self): Sets the number of donkeys and their positions for the second level of...
Implement the Python class `LevelTwo` described below. Class description: Class which defines the second level of the game Method signatures and docstrings: - def __init__(self, screen): Constructor for the LevelTwo class - def _set_villain(self): Sets the number of donkeys and their positions for the second level of...
26d629f8348f0110fa84b02009e787a238aff441
<|skeleton|> class LevelTwo: """Class which defines the second level of the game""" def __init__(self, screen): """Constructor for the LevelTwo class""" <|body_0|> def _set_villain(self): """Sets the number of donkeys and their positions for the second level of the game.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LevelTwo: """Class which defines the second level of the game""" def __init__(self, screen): """Constructor for the LevelTwo class""" super(LevelTwo, self).__init__(screen) self.villain_one = None self.villain_two = None self._set_villain() def _set_villain(se...
the_stack_v2_python_sparse
IIITSERC-ssad_2015_a3_group1-88a823ccd2d0/Akshat Tandon/201503001/levels.py
anirudhdahiya9/Open-data-projecy
train
1
ae0c89122b0b25bb91f45d8b43586a5d87704185
[ "res = []\nself.dfs(root, res)\nreturn res", "if root:\n self.dfs(root.left, res)\n self.dfs(root.right, res)\n res.append(root.val)", "if not root:\n return []\nstack, res = ([root], [])\nwhile stack:\n node = stack.pop()\n if node.left:\n stack.append(node.left)\n if node.right:\n ...
<|body_start_0|> res = [] self.dfs(root, res) return res <|end_body_0|> <|body_start_1|> if root: self.dfs(root.left, res) self.dfs(root.right, res) res.append(root.val) <|end_body_1|> <|body_start_2|> if not root: return [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def dfs(self, root, res): """:type root: TreeNode :type res: List[int] :rtype: None""" <|body_1|> def postorderTraversal_1(self, root): """:type...
stack_v2_sparse_classes_10k_train_005629
2,233
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "postorderTraversal", "signature": "def postorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :type res: List[int] :rtype: None", "name": "dfs", "signature": "def dfs(self, root, res)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_000000
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def dfs(self, root, res): :type root: TreeNode :type res: List[int] :rtype: None - def postorderTrave...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def dfs(self, root, res): :type root: TreeNode :type res: List[int] :rtype: None - def postorderTrave...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def dfs(self, root, res): """:type root: TreeNode :type res: List[int] :rtype: None""" <|body_1|> def postorderTraversal_1(self, root): """:type...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" res = [] self.dfs(root, res) return res def dfs(self, root, res): """:type root: TreeNode :type res: List[int] :rtype: None""" if root: self.dfs(root.left...
the_stack_v2_python_sparse
Solutions/0145_postorderTraversal.py
YoupengLi/leetcode-sorting
train
3
1e023cefc27669de2717b7a35d426c2ec757767d
[ "if matrix == [[]] or matrix == []:\n return False\nrow_index = self.bin_search_row(0, len(matrix) - 1, matrix, target)\nif row_index == -1:\n return False\nreturn self.bin_search_column(0, len(matrix[row_index]) - 1, matrix[row_index], target)", "if start > end:\n return -1\nmid = (start + end) // 2\nif...
<|body_start_0|> if matrix == [[]] or matrix == []: return False row_index = self.bin_search_row(0, len(matrix) - 1, matrix, target) if row_index == -1: return False return self.bin_search_column(0, len(matrix[row_index]) - 1, matrix[row_index], target) <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def bin_search_row(self, start, end, matrix, target) -> int: """:type start: int :type end: int :type matrix: List[List[int]] :type target:...
stack_v2_sparse_classes_10k_train_005630
2,192
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": ":type start: int :type end: int :type matrix: List[List[int]] :type target: int :rtype: int", "name": "bin_search_ro...
3
stack_v2_sparse_classes_30k_train_006323
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def bin_search_row(self, start, end, matrix, target) -> int: :type start: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def bin_search_row(self, start, end, matrix, target) -> int: :type start: i...
f832227c4d0e0b1c0cc326561187004ef24e2a68
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def bin_search_row(self, start, end, matrix, target) -> int: """:type start: int :type end: int :type matrix: List[List[int]] :type target:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if matrix == [[]] or matrix == []: return False row_index = self.bin_search_row(0, len(matrix) - 1, matrix, target) if row_index == -1: r...
the_stack_v2_python_sparse
74.py
Gackle/leetcode_practice
train
0
e3f4f735002d3c56346bb79462ca2e4c58ac2e09
[ "username = ctx.bot.config.get('myanimelist_username')\npassword = ctx.bot.config.get('myanimelist_password')\nif not username or not password:\n await ctx.send('No username and/or password was found in the configuration.')\n return\nresult = await _mal_fetch(ctx.bot.session, 'manga', query, username, passwor...
<|body_start_0|> username = ctx.bot.config.get('myanimelist_username') password = ctx.bot.config.get('myanimelist_password') if not username or not password: await ctx.send('No username and/or password was found in the configuration.') return result = await _mal_f...
MyAnimeList lookup commands.
MyAnimeList
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyAnimeList: """MyAnimeList lookup commands.""" async def manga(self, ctx, *, query): """Search for manga.""" <|body_0|> async def anime(self, ctx, *, query): """Search for anime.""" <|body_1|> <|end_skeleton|> <|body_start_0|> username = ctx.bo...
stack_v2_sparse_classes_10k_train_005631
4,423
permissive
[ { "docstring": "Search for manga.", "name": "manga", "signature": "async def manga(self, ctx, *, query)" }, { "docstring": "Search for anime.", "name": "anime", "signature": "async def anime(self, ctx, *, query)" } ]
2
stack_v2_sparse_classes_30k_train_002486
Implement the Python class `MyAnimeList` described below. Class description: MyAnimeList lookup commands. Method signatures and docstrings: - async def manga(self, ctx, *, query): Search for manga. - async def anime(self, ctx, *, query): Search for anime.
Implement the Python class `MyAnimeList` described below. Class description: MyAnimeList lookup commands. Method signatures and docstrings: - async def manga(self, ctx, *, query): Search for manga. - async def anime(self, ctx, *, query): Search for anime. <|skeleton|> class MyAnimeList: """MyAnimeList lookup com...
9bf3f2125939b66bd1894e509c1b1fa1ab413a6a
<|skeleton|> class MyAnimeList: """MyAnimeList lookup commands.""" async def manga(self, ctx, *, query): """Search for manga.""" <|body_0|> async def anime(self, ctx, *, query): """Search for anime.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyAnimeList: """MyAnimeList lookup commands.""" async def manga(self, ctx, *, query): """Search for manga.""" username = ctx.bot.config.get('myanimelist_username') password = ctx.bot.config.get('myanimelist_password') if not username or not password: await ctx....
the_stack_v2_python_sparse
cogs/lookup/myanimelist.py
DasWolke/kitsuchan-2
train
1
4f807ecf4b13c17c3cd9fa1c44495ad70f500af2
[ "record = (yield self.directoryService().recordWithUID(groupUID))\nif record is None:\n returnValue(None)\ngroup = (yield GroupsRecord.create(self, name=name.encode('utf-8'), groupUID=groupUID.encode('utf-8'), membershipHash=membershipHash))\nyield self.refreshGroup(group, record)\nreturnValue(group)", "timest...
<|body_start_0|> record = (yield self.directoryService().recordWithUID(groupUID)) if record is None: returnValue(None) group = (yield GroupsRecord.create(self, name=name.encode('utf-8'), groupUID=groupUID.encode('utf-8'), membershipHash=membershipHash)) yield self.refreshGrou...
A mixin for L{CommonStoreTransaction} that covers the groups API.
GroupsAPIMixin
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupsAPIMixin: """A mixin for L{CommonStoreTransaction} that covers the groups API.""" def addGroup(self, groupUID, name, membershipHash): """@type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str}""" <|body_0|> def updateGroup(self, groupUID, nam...
stack_v2_sparse_classes_10k_train_005632
30,685
permissive
[ { "docstring": "@type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str}", "name": "addGroup", "signature": "def addGroup(self, groupUID, name, membershipHash)" }, { "docstring": "@type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str} @type extant: C...
4
null
Implement the Python class `GroupsAPIMixin` described below. Class description: A mixin for L{CommonStoreTransaction} that covers the groups API. Method signatures and docstrings: - def addGroup(self, groupUID, name, membershipHash): @type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str} - def...
Implement the Python class `GroupsAPIMixin` described below. Class description: A mixin for L{CommonStoreTransaction} that covers the groups API. Method signatures and docstrings: - def addGroup(self, groupUID, name, membershipHash): @type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str} - def...
cb2962f1f1927f1e52ea405094fa3e7e180f23cb
<|skeleton|> class GroupsAPIMixin: """A mixin for L{CommonStoreTransaction} that covers the groups API.""" def addGroup(self, groupUID, name, membershipHash): """@type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str}""" <|body_0|> def updateGroup(self, groupUID, nam...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupsAPIMixin: """A mixin for L{CommonStoreTransaction} that covers the groups API.""" def addGroup(self, groupUID, name, membershipHash): """@type groupUID: C{unicode} @type name: C{unicode} @type membershipHash: C{str}""" record = (yield self.directoryService().recordWithUID(groupUID))...
the_stack_v2_python_sparse
txdav/common/datastore/sql_directory.py
ass-a2s/ccs-calendarserver
train
2
8dc18a314224c615306e6e0f8b3b93d9062d961f
[ "client = LdapClient({'ldap_server_vendor': 'OpenLDAP', 'host': 'server_ip', 'connection_type': 'SSL', 'user_identifier_attribute': user_identifier_attribute})\nactual_result, dn = client._is_valid_dn(dn, client.USER_IDENTIFIER_ATTRIBUTE)\nassert (actual_result, dn) == expected_result", "client = LdapClient({'lda...
<|body_start_0|> client = LdapClient({'ldap_server_vendor': 'OpenLDAP', 'host': 'server_ip', 'connection_type': 'SSL', 'user_identifier_attribute': user_identifier_attribute}) actual_result, dn = client._is_valid_dn(dn, client.USER_IDENTIFIER_ATTRIBUTE) assert (actual_result, dn) == expected_res...
Contains unit tests for functions that deal with OpenLDAP server only.
TestsOpenLDAP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestsOpenLDAP: """Contains unit tests for functions that deal with OpenLDAP server only.""" def test_is_valid_dn(self, dn, user_identifier_attribute, expected_result): """Given: - A DN and a user identifier attribute: 1. A valid DN. 2. Invalid DN. When: - Running the '_is_valid_dn()'...
stack_v2_sparse_classes_10k_train_005633
12,670
permissive
[ { "docstring": "Given: - A DN and a user identifier attribute: 1. A valid DN. 2. Invalid DN. When: - Running the '_is_valid_dn()' function. Then: - Verify that the DN is parsed correctly and that the user returned as expected.", "name": "test_is_valid_dn", "signature": "def test_is_valid_dn(self, dn, us...
2
stack_v2_sparse_classes_30k_train_005768
Implement the Python class `TestsOpenLDAP` described below. Class description: Contains unit tests for functions that deal with OpenLDAP server only. Method signatures and docstrings: - def test_is_valid_dn(self, dn, user_identifier_attribute, expected_result): Given: - A DN and a user identifier attribute: 1. A vali...
Implement the Python class `TestsOpenLDAP` described below. Class description: Contains unit tests for functions that deal with OpenLDAP server only. Method signatures and docstrings: - def test_is_valid_dn(self, dn, user_identifier_attribute, expected_result): Given: - A DN and a user identifier attribute: 1. A vali...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestsOpenLDAP: """Contains unit tests for functions that deal with OpenLDAP server only.""" def test_is_valid_dn(self, dn, user_identifier_attribute, expected_result): """Given: - A DN and a user identifier attribute: 1. A valid DN. 2. Invalid DN. When: - Running the '_is_valid_dn()'...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestsOpenLDAP: """Contains unit tests for functions that deal with OpenLDAP server only.""" def test_is_valid_dn(self, dn, user_identifier_attribute, expected_result): """Given: - A DN and a user identifier attribute: 1. A valid DN. 2. Invalid DN. When: - Running the '_is_valid_dn()' function. Th...
the_stack_v2_python_sparse
Packs/OpenLDAP/Integrations/OpenLDAP/OpenLDAP_test.py
demisto/content
train
1,023
84f6f9206b1e7c91ec3abb807cff1a4b56950ce8
[ "data = {}\nif not self.url or '?' not in self.url:\n return data\nsplit_fields = self.url.replace('#info-right', '').split('?')[1].split('&')\nfor field in split_fields:\n pair = field.split('=')\n data[pair[0]] = pair[1]\nreturn data", "if not self.url:\n return None\nrow = self.parsed_url\nif row a...
<|body_start_0|> data = {} if not self.url or '?' not in self.url: return data split_fields = self.url.replace('#info-right', '').split('?')[1].split('&') for field in split_fields: pair = field.split('=') data[pair[0]] = pair[1] return data <|...
Abstract base class for disclosure-related interactions
DisclosureBase
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DisclosureBase: """Abstract base class for disclosure-related interactions""" def parsed_url(self): """parses a disclosure URL and returns a field:value dict""" <|body_0|> def school(self): """Returns a school object, derived from a feedback url""" <|body...
stack_v2_sparse_classes_10k_train_005634
31,435
permissive
[ { "docstring": "parses a disclosure URL and returns a field:value dict", "name": "parsed_url", "signature": "def parsed_url(self)" }, { "docstring": "Returns a school object, derived from a feedback url", "name": "school", "signature": "def school(self)" }, { "docstring": "Calcul...
5
null
Implement the Python class `DisclosureBase` described below. Class description: Abstract base class for disclosure-related interactions Method signatures and docstrings: - def parsed_url(self): parses a disclosure URL and returns a field:value dict - def school(self): Returns a school object, derived from a feedback ...
Implement the Python class `DisclosureBase` described below. Class description: Abstract base class for disclosure-related interactions Method signatures and docstrings: - def parsed_url(self): parses a disclosure URL and returns a field:value dict - def school(self): Returns a school object, derived from a feedback ...
7c63c31fd6bb95ed4f7d368f1e1252175f0c71ca
<|skeleton|> class DisclosureBase: """Abstract base class for disclosure-related interactions""" def parsed_url(self): """parses a disclosure URL and returns a field:value dict""" <|body_0|> def school(self): """Returns a school object, derived from a feedback url""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DisclosureBase: """Abstract base class for disclosure-related interactions""" def parsed_url(self): """parses a disclosure URL and returns a field:value dict""" data = {} if not self.url or '?' not in self.url: return data split_fields = self.url.replace('#info...
the_stack_v2_python_sparse
cfgov/paying_for_college/models/disclosures.py
raft-tech/cfgov-refresh
train
4
a853f6c0349144676faabd315be16355aeb06b4a
[ "i, count = (0, 1)\nl = len(nums)\nwhile i < l:\n num = nums[i]\n if 1 <= num < l and nums[num - 1] != nums[i]:\n nums[num - 1], nums[i] = (nums[i], nums[num - 1])\n else:\n i += 1\n while count - 1 < l and nums[count - 1] == count:\n count += 1\nreturn count", "n = len(nu...
<|body_start_0|> i, count = (0, 1) l = len(nums) while i < l: num = nums[i] if 1 <= num < l and nums[num - 1] != nums[i]: nums[num - 1], nums[i] = (nums[i], nums[num - 1]) else: i += 1 while count - 1 < l and num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstMissingPositive_solution_1(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove...
stack_v2_sparse_classes_10k_train_005635
9,733
no_license
[ { "docstring": ":type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove the rest. 2. we can use the array index as the hash to restore the frequency of each nu...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive_solution_1(self, nums: List[int]) -> int: :type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive mu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive_solution_1(self, nums: List[int]) -> int: :type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive mu...
f2621cd76822a922c49b60f32931f26cce1c571d
<|skeleton|> class Solution: def firstMissingPositive_solution_1(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def firstMissingPositive_solution_1(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int Basic idea: 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only have to care about those elements in this range and remove the rest. 2. ...
the_stack_v2_python_sparse
Arrays/032_leetcode_P_041_FirstMissingPositive/Solution.py
Keshav1506/competitive_programming
train
0
9110bedc176564f7addd91e554ea7f9de00eae54
[ "if config['lang'] != 'en':\n raise Exception('spaCy tokenizer is currently only allowed in English pipeline.')\ntry:\n import spacy\n from spacy.lang.en import English\nexcept ImportError:\n raise ImportError('spaCy 2.0+ is used but not installed on your machine. Go to https://spacy.io/usage for instal...
<|body_start_0|> if config['lang'] != 'en': raise Exception('spaCy tokenizer is currently only allowed in English pipeline.') try: import spacy from spacy.lang.en import English except ImportError: raise ImportError('spaCy 2.0+ is used but not inst...
SpacyTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpacyTokenizer: def __init__(self, config): """Construct a spaCy-based tokenizer by loading the spaCy pipeline.""" <|body_0|> def process(self, document): """Tokenize a document with the spaCy tokenizer and wrap the results into a Doc object.""" <|body_1|> <...
stack_v2_sparse_classes_10k_train_005636
2,724
permissive
[ { "docstring": "Construct a spaCy-based tokenizer by loading the spaCy pipeline.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Tokenize a document with the spaCy tokenizer and wrap the results into a Doc object.", "name": "process", "signature": "def ...
2
null
Implement the Python class `SpacyTokenizer` described below. Class description: Implement the SpacyTokenizer class. Method signatures and docstrings: - def __init__(self, config): Construct a spaCy-based tokenizer by loading the spaCy pipeline. - def process(self, document): Tokenize a document with the spaCy tokeniz...
Implement the Python class `SpacyTokenizer` described below. Class description: Implement the SpacyTokenizer class. Method signatures and docstrings: - def __init__(self, config): Construct a spaCy-based tokenizer by loading the spaCy pipeline. - def process(self, document): Tokenize a document with the spaCy tokeniz...
c530c9af647d521262b56b717bcc38b0cfc5f1b8
<|skeleton|> class SpacyTokenizer: def __init__(self, config): """Construct a spaCy-based tokenizer by loading the spaCy pipeline.""" <|body_0|> def process(self, document): """Tokenize a document with the spaCy tokenizer and wrap the results into a Doc object.""" <|body_1|> <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpacyTokenizer: def __init__(self, config): """Construct a spaCy-based tokenizer by loading the spaCy pipeline.""" if config['lang'] != 'en': raise Exception('spaCy tokenizer is currently only allowed in English pipeline.') try: import spacy from spa...
the_stack_v2_python_sparse
stanza/pipeline/external/spacy.py
stanfordnlp/stanza
train
4,281
75cf56eaeb8c1bb37141b8e39a969a20e248b35a
[ "super(FollowupForm, self).__init__(*args, **kwargs)\nself.fields['responsible'].queryset = User.objects.filter(is_staff=True)\nif self.instance and self.instance.pk:\n if not (self.instance.responsible and self.instance.due_date):\n self.fields['content'].widget.attrs['readonly'] = True", "instance = g...
<|body_start_0|> super(FollowupForm, self).__init__(*args, **kwargs) self.fields['responsible'].queryset = User.objects.filter(is_staff=True) if self.instance and self.instance.pk: if not (self.instance.responsible and self.instance.due_date): self.fields['content'].w...
FollowupForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowupForm: def __init__(self, *args, **kwargs): """Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.""" <|body_0|> def clean_content(self): """Prevents hacks when doing a POST.""" ...
stack_v2_sparse_classes_10k_train_005637
7,618
no_license
[ { "docstring": "Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Prevents hacks when doing a POST.", "name": "clean_...
2
stack_v2_sparse_classes_30k_train_003619
Implement the Python class `FollowupForm` described below. Class description: Implement the FollowupForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client. ...
Implement the Python class `FollowupForm` described below. Class description: Implement the FollowupForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client. ...
e2d24a82462a735fc722f0b228be04a4495185c1
<|skeleton|> class FollowupForm: def __init__(self, *args, **kwargs): """Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.""" <|body_0|> def clean_content(self): """Prevents hacks when doing a POST.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FollowupForm: def __init__(self, *args, **kwargs): """Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.""" super(FollowupForm, self).__init__(*args, **kwargs) self.fields['responsible'].queryset = User.o...
the_stack_v2_python_sparse
clients/admin.py
fredericosachweh/amostra2
train
0
404a72285610e0bc52b6301e6dc3a3078b1d6fbf
[ "post_ = Post.objects.get(slug=slug, is_deleted=False)\ninfographic_post = post_.infographic\nis_user_article = False\nif request.user.is_authenticated():\n user_prof = UserProfile.objects.get(user=request.user)\n contributor = user_can_contribute(request.user)\n if user_prof:\n if user_prof.is_cont...
<|body_start_0|> post_ = Post.objects.get(slug=slug, is_deleted=False) infographic_post = post_.infographic is_user_article = False if request.user.is_authenticated(): user_prof = UserProfile.objects.get(user=request.user) contributor = user_can_contribute(request...
InfographicView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfographicView: def get(self, request, slug): """Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic""" <|body_0|> def post(self, request, slug): """For when the ...
stack_v2_sparse_classes_10k_train_005638
10,751
no_license
[ { "docstring": "Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic", "name": "get", "signature": "def get(self, request, slug)" }, { "docstring": "For when the unpublish button is pressed, in...
2
stack_v2_sparse_classes_30k_train_000733
Implement the Python class `InfographicView` described below. Class description: Implement the InfographicView class. Method signatures and docstrings: - def get(self, request, slug): Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slu...
Implement the Python class `InfographicView` described below. Class description: Implement the InfographicView class. Method signatures and docstrings: - def get(self, request, slug): Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slu...
8296c49dfa8771b47965c24b6b49a2b6e8ace6cf
<|skeleton|> class InfographicView: def get(self, request, slug): """Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic""" <|body_0|> def post(self, request, slug): """For when the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InfographicView: def get(self, request, slug): """Gets the view for viewing an individual infographic. Login no longer required, non-users can now access posts. :param slug: Unique slug for the infographic""" post_ = Post.objects.get(slug=slug, is_deleted=False) infographic_post = post...
the_stack_v2_python_sparse
relevate_web_app/apps/contribution/views/infographics_view.py
jhock/Relevate
train
1
dcb11597b0ea376c0d3e84af7aa58b8327e4a129
[ "index = 0\nfor i in range(len(nums)):\n if nums[i] >= target:\n break\n index += 1\nreturn index", "l, r = (0, len(nums) - 1)\nif r < 0:\n return 0\nwhile l < r:\n mid = (l + r) // 2\n if target == nums[mid]:\n return mid\n elif target < nums[mid]:\n r = mid - 1\n else:\...
<|body_start_0|> index = 0 for i in range(len(nums)): if nums[i] >= target: break index += 1 return index <|end_body_0|> <|body_start_1|> l, r = (0, len(nums) - 1) if r < 0: return 0 while l < r: mid = (l + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums, target): """O(n) :type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert2(self, nums, target): """O(logn) :type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_10k_train_005639
868
no_license
[ { "docstring": "O(n) :type nums: List[int] :type target: int :rtype: int", "name": "searchInsert", "signature": "def searchInsert(self, nums, target)" }, { "docstring": "O(logn) :type nums: List[int] :type target: int :rtype: int", "name": "searchInsert2", "signature": "def searchInsert2...
2
stack_v2_sparse_classes_30k_train_001860
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): O(n) :type nums: List[int] :type target: int :rtype: int - def searchInsert2(self, nums, target): O(logn) :type nums: List[int] :type target...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): O(n) :type nums: List[int] :type target: int :rtype: int - def searchInsert2(self, nums, target): O(logn) :type nums: List[int] :type target...
d71e725d779d7b45402893b311939c2cce60fbca
<|skeleton|> class Solution: def searchInsert(self, nums, target): """O(n) :type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert2(self, nums, target): """O(logn) :type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert(self, nums, target): """O(n) :type nums: List[int] :type target: int :rtype: int""" index = 0 for i in range(len(nums)): if nums[i] >= target: break index += 1 return index def searchInsert2(self, nums, tar...
the_stack_v2_python_sparse
algorithm/0035Search_Insert_Position.py
xkoma001/leetcode
train
0
96bdae9bbbb96eb9bfe7c401b50fbc732eaf0ed5
[ "self._api = api\nself._url = url\nself._required_sid = required_sid\nself._errors_mapping = errors_mapping\nself._pagination_field = pagination_field\nself._rows_in_page = rows_in_page\nself._return_constructor = return_constructor\nself._min_row: int = 0\nself._max_row: Optional[int] = None\nself._current_row: Op...
<|body_start_0|> self._api = api self._url = url self._required_sid = required_sid self._errors_mapping = errors_mapping self._pagination_field = pagination_field self._rows_in_page = rows_in_page self._return_constructor = return_constructor self._min_row...
BaseIterable response.
BaseIterableResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseIterableResponse: """BaseIterable response.""" def __init__(self, *, api, url: str, required_sid: bool, errors_mapping: ERROR_MAPPING, pagination_field: str, rows_in_page: int, return_constructor: Callable[..., JSON_RETURN_TYPE]=Box): """Respone initialization. :param api: api :p...
stack_v2_sparse_classes_10k_train_005640
5,764
permissive
[ { "docstring": "Respone initialization. :param api: api :param url: url :param required_sid: require_sid :param errors_mapping: map of error name and exception :param pagination_field: field for pagination :param rows_in_page: number of rows in page :param return_constructor: constructor for return type", "...
4
stack_v2_sparse_classes_30k_train_004420
Implement the Python class `BaseIterableResponse` described below. Class description: BaseIterable response. Method signatures and docstrings: - def __init__(self, *, api, url: str, required_sid: bool, errors_mapping: ERROR_MAPPING, pagination_field: str, rows_in_page: int, return_constructor: Callable[..., JSON_RETU...
Implement the Python class `BaseIterableResponse` described below. Class description: BaseIterable response. Method signatures and docstrings: - def __init__(self, *, api, url: str, required_sid: bool, errors_mapping: ERROR_MAPPING, pagination_field: str, rows_in_page: int, return_constructor: Callable[..., JSON_RETU...
2618e682d38339439340d86080e8bc6ee6cf21b5
<|skeleton|> class BaseIterableResponse: """BaseIterable response.""" def __init__(self, *, api, url: str, required_sid: bool, errors_mapping: ERROR_MAPPING, pagination_field: str, rows_in_page: int, return_constructor: Callable[..., JSON_RETURN_TYPE]=Box): """Respone initialization. :param api: api :p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseIterableResponse: """BaseIterable response.""" def __init__(self, *, api, url: str, required_sid: bool, errors_mapping: ERROR_MAPPING, pagination_field: str, rows_in_page: int, return_constructor: Callable[..., JSON_RETURN_TYPE]=Box): """Respone initialization. :param api: api :param url: url...
the_stack_v2_python_sparse
ambra_sdk/service/response/base_response.py
dicomgrid/sdk-python
train
11
b7319277b64f495c1075ac6ac812363e660cd91f
[ "dummy_node = ListNode()\npre_node = dummy_node\nwhile l1 or l2:\n if l1 and l2:\n if l1.val < l2.val:\n pre_node.next = l1\n l1 = l1.next\n else:\n pre_node.next = l2\n l2 = l2.next\n elif l1:\n pre_node.next = l1\n l1 = l1.next\n els...
<|body_start_0|> dummy_node = ListNode() pre_node = dummy_node while l1 or l2: if l1 and l2: if l1.val < l2.val: pre_node.next = l1 l1 = l1.next else: pre_node.next = l2 l2...
MergeTwoLists
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MergeTwoLists: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """使用遍历方式就行 :param l1: :param l2: :return:""" <|body_0|> def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """迭代方式 :param l1: :param l2: :return:""" <|body_1|> <|...
stack_v2_sparse_classes_10k_train_005641
2,134
no_license
[ { "docstring": "使用遍历方式就行 :param l1: :param l2: :return:", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "迭代方式 :param l1: :param l2: :return:", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1: ...
2
stack_v2_sparse_classes_30k_train_006188
Implement the Python class `MergeTwoLists` described below. Class description: Implement the MergeTwoLists class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 使用遍历方式就行 :param l1: :param l2: :return: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListN...
Implement the Python class `MergeTwoLists` described below. Class description: Implement the MergeTwoLists class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 使用遍历方式就行 :param l1: :param l2: :return: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListN...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class MergeTwoLists: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """使用遍历方式就行 :param l1: :param l2: :return:""" <|body_0|> def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """迭代方式 :param l1: :param l2: :return:""" <|body_1|> <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MergeTwoLists: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """使用遍历方式就行 :param l1: :param l2: :return:""" dummy_node = ListNode() pre_node = dummy_node while l1 or l2: if l1 and l2: if l1.val < l2.val: pre_node...
the_stack_v2_python_sparse
datastructure/linked_list/MergeTwoLists.py
yinhuax/leet_code
train
0
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(TCNLayer, self).__init__()\nself.norm_1 = GroupNormWrapper(generated, E_1, E_2, 8, H, eps=1e-08)\nself.prelu_1 = nn.PReLU()\nself.conv1d = Conv1dWrapper(generated, E_1, E_2, B, H, 1, bias=False)\nself.norm_2 = GroupNormWrapper(generated, E_1, E_2, 8, H, eps=1e-08)\nself.prelu_2 = nn.PReLU()\nself.dconv1d = C...
<|body_start_0|> super(TCNLayer, self).__init__() self.norm_1 = GroupNormWrapper(generated, E_1, E_2, 8, H, eps=1e-08) self.prelu_1 = nn.PReLU() self.conv1d = Conv1dWrapper(generated, E_1, E_2, B, H, 1, bias=False) self.norm_2 = GroupNormWrapper(generated, E_1, E_2, 8, H, eps=1e-...
One layer of the dilated temporal convolution with bottleneck
TCNLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TCNLayer: """One layer of the dilated temporal convolution with bottleneck""" def __init__(self, generated, E_1, E_2, B, H, Sc, kernel, residual_bias, padding, dilation=1): """Arguments: generated {bool} -- True if you want to use the generated weights E_1 {int} -- Dimension of the i...
stack_v2_sparse_classes_10k_train_005642
37,269
no_license
[ { "docstring": "Arguments: generated {bool} -- True if you want to use the generated weights E_1 {int} -- Dimension of the instrument embedding E_2 {int} -- Dimension of the instrument embedding bottleneck B {int} -- Dimension of the bottleneck convolution H {int} -- Hidden dimension Sc {int} -- Skip-connection...
2
stack_v2_sparse_classes_30k_train_005853
Implement the Python class `TCNLayer` described below. Class description: One layer of the dilated temporal convolution with bottleneck Method signatures and docstrings: - def __init__(self, generated, E_1, E_2, B, H, Sc, kernel, residual_bias, padding, dilation=1): Arguments: generated {bool} -- True if you want to ...
Implement the Python class `TCNLayer` described below. Class description: One layer of the dilated temporal convolution with bottleneck Method signatures and docstrings: - def __init__(self, generated, E_1, E_2, B, H, Sc, kernel, residual_bias, padding, dilation=1): Arguments: generated {bool} -- True if you want to ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class TCNLayer: """One layer of the dilated temporal convolution with bottleneck""" def __init__(self, generated, E_1, E_2, B, H, Sc, kernel, residual_bias, padding, dilation=1): """Arguments: generated {bool} -- True if you want to use the generated weights E_1 {int} -- Dimension of the i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TCNLayer: """One layer of the dilated temporal convolution with bottleneck""" def __init__(self, generated, E_1, E_2, B, H, Sc, kernel, residual_bias, padding, dilation=1): """Arguments: generated {bool} -- True if you want to use the generated weights E_1 {int} -- Dimension of the instrument emb...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
30d363e37ac5d60d8851ce5fa025e3941fda4f84
[ "min_start = min((v.start for v in overlapping_variants))\nself.variant_indices = [(v.start - min_start, v.end - min_start) for v in overlapping_variants]\nself.size = max((v.end - min_start for v in overlapping_variants))", "if len(nonref_genotype_counts) != len(self.variant_indices):\n raise ValueError('Vari...
<|body_start_0|> min_start = min((v.start for v in overlapping_variants)) self.variant_indices = [(v.start - min_start, v.end - min_start) for v in overlapping_variants] self.size = max((v.end - min_start for v in overlapping_variants)) <|end_body_0|> <|body_start_1|> if len(nonref_geno...
Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the reference genome that is called as non-reference genotypes neve...
_VariantCompatibilityCalculator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _VariantCompatibilityCalculator: """Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the refe...
stack_v2_sparse_classes_10k_train_005643
20,898
permissive
[ { "docstring": "Constructor. Args: overlapping_variants: list(Variant). The Variant protos of interest.", "name": "__init__", "signature": "def __init__(self, overlapping_variants)" }, { "docstring": "Returns True if and only if all variants are compatible. Args: nonref_genotype_counts: list of ...
2
null
Implement the Python class `_VariantCompatibilityCalculator` described below. Class description: Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed comp...
Implement the Python class `_VariantCompatibilityCalculator` described below. Class description: Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed comp...
ab068c4588a02e2167051bd9e74c0c9579462b51
<|skeleton|> class _VariantCompatibilityCalculator: """Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the refe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _VariantCompatibilityCalculator: """Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the reference genome ...
the_stack_v2_python_sparse
deepvariant/haplotypes.py
google/deepvariant
train
3,002
5de4df1f09379e414053f15a92be10b39ddbab42
[ "self.created_time_msecs = created_time_msecs\nself.created_user_sid = created_user_sid\nself.created_username = created_username\nself.expiring_time_msecs = expiring_time_msecs\nself.id = id\nself.is_active = is_active\nself.is_expired = is_expired\nself.key = key\nself.name = name\nself.owner_user_sid = owner_use...
<|body_start_0|> self.created_time_msecs = created_time_msecs self.created_user_sid = created_user_sid self.created_username = created_username self.expiring_time_msecs = expiring_time_msecs self.id = id self.is_active = is_active self.is_expired = is_expired ...
Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specifies the username who created this API key...
CreatedApiKey
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreatedApiKey: """Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specif...
stack_v2_sparse_classes_10k_train_005644
4,142
permissive
[ { "docstring": "Constructor for the CreatedApiKey class", "name": "__init__", "signature": "def __init__(self, created_time_msecs=None, created_user_sid=None, created_username=None, expiring_time_msecs=None, id=None, is_active=None, is_expired=None, key=None, name=None, owner_user_sid=None, owner_userna...
2
null
Implement the Python class `CreatedApiKey` described below. Class description: Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API...
Implement the Python class `CreatedApiKey` described below. Class description: Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CreatedApiKey: """Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specif...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreatedApiKey: """Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specifies the usern...
the_stack_v2_python_sparse
cohesity_management_sdk/models/created_api_key.py
cohesity/management-sdk-python
train
24
92e65c8717bff0abe3e07d54aab2fa8ea88cf683
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SolutionsRoot()", "from .booking_business import BookingBusiness\nfrom .booking_currency import BookingCurrency\nfrom .booking_business import BookingBusiness\nfrom .booking_currency import BookingCurrency\nfields: Dict[str, Callable[[...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SolutionsRoot() <|end_body_0|> <|body_start_1|> from .booking_business import BookingBusiness from .booking_currency import BookingCurrency from .booking_business import BookingB...
SolutionsRoot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionsRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: """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...
stack_v2_sparse_classes_10k_train_005645
3,222
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: SolutionsRoot", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
stack_v2_sparse_classes_30k_test_000144
Implement the Python class `SolutionsRoot` described below. Class description: Implement the SolutionsRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `SolutionsRoot` described below. Class description: Implement the SolutionsRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SolutionsRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: """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...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SolutionsRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: """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: SolutionsRoo...
the_stack_v2_python_sparse
msgraph/generated/models/solutions_root.py
microsoftgraph/msgraph-sdk-python
train
135
9633eb7c70ede62f9903c11d2d3130e88cf6325b
[ "completed = []\nfor step, label in mkt.APP_STEPS:\n if getattr(self, step, False):\n completed.append(step)\nreturn completed", "for step, label in mkt.APP_STEPS[:-1]:\n if not getattr(self, step, False):\n return step" ]
<|body_start_0|> completed = [] for step, label in mkt.APP_STEPS: if getattr(self, step, False): completed.append(step) return completed <|end_body_0|> <|body_start_1|> for step, label in mkt.APP_STEPS[:-1]: if not getattr(self, step, False): ...
AppSubmissionChecklist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppSubmissionChecklist: def get_completed(self): """Return a list of completed submission steps.""" <|body_0|> def get_next(self): """Return the next step.""" <|body_1|> <|end_skeleton|> <|body_start_0|> completed = [] for step, label in mkt...
stack_v2_sparse_classes_10k_train_005646
1,031
permissive
[ { "docstring": "Return a list of completed submission steps.", "name": "get_completed", "signature": "def get_completed(self)" }, { "docstring": "Return the next step.", "name": "get_next", "signature": "def get_next(self)" } ]
2
null
Implement the Python class `AppSubmissionChecklist` described below. Class description: Implement the AppSubmissionChecklist class. Method signatures and docstrings: - def get_completed(self): Return a list of completed submission steps. - def get_next(self): Return the next step.
Implement the Python class `AppSubmissionChecklist` described below. Class description: Implement the AppSubmissionChecklist class. Method signatures and docstrings: - def get_completed(self): Return a list of completed submission steps. - def get_next(self): Return the next step. <|skeleton|> class AppSubmissionChe...
5fa5400a447f2e905372d4c8eba6d959d22d4f3e
<|skeleton|> class AppSubmissionChecklist: def get_completed(self): """Return a list of completed submission steps.""" <|body_0|> def get_next(self): """Return the next step.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AppSubmissionChecklist: def get_completed(self): """Return a list of completed submission steps.""" completed = [] for step, label in mkt.APP_STEPS: if getattr(self, step, False): completed.append(step) return completed def get_next(self): ...
the_stack_v2_python_sparse
mkt/submit/models.py
sarvex/zamboni
train
0
f9ea9336cba8d80a3a592c6c48b4ac210a97ae33
[ "n = len(s)\nstr_list = []\nif numRows <= 1:\n return s\nzig_size = numRows * 2 - 2\nzig_count = n // zig_size\nfor i in range(numRows):\n if i == 0 or i == numRows - 1:\n for j in range(zig_count + 1):\n index = j * zig_size + i\n if index < n:\n str_list.append(s[...
<|body_start_0|> n = len(s) str_list = [] if numRows <= 1: return s zig_size = numRows * 2 - 2 zig_count = n // zig_size for i in range(numRows): if i == 0 or i == numRows - 1: for j in range(zig_count + 1): inde...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convert1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_0|> def convert(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) s...
stack_v2_sparse_classes_10k_train_005647
2,920
no_license
[ { "docstring": ":type s: str :type numRows: int :rtype: str", "name": "convert1", "signature": "def convert1(self, s, numRows)" }, { "docstring": ":type s: str :type numRows: int :rtype: str", "name": "convert", "signature": "def convert(self, s, numRows)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert1(self, s, numRows): :type s: str :type numRows: int :rtype: str - def convert(self, s, numRows): :type s: str :type numRows: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert1(self, s, numRows): :type s: str :type numRows: int :rtype: str - def convert(self, s, numRows): :type s: str :type numRows: int :rtype: str <|skeleton|> class Solut...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def convert1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_0|> def convert(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def convert1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" n = len(s) str_list = [] if numRows <= 1: return s zig_size = numRows * 2 - 2 zig_count = n // zig_size for i in range(numRows): if i == 0...
the_stack_v2_python_sparse
String/q006_zigzag_conversion.py
sevenhe716/LeetCode
train
0
597f94d81ea0f9024d4bb3f7d31b6a4b6fdc1a0a
[ "self.capacity = capacity\nself.keys = collections.deque()\nself.cache = {}", "if key in self.keys:\n self.keys.remove(key)\n self.keys.append(key)\n return self.cache[key]\nelse:\n return -1", "if key in self.keys:\n self.cache[key] = value\n self.keys.remove(key)\n self.keys.append(key)\n...
<|body_start_0|> self.capacity = capacity self.keys = collections.deque() self.cache = {} <|end_body_0|> <|body_start_1|> if key in self.keys: self.keys.remove(key) self.keys.append(key) return self.cache[key] else: return -1 <|end...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_005648
1,951
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_003563
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
6de551327f96ec4d4b63d0045281b65bbb4f5d0f
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.keys = collections.deque() self.cache = {} def get(self, key): """:rtype: int""" if key in self.keys: self.keys.remove(key) self.keys.app...
the_stack_v2_python_sparse
LRUCache.py
JingweiTu/leetcode
train
0
4df996da07e870ae1e974007c28aaab3c395768f
[ "if args:\n super(Application, self).__init__(args)\nelse:\n super(Application, self).__init__()\nself.window = MainWindow(self, state, screenFps, fixedFps)", "self.window.start()\nself.window.show()\nself.exec_()" ]
<|body_start_0|> if args: super(Application, self).__init__(args) else: super(Application, self).__init__() self.window = MainWindow(self, state, screenFps, fixedFps) <|end_body_0|> <|body_start_1|> self.window.start() self.window.show() self.exec...
This is the core class of an AggiEngine application.
Application
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """This is the core class of an AggiEngine application.""" def __init__(self, state: State, screenFps: Optional[float]=120, fixedFps: Optional[float]=60, args: Optional[list]=None) -> None: """Creates and initializes QWidgets for the application to start. ``state:`` The ...
stack_v2_sparse_classes_10k_train_005649
1,055
permissive
[ { "docstring": "Creates and initializes QWidgets for the application to start. ``state:`` The initial state to launch the Application with ``args:`` System arguments passed in ``config:`` Set application parameters", "name": "__init__", "signature": "def __init__(self, state: State, screenFps: Optional[...
2
stack_v2_sparse_classes_30k_train_004620
Implement the Python class `Application` described below. Class description: This is the core class of an AggiEngine application. Method signatures and docstrings: - def __init__(self, state: State, screenFps: Optional[float]=120, fixedFps: Optional[float]=60, args: Optional[list]=None) -> None: Creates and initializ...
Implement the Python class `Application` described below. Class description: This is the core class of an AggiEngine application. Method signatures and docstrings: - def __init__(self, state: State, screenFps: Optional[float]=120, fixedFps: Optional[float]=60, args: Optional[list]=None) -> None: Creates and initializ...
d06b9fd71b2559c73b33395cc79d7f8cbd457bbf
<|skeleton|> class Application: """This is the core class of an AggiEngine application.""" def __init__(self, state: State, screenFps: Optional[float]=120, fixedFps: Optional[float]=60, args: Optional[list]=None) -> None: """Creates and initializes QWidgets for the application to start. ``state:`` The ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Application: """This is the core class of an AggiEngine application.""" def __init__(self, state: State, screenFps: Optional[float]=120, fixedFps: Optional[float]=60, args: Optional[list]=None) -> None: """Creates and initializes QWidgets for the application to start. ``state:`` The initial state...
the_stack_v2_python_sparse
AggiEngine/application.py
aggie-coding-club/AggiEngine
train
9
dc1c516755136ad695e486e31155bc537afa8e0f
[ "for algorithm, expected in {'md5': ('698d51a19d8a121ce581499d7b701668', '8980c988edc2c78cc43ccb718c06efd5', '53fd88c84ff8a285eb6e0a687e55b8c7'), 'sha1': ('6216f8a75fd5bb3d5f22b6f9958cdede3fc086c2', '42eda1b5dcb3586bccfb1c69f22f923145271d97', '2eb2f7be4e883ebe52034281d818c91e1cf16256'), 'sha256': ('f6e0a1e2ac41945a...
<|body_start_0|> for algorithm, expected in {'md5': ('698d51a19d8a121ce581499d7b701668', '8980c988edc2c78cc43ccb718c06efd5', '53fd88c84ff8a285eb6e0a687e55b8c7'), 'sha1': ('6216f8a75fd5bb3d5f22b6f9958cdede3fc086c2', '42eda1b5dcb3586bccfb1c69f22f923145271d97', '2eb2f7be4e883ebe52034281d818c91e1cf16256'), 'sha256'...
HashTestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashTestCase: def test_collect(self) -> None: """Test collecting a list of signatures into a new signature value""" <|body_0|> def test_MD5signature(self) -> None: """Test generating a signature""" <|body_1|> <|end_skeleton|> <|body_start_0|> for al...
stack_v2_sparse_classes_10k_train_005650
44,672
permissive
[ { "docstring": "Test collecting a list of signatures into a new signature value", "name": "test_collect", "signature": "def test_collect(self) -> None" }, { "docstring": "Test generating a signature", "name": "test_MD5signature", "signature": "def test_MD5signature(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_005208
Implement the Python class `HashTestCase` described below. Class description: Implement the HashTestCase class. Method signatures and docstrings: - def test_collect(self) -> None: Test collecting a list of signatures into a new signature value - def test_MD5signature(self) -> None: Test generating a signature
Implement the Python class `HashTestCase` described below. Class description: Implement the HashTestCase class. Method signatures and docstrings: - def test_collect(self) -> None: Test collecting a list of signatures into a new signature value - def test_MD5signature(self) -> None: Test generating a signature <|skel...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class HashTestCase: def test_collect(self) -> None: """Test collecting a list of signatures into a new signature value""" <|body_0|> def test_MD5signature(self) -> None: """Test generating a signature""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HashTestCase: def test_collect(self) -> None: """Test collecting a list of signatures into a new signature value""" for algorithm, expected in {'md5': ('698d51a19d8a121ce581499d7b701668', '8980c988edc2c78cc43ccb718c06efd5', '53fd88c84ff8a285eb6e0a687e55b8c7'), 'sha1': ('6216f8a75fd5bb3d5f22b6f...
the_stack_v2_python_sparse
SCons/UtilTests.py
SCons/scons
train
1,827
1c15971ec2be21599e09a4e8ec9a32cb288b8efd
[ "super(BayesianLSTMCell, self).__init__(num_units, **kwargs)\nself.w = None\nself.b = None\nself.prior = prior\nself.n = name\nself.is_training = is_training\nself.num_units = num_units\nself.X_dim = X_dim", "with tf.variable_scope('BayesLSTMCell'):\n if self.w is None:\n print(['------- Size input LSTM...
<|body_start_0|> super(BayesianLSTMCell, self).__init__(num_units, **kwargs) self.w = None self.b = None self.prior = prior self.n = name self.is_training = is_training self.num_units = num_units self.X_dim = X_dim <|end_body_0|> <|body_start_1|> ...
BayesianLSTMCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BayesianLSTMCell: def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): """In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weigh...
stack_v2_sparse_classes_10k_train_005651
4,584
no_license
[ { "docstring": "In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weights: Needed to compute the first set of weights before seeing any data As wwll as the number of units in each...
2
stack_v2_sparse_classes_30k_train_007294
Implement the Python class `BayesianLSTMCell` described below. Class description: Implement the BayesianLSTMCell class. Method signatures and docstrings: - def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): In the initialization of the Cell, we will set: - The internal weights structures w...
Implement the Python class `BayesianLSTMCell` described below. Class description: Implement the BayesianLSTMCell class. Method signatures and docstrings: - def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): In the initialization of the Cell, we will set: - The internal weights structures w...
f1248011010e95906e291316aec1679c23a834e3
<|skeleton|> class BayesianLSTMCell: def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): """In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weigh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BayesianLSTMCell: def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): """In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weights: Needed to ...
the_stack_v2_python_sparse
libs/BBBLSTM/BayesianLSTMCell.py
Sdoof/Trapyng
train
0
daf7ce02d1a3d3a275d7e2a771f708388619e0df
[ "self.log.info('login from Live')\ncode = context.get('code')\nif not code:\n return None\naccess_token = self.get_token(code)\nuser_info = self.get_user_info(access_token)\nname = user_info['name']\nemail = user_info['emails']['account']\nemail_list = [{'name': name, 'email': email, 'verified': 1, 'primary': 1}...
<|body_start_0|> self.log.info('login from Live') code = context.get('code') if not code: return None access_token = self.get_token(code) user_info = self.get_user_info(access_token) name = user_info['name'] email = user_info['emails']['account'] ...
Sign in with live :Example: from client.user.login import LiveLogin LiveLogin() .. notes::
LiveLogin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LiveLogin: """Sign in with live :Example: from client.user.login import LiveLogin LiveLogin() .. notes::""" def login(self, context): """live Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" <|body_0|> def get_token(self, c...
stack_v2_sparse_classes_10k_train_005652
17,886
permissive
[ { "docstring": "live Login :type context: Context :param context: :rtype: dict :return: token and instance of user", "name": "login", "signature": "def login(self, context)" }, { "docstring": "Get live access token :type code: str :param code: :rtype: str :return: access token and uid", "nam...
3
stack_v2_sparse_classes_30k_train_003740
Implement the Python class `LiveLogin` described below. Class description: Sign in with live :Example: from client.user.login import LiveLogin LiveLogin() .. notes:: Method signatures and docstrings: - def login(self, context): live Login :type context: Context :param context: :rtype: dict :return: token and instance...
Implement the Python class `LiveLogin` described below. Class description: Sign in with live :Example: from client.user.login import LiveLogin LiveLogin() .. notes:: Method signatures and docstrings: - def login(self, context): live Login :type context: Context :param context: :rtype: dict :return: token and instance...
945c4fd2755f5b0dea11e54eb649eeb37ec93d01
<|skeleton|> class LiveLogin: """Sign in with live :Example: from client.user.login import LiveLogin LiveLogin() .. notes::""" def login(self, context): """live Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" <|body_0|> def get_token(self, c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LiveLogin: """Sign in with live :Example: from client.user.login import LiveLogin LiveLogin() .. notes::""" def login(self, context): """live Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" self.log.info('login from Live') code = co...
the_stack_v2_python_sparse
open-hackathon-server/src/hackathon/user/oauth_login.py
kaiyuanshe/open-hackathon
train
46
d18644e26c23e697de22a4815419a5e4dae53723
[ "_LOG.info('Create the DB schema for: %s', engine)\nself._engine = engine\nself._meta = MetaData()\nself.experiment = Table('experiment', self._meta, Column('exp_id', String(255), nullable=False), Column('description', String(1024)), Column('root_env_config', String(1024), nullable=False), Column('git_repo', String...
<|body_start_0|> _LOG.info('Create the DB schema for: %s', engine) self._engine = engine self._meta = MetaData() self.experiment = Table('experiment', self._meta, Column('exp_id', String(255), nullable=False), Column('description', String(1024)), Column('root_env_config', String(1024), n...
A class to define and create the DB schema.
DbSchema
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbSchema: """A class to define and create the DB schema.""" def __init__(self, engine: Engine): """Declare the SQLAlchemy schema for the database.""" <|body_0|> def create(self) -> 'DbSchema': """Create the DB schema.""" <|body_1|> def __repr__(self)...
stack_v2_sparse_classes_10k_train_005653
6,611
permissive
[ { "docstring": "Declare the SQLAlchemy schema for the database.", "name": "__init__", "signature": "def __init__(self, engine: Engine)" }, { "docstring": "Create the DB schema.", "name": "create", "signature": "def create(self) -> 'DbSchema'" }, { "docstring": "Produce a string w...
3
stack_v2_sparse_classes_30k_train_004895
Implement the Python class `DbSchema` described below. Class description: A class to define and create the DB schema. Method signatures and docstrings: - def __init__(self, engine: Engine): Declare the SQLAlchemy schema for the database. - def create(self) -> 'DbSchema': Create the DB schema. - def __repr__(self) -> ...
Implement the Python class `DbSchema` described below. Class description: A class to define and create the DB schema. Method signatures and docstrings: - def __init__(self, engine: Engine): Declare the SQLAlchemy schema for the database. - def create(self) -> 'DbSchema': Create the DB schema. - def __repr__(self) -> ...
0db80043dad256d77dc4c2b4fc54aa0b0aa2597f
<|skeleton|> class DbSchema: """A class to define and create the DB schema.""" def __init__(self, engine: Engine): """Declare the SQLAlchemy schema for the database.""" <|body_0|> def create(self) -> 'DbSchema': """Create the DB schema.""" <|body_1|> def __repr__(self)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DbSchema: """A class to define and create the DB schema.""" def __init__(self, engine: Engine): """Declare the SQLAlchemy schema for the database.""" _LOG.info('Create the DB schema for: %s', engine) self._engine = engine self._meta = MetaData() self.experiment = T...
the_stack_v2_python_sparse
mlos_bench/mlos_bench/storage/sql/schema.py
microsoft/MLOS
train
109
abb52a4a61bbfdebb958e6b1fefc40fe8b1e5d09
[ "self.datastore_entity_vec = datastore_entity_vec\nself.network_config = network_config\nself.parent_source = parent_source\nself.rename_object_params = rename_object_params\nself.resource_pool_entity = resource_pool_entity\nself.target_datastore_folder = target_datastore_folder\nself.target_vm_folder = target_vm_f...
<|body_start_0|> self.datastore_entity_vec = datastore_entity_vec self.network_config = network_config self.parent_source = parent_source self.rename_object_params = rename_object_params self.resource_pool_entity = resource_pool_entity self.target_datastore_folder = targe...
Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration for the standby VM. parent_source (EntityProto): T...
VmwareStandbyResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmwareStandbyResource: """Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration f...
stack_v2_sparse_classes_10k_train_005654
4,811
permissive
[ { "docstring": "Constructor for the VmwareStandbyResource class", "name": "__init__", "signature": "def __init__(self, datastore_entity_vec=None, network_config=None, parent_source=None, rename_object_params=None, resource_pool_entity=None, target_datastore_folder=None, target_vm_folder=None)" }, { ...
2
null
Implement the Python class `VmwareStandbyResource` described below. Class description: Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetwo...
Implement the Python class `VmwareStandbyResource` described below. Class description: Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetwo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VmwareStandbyResource: """Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VmwareStandbyResource: """Implementation of the 'VmwareStandbyResource' model. TODO: type description here. Attributes: datastore_entity_vec (list of EntityProto): Datastore entities where the standby VM should be created. network_config (RestoredObjectNetworkConfigProto): Network configuration for the standb...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vmware_standby_resource.py
cohesity/management-sdk-python
train
24
f0cb0dcc3309ea1fc00afd7d0543b4e64691ef4d
[ "super().__init__(intrinsic_signal_provider_arch=intrinsic_signal_provider_arch, **kwargs)\nself._gradient_clipping = gradient_clipping\nself._gradient_norm_clipping = gradient_norm_clipping\nself._device = torch.device(device if torch.cuda.is_available() and device != 'cpu' else 'cpu')", "if self._gradient_clipp...
<|body_start_0|> super().__init__(intrinsic_signal_provider_arch=intrinsic_signal_provider_arch, **kwargs) self._gradient_clipping = gradient_clipping self._gradient_norm_clipping = gradient_norm_clipping self._device = torch.device(device if torch.cuda.is_available() and device != 'cpu'...
TorchAgent
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchAgent: def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), intrinsic_signal_provider_arch: IntrinsicSignalProvider=BraindeadIntrinsic...
stack_v2_sparse_classes_10k_train_005655
6,650
permissive
[ { "docstring": ":param device: :param gradient_clipping: :param grad_clip_low: :param grad_clip_high: :param kwargs:", "name": "__init__", "signature": "def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clip...
2
stack_v2_sparse_classes_30k_train_001450
Implement the Python class `TorchAgent` described below. Class description: Implement the TorchAgent class. Method signatures and docstrings: - def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=...
Implement the Python class `TorchAgent` described below. Class description: Implement the TorchAgent class. Method signatures and docstrings: - def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=...
21e3564696062b67151b013fd5e47df46cf44aa5
<|skeleton|> class TorchAgent: def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), intrinsic_signal_provider_arch: IntrinsicSignalProvider=BraindeadIntrinsic...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TorchAgent: def __init__(self, *, device: str=global_torch_device(True), gradient_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), gradient_norm_clipping: TogglableLowHigh=TogglableLowHigh(False, -1.0, 1.0), intrinsic_signal_provider_arch: IntrinsicSignalProvider=BraindeadIntrinsicSignalProvider...
the_stack_v2_python_sparse
neodroidagent/agents/torch_agents/torch_agent.py
sintefneodroid/agent
train
9
65b7a1bba22623f4d142ba71962ef1309611f289
[ "def post(node):\n return post(node.left) + post(node.right) + [node.val] if node else []\nreturn ' '.join(map(str, post(root)))", "def helper(data, lower, upper):\n if data or data[-1] < lower or data[-1] > upper:\n return None\n val = data.pop()\n node = Node(val)\n node.right = helper(val...
<|body_start_0|> def post(node): return post(node.left) + post(node.right) + [node.val] if node else [] return ' '.join(map(str, post(root))) <|end_body_0|> <|body_start_1|> def helper(data, lower, upper): if data or data[-1] < lower or data[-1] > upper: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_005656
2,994
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
2d5c09b63438aee7925252d5c6c4ede872bf52f1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def post(node): return post(node.left) + post(node.right) + [node.val] if node else [] return ' '.join(map(str, post(root))) def deserialize(self, data): ...
the_stack_v2_python_sparse
algorithms/google/SerializeAndDeserializeBST.py
james4388/algorithm-1
train
1
ef316b1346de0ca0cc18f92dc54f1d67019712ba
[ "if not emails:\n return []\nreturn [email.strip() for email in emails.split(',')]", "super().validate(emails)\nfor email in emails:\n validate_email(email)" ]
<|body_start_0|> if not emails: return [] return [email.strip() for email in emails.split(',')] <|end_body_0|> <|body_start_1|> super().validate(emails) for email in emails: validate_email(email) <|end_body_1|>
MultiEmailField
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiEmailField: def to_python(self, emails: Optional[str]) -> List[str]: """Normalize data to a list of strings.""" <|body_0|> def validate(self, emails: List[str]) -> None: """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_10k_train_005657
23,582
permissive
[ { "docstring": "Normalize data to a list of strings.", "name": "to_python", "signature": "def to_python(self, emails: Optional[str]) -> List[str]" }, { "docstring": "Check if value consists only of valid emails.", "name": "validate", "signature": "def validate(self, emails: List[str]) ->...
2
null
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, emails: Optional[str]) -> List[str]: Normalize data to a list of strings. - def validate(self, emails: List[str]) -> None: Check if value consis...
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, emails: Optional[str]) -> List[str]: Normalize data to a list of strings. - def validate(self, emails: List[str]) -> None: Check if value consis...
965a25d91b6ee2db54038f5df855215fa25146b0
<|skeleton|> class MultiEmailField: def to_python(self, emails: Optional[str]) -> List[str]: """Normalize data to a list of strings.""" <|body_0|> def validate(self, emails: List[str]) -> None: """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiEmailField: def to_python(self, emails: Optional[str]) -> List[str]: """Normalize data to a list of strings.""" if not emails: return [] return [email.strip() for email in emails.split(',')] def validate(self, emails: List[str]) -> None: """Check if value ...
the_stack_v2_python_sparse
zerver/forms.py
zulip/zulip
train
20,239
22089c86863e4aa7cfdaa8d9b72b83b2e5cfea1a
[ "if cls._driver is None:\n if browser_name == 'Chrome':\n cls._driver = webdriver.Chrome(driverPath['Chrome'])\n elif browser_name == 'Firefox':\n cls._driver = webdriver.Firefox(driverPath['Firefox'])\n cls._driver.maximize_window()\n cls._driver.get(DOMAIN)\n cls.__login()\nreturn cls...
<|body_start_0|> if cls._driver is None: if browser_name == 'Chrome': cls._driver = webdriver.Chrome(driverPath['Chrome']) elif browser_name == 'Firefox': cls._driver = webdriver.Firefox(driverPath['Firefox']) cls._driver.maximize_window() ...
Driver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Driver: def get_driver(cls, browser_name='Chrome'): """创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象不存在,则创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象存在,直接将其作为返回值返回即可 :param browser_name:希望创建的浏览器类型 :return:""" <|body_0|> def __login(cls): """私有方法,只能在类的内部使用 类外部无法使用,子类无法继承 解决登录问题,只希望在浏览器驱动对象被创建的时...
stack_v2_sparse_classes_10k_train_005658
1,850
no_license
[ { "docstring": "创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象不存在,则创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象存在,直接将其作为返回值返回即可 :param browser_name:希望创建的浏览器类型 :return:", "name": "get_driver", "signature": "def get_driver(cls, browser_name='Chrome')" }, { "docstring": "私有方法,只能在类的内部使用 类外部无法使用,子类无法继承 解决登录问题,只希望在浏览器驱动对象被创建的时候执...
2
stack_v2_sparse_classes_30k_train_005712
Implement the Python class `Driver` described below. Class description: Implement the Driver class. Method signatures and docstrings: - def get_driver(cls, browser_name='Chrome'): 创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象不存在,则创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象存在,直接将其作为返回值返回即可 :param browser_name:希望创建的浏览器类型 :return: - def __login(...
Implement the Python class `Driver` described below. Class description: Implement the Driver class. Method signatures and docstrings: - def get_driver(cls, browser_name='Chrome'): 创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象不存在,则创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象存在,直接将其作为返回值返回即可 :param browser_name:希望创建的浏览器类型 :return: - def __login(...
8065956de0cfb675e083ac692b243988d9e8d4b7
<|skeleton|> class Driver: def get_driver(cls, browser_name='Chrome'): """创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象不存在,则创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象存在,直接将其作为返回值返回即可 :param browser_name:希望创建的浏览器类型 :return:""" <|body_0|> def __login(cls): """私有方法,只能在类的内部使用 类外部无法使用,子类无法继承 解决登录问题,只希望在浏览器驱动对象被创建的时...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Driver: def get_driver(cls, browser_name='Chrome'): """创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象不存在,则创建浏览器驱动对象,并将其作为返回值返回 如果,浏览器驱动对象存在,直接将其作为返回值返回即可 :param browser_name:希望创建的浏览器类型 :return:""" if cls._driver is None: if browser_name == 'Chrome': cls._driver = webdriver.Chrome(...
the_stack_v2_python_sparse
shanghaiyouyou/WebUiStudy/day7/po模式实战/utils/myDriver.py
kakashi-01/python-0504
train
0
f1ff90793c7bfa2adbf724f453f5b6743233e8a2
[ "self.terminator = '\\n'\nlogging.Handler.__init__(self)\nif stream is None:\n stream = sys.stderr\nself.stream = stream", "self.acquire()\ntry:\n if self.stream and hasattr(self.stream, 'flush'):\n self.stream.flush()\nfinally:\n self.release()", "try:\n msg = self.format(record)\n stream...
<|body_start_0|> self.terminator = '\n' logging.Handler.__init__(self) if stream is None: stream = sys.stderr self.stream = stream <|end_body_0|> <|body_start_1|> self.acquire() try: if self.stream and hasattr(self.stream, 'flush'): ...
Modified from logging.py
CustomStreamHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomStreamHandler: """Modified from logging.py""" def __init__(self, stream=None): """Initialize the handler. If stream is not specified, sys.stderr is used.""" <|body_0|> def flush(self): """Flushes the stream.""" <|body_1|> def emit(self, record)...
stack_v2_sparse_classes_10k_train_005659
20,556
permissive
[ { "docstring": "Initialize the handler. If stream is not specified, sys.stderr is used.", "name": "__init__", "signature": "def __init__(self, stream=None)" }, { "docstring": "Flushes the stream.", "name": "flush", "signature": "def flush(self)" }, { "docstring": "Emit a record. ...
3
stack_v2_sparse_classes_30k_train_005830
Implement the Python class `CustomStreamHandler` described below. Class description: Modified from logging.py Method signatures and docstrings: - def __init__(self, stream=None): Initialize the handler. If stream is not specified, sys.stderr is used. - def flush(self): Flushes the stream. - def emit(self, record): Em...
Implement the Python class `CustomStreamHandler` described below. Class description: Modified from logging.py Method signatures and docstrings: - def __init__(self, stream=None): Initialize the handler. If stream is not specified, sys.stderr is used. - def flush(self): Flushes the stream. - def emit(self, record): Em...
6659d953b217748d0b15f0da4cd27fe789e3cd50
<|skeleton|> class CustomStreamHandler: """Modified from logging.py""" def __init__(self, stream=None): """Initialize the handler. If stream is not specified, sys.stderr is used.""" <|body_0|> def flush(self): """Flushes the stream.""" <|body_1|> def emit(self, record)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomStreamHandler: """Modified from logging.py""" def __init__(self, stream=None): """Initialize the handler. If stream is not specified, sys.stderr is used.""" self.terminator = '\n' logging.Handler.__init__(self) if stream is None: stream = sys.stderr ...
the_stack_v2_python_sparse
utool/util_logging.py
Erotemic/utool
train
8
300e3584aa0d21d2a8726ffc51438670c6f72786
[ "logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nself.novel_title = soup.select_one('.novel-info .title h2').text\nlogger.info('Novel title: %s', self.novel_title)\nself.novel_cover = self.absolute_url(soup.select_one('.novel .novel-thumb img')['data-src'])\nlogger.info('Novel cov...
<|body_start_0|> logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.novel-info .title h2').text logger.info('Novel title: %s', self.novel_title) self.novel_cover = self.absolute_url(soup.select_one('.novel .novel-...
FlyingLinesCrawler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlyingLinesCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_005660
2,065
permissive
[ { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring": "Download body of a single chapter and return as clean html format.", "name": "download_chapter_body", "signature": "def download_chapter_body(self, c...
2
stack_v2_sparse_classes_30k_train_002231
Implement the Python class `FlyingLinesCrawler` described below. Class description: Implement the FlyingLinesCrawler class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean...
Implement the Python class `FlyingLinesCrawler` described below. Class description: Implement the FlyingLinesCrawler class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class FlyingLinesCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlyingLinesCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.novel-info .title h2').text logger.info('Novel title: %s', self.n...
the_stack_v2_python_sparse
lncrawl/sources/flyinglines.py
NNTin/lightnovel-crawler
train
2
ed814db88ac74f0fee1cfefd424227482c925f97
[ "self.n_samples = 1000\nself.n_features = 4\nself.forest = []", "for _ in range(self.n_samples):\n k_indices = np.random.choice(len(col_names) - 1, self.n_features, replace=False)\n tree = DecisionTree(feat_indices=k_indices)\n tree.fit(col_names, rows)\n self.forest.append(tree)", "label_vote = dic...
<|body_start_0|> self.n_samples = 1000 self.n_features = 4 self.forest = [] <|end_body_0|> <|body_start_1|> for _ in range(self.n_samples): k_indices = np.random.choice(len(col_names) - 1, self.n_features, replace=False) tree = DecisionTree(feat_indices=k_indices...
RandomForest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomForest: def __init__(self, n_samples=1000, n_features=4): """Construct a random forest using decision tree There are couple missing features for this implementation. - Minimum sample split - Minimum sample leaf - Minimum purity increase - Maximum leaf nodes - Maximum depth Args: n_...
stack_v2_sparse_classes_10k_train_005661
1,740
no_license
[ { "docstring": "Construct a random forest using decision tree There are couple missing features for this implementation. - Minimum sample split - Minimum sample leaf - Minimum purity increase - Maximum leaf nodes - Maximum depth Args: n_samples (int): Number of decision tree in the forest n_features (int): Numb...
3
stack_v2_sparse_classes_30k_train_004428
Implement the Python class `RandomForest` described below. Class description: Implement the RandomForest class. Method signatures and docstrings: - def __init__(self, n_samples=1000, n_features=4): Construct a random forest using decision tree There are couple missing features for this implementation. - Minimum sampl...
Implement the Python class `RandomForest` described below. Class description: Implement the RandomForest class. Method signatures and docstrings: - def __init__(self, n_samples=1000, n_features=4): Construct a random forest using decision tree There are couple missing features for this implementation. - Minimum sampl...
7da789ef34d5e5bcf9033cfbe0ff5df607b2437a
<|skeleton|> class RandomForest: def __init__(self, n_samples=1000, n_features=4): """Construct a random forest using decision tree There are couple missing features for this implementation. - Minimum sample split - Minimum sample leaf - Minimum purity increase - Maximum leaf nodes - Maximum depth Args: n_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomForest: def __init__(self, n_samples=1000, n_features=4): """Construct a random forest using decision tree There are couple missing features for this implementation. - Minimum sample split - Minimum sample leaf - Minimum purity increase - Maximum leaf nodes - Maximum depth Args: n_samples (int):...
the_stack_v2_python_sparse
random_forest/forest/random_forest.py
calvinfeng/machine-learning-notebook
train
38
5613ea5f0c521d070cfede68ea2a98d0255c0db8
[ "super().__init__(coordinator, vehicle)\nself.entity_description = description\nself._attr_unique_id = f'{vehicle.vin}-{description.key}'", "try:\n await self.entity_description.remote_function(self.vehicle)\nexcept MyBMWAPIError as ex:\n raise HomeAssistantError(ex) from ex\nself.coordinator.async_update_l...
<|body_start_0|> super().__init__(coordinator, vehicle) self.entity_description = description self._attr_unique_id = f'{vehicle.vin}-{description.key}' <|end_body_0|> <|body_start_1|> try: await self.entity_description.remote_function(self.vehicle) except MyBMWAPIErr...
Representation of a MyBMW button.
BMWButton
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BMWButton: """Representation of a MyBMW button.""" def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWButtonEntityDescription) -> None: """Initialize BMW vehicle sensor.""" <|body_0|> async def async_press(self) -> None: ...
stack_v2_sparse_classes_10k_train_005662
4,184
permissive
[ { "docstring": "Initialize BMW vehicle sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWButtonEntityDescription) -> None" }, { "docstring": "Press the button.", "name": "async_press", "signature":...
2
null
Implement the Python class `BMWButton` described below. Class description: Representation of a MyBMW button. Method signatures and docstrings: - def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWButtonEntityDescription) -> None: Initialize BMW vehicle sensor. - async def...
Implement the Python class `BMWButton` described below. Class description: Representation of a MyBMW button. Method signatures and docstrings: - def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWButtonEntityDescription) -> None: Initialize BMW vehicle sensor. - async def...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class BMWButton: """Representation of a MyBMW button.""" def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWButtonEntityDescription) -> None: """Initialize BMW vehicle sensor.""" <|body_0|> async def async_press(self) -> None: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BMWButton: """Representation of a MyBMW button.""" def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWButtonEntityDescription) -> None: """Initialize BMW vehicle sensor.""" super().__init__(coordinator, vehicle) self.entity_description...
the_stack_v2_python_sparse
homeassistant/components/bmw_connected_drive/button.py
home-assistant/core
train
35,501
be253ce7d07cd3c3ddaa83a409c12f0c513cc5da
[ "user_list = None\nif query == None:\n user_list = User.objects.filter(Q(user_profile__isnull=False))\nelse:\n user_list = User.objects.filter(Q(first_name__icontains=query) | Q(last_name__icontains=query)).distinct()\nreturn user_list", "user_list = None\nif query == None:\n user_list = User.objects.fil...
<|body_start_0|> user_list = None if query == None: user_list = User.objects.filter(Q(user_profile__isnull=False)) else: user_list = User.objects.filter(Q(first_name__icontains=query) | Q(last_name__icontains=query)).distinct() return user_list <|end_body_0|> <|b...
This module contains service classes for performing services related searching user profiles.
UserSearchService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSearchService: """This module contains service classes for performing services related searching user profiles.""" def get_users_by_name(query): """This static method searches for all users with given query in their first name or last name or query as one of their skills.""" ...
stack_v2_sparse_classes_10k_train_005663
1,909
permissive
[ { "docstring": "This static method searches for all users with given query in their first name or last name or query as one of their skills.", "name": "get_users_by_name", "signature": "def get_users_by_name(query)" }, { "docstring": "This static method searches for all users with given query as...
3
stack_v2_sparse_classes_30k_train_003900
Implement the Python class `UserSearchService` described below. Class description: This module contains service classes for performing services related searching user profiles. Method signatures and docstrings: - def get_users_by_name(query): This static method searches for all users with given query in their first n...
Implement the Python class `UserSearchService` described below. Class description: This module contains service classes for performing services related searching user profiles. Method signatures and docstrings: - def get_users_by_name(query): This static method searches for all users with given query in their first n...
3ad913e1030da5c4fb0ac4690488a48dec278f3b
<|skeleton|> class UserSearchService: """This module contains service classes for performing services related searching user profiles.""" def get_users_by_name(query): """This static method searches for all users with given query in their first name or last name or query as one of their skills.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserSearchService: """This module contains service classes for performing services related searching user profiles.""" def get_users_by_name(query): """This static method searches for all users with given query in their first name or last name or query as one of their skills.""" user_list...
the_stack_v2_python_sparse
sase/mycraze/services/search.py
SrikrishnanS/ProfilesHub
train
0
042dd0d150b1e9fee2b95c743d6cbd160c3a4f8a
[ "self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nself.K = self.kernel(X_init, X_init)", "sqdist = np.sum(X1 ** 2, 1).reshape(-1, 1) + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T)\nreturn self.sigma_f ** 2 * np.exp(-0.5 / self.l ** 2 * sqdist)\n'\\n K = np.zeros((X1.shape[0], X2.shape[0])...
<|body_start_0|> self.X = X_init self.Y = Y_init self.l = l self.sigma_f = sigma_f self.K = self.kernel(X_init, X_init) <|end_body_0|> <|body_start_1|> sqdist = np.sum(X1 ** 2, 1).reshape(-1, 1) + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T) return self.sigma_f ** 2...
represents a noiseless 1D Gaussian process
GaussianProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcess: """represents a noiseless 1D Gaussian process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of black-box function for each input in X_init t is the number o...
stack_v2_sparse_classes_10k_train_005664
2,762
no_license
[ { "docstring": "X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of black-box function for each input in X_init t is the number of initial samples l is the length parameter for the kernel sigma_f is the standard deviation given to the output of the black-box fun...
2
null
Implement the Python class `GaussianProcess` described below. Class description: represents a noiseless 1D Gaussian process Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of blac...
Implement the Python class `GaussianProcess` described below. Class description: represents a noiseless 1D Gaussian process Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of blac...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class GaussianProcess: """represents a noiseless 1D Gaussian process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of black-box function for each input in X_init t is the number o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GaussianProcess: """represents a noiseless 1D Gaussian process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """X_init ndarray (t, 1) inputs already sampled with black-box function Y_init ndarray (t, 1) outputs of black-box function for each input in X_init t is the number of initial sam...
the_stack_v2_python_sparse
unsupervised_learning/0x03-hyperparameter_tuning/0-gp copy.py
icculp/holbertonschool-machine_learning
train
0
e79d104ebc2456ebc8816db0762f2e2dc74a2df8
[ "super().__init__()\nself.mlp = mlp\nself.use_softmax = use_softmax", "B, C, N = feature.size()\nfeature = feature.view(B, C, N, 1).repeat(1, 1, 1, N)\nif feature.device.type == 'cpu':\n feature = feature - feature.transpose(2, 3).contiguous() + torch.mul(feature, torch.eye(N).view(1, 1, N, N))\nelse:\n fea...
<|body_start_0|> super().__init__() self.mlp = mlp self.use_softmax = use_softmax <|end_body_0|> <|body_start_1|> B, C, N = feature.size() feature = feature.view(B, C, N, 1).repeat(1, 1, 1, N) if feature.device.type == 'cpu': feature = feature - feature.trans...
AFAModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AFAModule: def __init__(self, mlp, use_softmax=False): """:param mlp: mlp for learning weight mode: transformation or aggregation""" <|body_0|> def forward(self, feature: torch.Tensor) -> torch.Tensor: """Parameters ---------- features : torch.Tensor (B, C, N, M) or ...
stack_v2_sparse_classes_10k_train_005665
12,242
permissive
[ { "docstring": ":param mlp: mlp for learning weight mode: transformation or aggregation", "name": "__init__", "signature": "def __init__(self, mlp, use_softmax=False)" }, { "docstring": "Parameters ---------- features : torch.Tensor (B, C, N, M) or (B, C, N) Returns ------- new_features : torch....
2
stack_v2_sparse_classes_30k_test_000177
Implement the Python class `AFAModule` described below. Class description: Implement the AFAModule class. Method signatures and docstrings: - def __init__(self, mlp, use_softmax=False): :param mlp: mlp for learning weight mode: transformation or aggregation - def forward(self, feature: torch.Tensor) -> torch.Tensor: ...
Implement the Python class `AFAModule` described below. Class description: Implement the AFAModule class. Method signatures and docstrings: - def __init__(self, mlp, use_softmax=False): :param mlp: mlp for learning weight mode: transformation or aggregation - def forward(self, feature: torch.Tensor) -> torch.Tensor: ...
241b3c94112efb2944a27e4cc3eb1d65775edc10
<|skeleton|> class AFAModule: def __init__(self, mlp, use_softmax=False): """:param mlp: mlp for learning weight mode: transformation or aggregation""" <|body_0|> def forward(self, feature: torch.Tensor) -> torch.Tensor: """Parameters ---------- features : torch.Tensor (B, C, N, M) or ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AFAModule: def __init__(self, mlp, use_softmax=False): """:param mlp: mlp for learning weight mode: transformation or aggregation""" super().__init__() self.mlp = mlp self.use_softmax = use_softmax def forward(self, feature: torch.Tensor) -> torch.Tensor: """Parame...
the_stack_v2_python_sparse
crowd_nav/policy/gipcarl.py
sustech-isus/AEMCARL
train
0
d454c6e0331f685b99743ed36352ea689899d16a
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MeetingTimeSuggestion()", "from .attendee_availability import AttendeeAvailability\nfrom .free_busy_status import FreeBusyStatus\nfrom .location import Location\nfrom .time_slot import TimeSlot\nfrom .attendee_availability import Atten...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MeetingTimeSuggestion() <|end_body_0|> <|body_start_1|> from .attendee_availability import AttendeeAvailability from .free_busy_status import FreeBusyStatus from .location import...
MeetingTimeSuggestion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeetingTimeSuggestion: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MeetingTimeSuggestion: """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 th...
stack_v2_sparse_classes_10k_train_005666
5,183
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: MeetingTimeSuggestion", "name": "create_from_discriminator_value", "signature": "def create_from_discriminat...
3
null
Implement the Python class `MeetingTimeSuggestion` described below. Class description: Implement the MeetingTimeSuggestion class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MeetingTimeSuggestion: Creates a new instance of the appropriate class base...
Implement the Python class `MeetingTimeSuggestion` described below. Class description: Implement the MeetingTimeSuggestion class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MeetingTimeSuggestion: Creates a new instance of the appropriate class base...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MeetingTimeSuggestion: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MeetingTimeSuggestion: """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 th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MeetingTimeSuggestion: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MeetingTimeSuggestion: """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 Retur...
the_stack_v2_python_sparse
msgraph/generated/models/meeting_time_suggestion.py
microsoftgraph/msgraph-sdk-python
train
135
685db71c0fef3f4318c1bd110c1f328200b023c5
[ "super(FunctionComponent, self).__init__(opts)\nself.options = opts.get('fn_hibp', {})\nself.PROXIES = {}\nPROXY_HTTP = self.get_config_option('hibp_proxy_http', True)\nPROXY_HTTPS = self.get_config_option('hibp_proxy_https', True)\nif PROXY_HTTP is not None:\n self.PROXIES['http'] = PROXY_HTTP\nif PROXY_HTTPS i...
<|body_start_0|> super(FunctionComponent, self).__init__(opts) self.options = opts.get('fn_hibp', {}) self.PROXIES = {} PROXY_HTTP = self.get_config_option('hibp_proxy_http', True) PROXY_HTTPS = self.get_config_option('hibp_proxy_https', True) if PROXY_HTTP is not None: ...
Component that implements Resilient function 'have_i_been_pwned_get_pastes
FunctionComponent
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'have_i_been_pwned_get_pastes""" def __init__(self, opts): """constructor provides access to the configuration options""" <|body_0|> def get_config_option(self, option_name, optional=False): """Gi...
stack_v2_sparse_classes_10k_train_005667
3,804
permissive
[ { "docstring": "constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Given option_name, checks if it is in appconfig. Raises ValueError if a mandatory option is missing", "name": "get_config_option", "si...
3
stack_v2_sparse_classes_30k_train_000287
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'have_i_been_pwned_get_pastes Method signatures and docstrings: - def __init__(self, opts): constructor provides access to the configuration options - def get_config_option(self, option_name...
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'have_i_been_pwned_get_pastes Method signatures and docstrings: - def __init__(self, opts): constructor provides access to the configuration options - def get_config_option(self, option_name...
2e3c4b6102555517bad22bf87fa4a06341714166
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'have_i_been_pwned_get_pastes""" def __init__(self, opts): """constructor provides access to the configuration options""" <|body_0|> def get_config_option(self, option_name, optional=False): """Gi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FunctionComponent: """Component that implements Resilient function 'have_i_been_pwned_get_pastes""" def __init__(self, opts): """constructor provides access to the configuration options""" super(FunctionComponent, self).__init__(opts) self.options = opts.get('fn_hibp', {}) ...
the_stack_v2_python_sparse
fn_hibp/fn_hibp/components/have_i_been_pwned_get_pastes.py
jjfallete/resilient-community-apps
train
1
b3b4446140f490e733ab9273e5bb7bb8974feb54
[ "n = len(nums)\nif n < 2:\n return False\ntotal = sum(nums)\nif total % 2 == 1:\n return False\nm = total / 2\nmaxNumber = max(nums)\nif maxNumber > m and maxNumber + m > total:\n return False\ndp = [[0] * (m + 1) for _ in range(n)]\nif nums[0] <= m:\n dp[0][nums[0]] = 1\nfor i in range(1, n):\n for ...
<|body_start_0|> n = len(nums) if n < 2: return False total = sum(nums) if total % 2 == 1: return False m = total / 2 maxNumber = max(nums) if maxNumber > m and maxNumber + m > total: return False dp = [[0] * (m + 1) for...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" ...
stack_v2_sparse_classes_10k_train_005668
3,218
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List...
3
stack_v2_sparse_classes_30k_train_000234
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition(self, nums): :type nums: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition(self, nums): :type nums: Li...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" n = len(nums) if n < 2: return False total = sum(nums) if total % 2 == 1: return False m = total / 2 maxNumber = max(nums) if maxNumber > m a...
the_stack_v2_python_sparse
0416_Partition_Equal_Subset_Sum.py
bingli8802/leetcode
train
0
55cb2be3952f12dfbd01fa183a69f73d5a52228f
[ "logger.info(u'开始执行测试用例:用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面')\nlogger.info(u'开始登录操作...')\nself.assertTrue(self.user_login_success())\nlogger.info('点击mp公告按钮...')\nMainPage(self.driver).get_mp_note_btn().click()\nlogger.info(' 正在获得用例期望值...')\nexpected_value = get_expected_value('012')\nlogger.info('正在获得截图标题...')\...
<|body_start_0|> logger.info(u'开始执行测试用例:用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面') logger.info(u'开始登录操作...') self.assertTrue(self.user_login_success()) logger.info('点击mp公告按钮...') MainPage(self.driver).get_mp_note_btn().click() logger.info(' 正在获得用例期望值...') expected_...
mp 登录首页按钮页面跳转检查
MainPageForwardTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainPageForwardTest: """mp 登录首页按钮页面跳转检查""" def test_012_forward_send_all(self): """用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面""" <|body_0|> def test_013_forward_customed_menu(self): """用例编号013:mp登录后,通过点击自定义菜单跳转到自定义菜单界面""" <|body_1|> def test_014_forward...
stack_v2_sparse_classes_10k_train_005669
5,624
no_license
[ { "docstring": "用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面", "name": "test_012_forward_send_all", "signature": "def test_012_forward_send_all(self)" }, { "docstring": "用例编号013:mp登录后,通过点击自定义菜单跳转到自定义菜单界面", "name": "test_013_forward_customed_menu", "signature": "def test_013_forward_customed_m...
5
stack_v2_sparse_classes_30k_train_006187
Implement the Python class `MainPageForwardTest` described below. Class description: mp 登录首页按钮页面跳转检查 Method signatures and docstrings: - def test_012_forward_send_all(self): 用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面 - def test_013_forward_customed_menu(self): 用例编号013:mp登录后,通过点击自定义菜单跳转到自定义菜单界面 - def test_014_forward_fol...
Implement the Python class `MainPageForwardTest` described below. Class description: mp 登录首页按钮页面跳转检查 Method signatures and docstrings: - def test_012_forward_send_all(self): 用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面 - def test_013_forward_customed_menu(self): 用例编号013:mp登录后,通过点击自定义菜单跳转到自定义菜单界面 - def test_014_forward_fol...
5db7dc1a10100721180f0cc66e4c96479ec69501
<|skeleton|> class MainPageForwardTest: """mp 登录首页按钮页面跳转检查""" def test_012_forward_send_all(self): """用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面""" <|body_0|> def test_013_forward_customed_menu(self): """用例编号013:mp登录后,通过点击自定义菜单跳转到自定义菜单界面""" <|body_1|> def test_014_forward...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MainPageForwardTest: """mp 登录首页按钮页面跳转检查""" def test_012_forward_send_all(self): """用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面""" logger.info(u'开始执行测试用例:用例编号012:mp登录后,通过点击蓝凌软件群发功能全新上线跳转到群发消息界面') logger.info(u'开始登录操作...') self.assertTrue(self.user_login_success()) logge...
the_stack_v2_python_sparse
mp/test_model/test_case/main_page_menu_forward_test.py
eatingM/kk_mp
train
0
b82fc800dfec98c3254c3396b08fe1a4a5919eb8
[ "heap = []\nprojects = sorted(zip(Profits, Capital), key=lambda l: l[1])\nindex = 0\nfor i in range(k):\n while index < len(projects):\n if projects[index][1] > W:\n break\n else:\n self.heap_add(heap, projects[index][0])\n index += 1\n if not heap:\n break\n ...
<|body_start_0|> heap = [] projects = sorted(zip(Profits, Capital), key=lambda l: l[1]) index = 0 for i in range(k): while index < len(projects): if projects[index][1] > W: break else: self.heap_add(heap,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def heap_poll(heap): """堆弹出""" <|body_1|> def heap_add(heap, val): """堆添加""...
stack_v2_sparse_classes_10k_train_005670
2,105
no_license
[ { "docstring": ":type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int", "name": "findMaximizedCapital", "signature": "def findMaximizedCapital(self, k, W, Profits, Capital)" }, { "docstring": "堆弹出", "name": "heap_poll", "signature": "def heap_poll(heap)"...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def heap_poll(heap): 堆弹出 - def h...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def heap_poll(heap): 堆弹出 - def h...
86352d3f51ab030afdb7b472a80bc8cab7260c08
<|skeleton|> class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def heap_poll(heap): """堆弹出""" <|body_1|> def heap_add(heap, val): """堆添加""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" heap = [] projects = sorted(zip(Profits, Capital), key=lambda l: l[1]) index = 0 for i in range(k): ...
the_stack_v2_python_sparse
leetcode/_502_IPO.py
scolphew/leetcode_python
train
0
30a5ee229f4c1f7362685acc48abbe857b53741a
[ "clen = len(prerequisites)\nif clen == 0:\n return True\nvisited = [0 for _ in range(numCourses)]\ninverse_adj = [set() for _ in range(numCourses)]\nfor second, first in prerequisites:\n inverse_adj[second].add(first)\nfor i in range(numCourses):\n if self.__dfs(i, inverse_adj, visited):\n return Fa...
<|body_start_0|> clen = len(prerequisites) if clen == 0: return True visited = [0 for _ in range(numCourses)] inverse_adj = [set() for _ in range(numCourses)] for second, first in prerequisites: inverse_adj[second].add(first) for i in range(numCour...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int 课程门数 :type prerequisites: List[List[int]] 课程与课程之间的关系 :rtype: bool""" <|body_0|> def __dfs(self, vertex, inverse_adj, visited): """注意:这个递归方法的返回值是返回是否有环 :param vertex: 结点的索引 :param inver...
stack_v2_sparse_classes_10k_train_005671
8,289
no_license
[ { "docstring": ":type numCourses: int 课程门数 :type prerequisites: List[List[int]] 课程与课程之间的关系 :rtype: bool", "name": "canFinish", "signature": "def canFinish(self, numCourses, prerequisites)" }, { "docstring": "注意:这个递归方法的返回值是返回是否有环 :param vertex: 结点的索引 :param inverse_adj: 逆邻接表,记录的是当前结点的前驱结点的集合 :par...
2
stack_v2_sparse_classes_30k_train_001075
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinish(self, numCourses, prerequisites): :type numCourses: int 课程门数 :type prerequisites: List[List[int]] 课程与课程之间的关系 :rtype: bool - def __dfs(self, vertex, inverse_adj, vis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinish(self, numCourses, prerequisites): :type numCourses: int 课程门数 :type prerequisites: List[List[int]] 课程与课程之间的关系 :rtype: bool - def __dfs(self, vertex, inverse_adj, vis...
fd89d81943d862d9d6e8da661b50afa268b413c8
<|skeleton|> class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int 课程门数 :type prerequisites: List[List[int]] 课程与课程之间的关系 :rtype: bool""" <|body_0|> def __dfs(self, vertex, inverse_adj, visited): """注意:这个递归方法的返回值是返回是否有环 :param vertex: 结点的索引 :param inver...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int 课程门数 :type prerequisites: List[List[int]] 课程与课程之间的关系 :rtype: bool""" clen = len(prerequisites) if clen == 0: return True visited = [0 for _ in range(numCourses)] inverse_adj =...
the_stack_v2_python_sparse
207.课程表.py
jzijin/leetcode
train
1
347fc19ffb749ca1d5eab4c51dab41b8cd3c41ce
[ "self.last_i = 0\nself.last_j = 0\nself.last_sum = 0\nself.nums2 = nums\nself.firstcall = 1", "if not firstcall:\n if self.last_i <= i <= self.last_j and self.last_i <= j <= self.last_j:\n res = self.last_sum - sum(self.nums2[self.last_i:i]) - sum(self.nums2[j + 1:self.last_j + 1])\n elif self.last_i...
<|body_start_0|> self.last_i = 0 self.last_j = 0 self.last_sum = 0 self.nums2 = nums self.firstcall = 1 <|end_body_0|> <|body_start_1|> if not firstcall: if self.last_i <= i <= self.last_j and self.last_i <= j <= self.last_j: res = self.last_s...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_005672
1,794
no_license
[ { "docstring": "initialize your data structure here. :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, ...
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
7a1c3aba65f338f6e11afd2864dabd2b26142b6c
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" self.last_i = 0 self.last_j = 0 self.last_sum = 0 self.nums2 = nums self.firstcall = 1 def sumRange(self, i, j): """sum of elements nums[i..j], incl...
the_stack_v2_python_sparse
exercise/leetcode/python_src/by2017_Sep/Leet303.py
SS4G/AlgorithmTraining
train
2
46d72f1fcbf2e8fd032e27887ea46629909ce488
[ "N, i, m = (len(nums), len(nums) - 1, float('-inf'))\nwhile i >= 0 and nums[i] >= m:\n m, i = (max(m, nums[i]), i - 1)\nif i >= 0:\n j = i + 1\n while j < N and nums[j] > nums[i]:\n j = j + 1\n nums[i], nums[j - 1] = (nums[j - 1], nums[i])\ni, j = (i + 1, N - 1)\nwhile i < j:\n nums[i], nums[j...
<|body_start_0|> N, i, m = (len(nums), len(nums) - 1, float('-inf')) while i >= 0 and nums[i] >= m: m, i = (max(m, nums[i]), i - 1) if i >= 0: j = i + 1 while j < N and nums[j] > nums[i]: j = j + 1 nums[i], nums[j - 1] = (nums[j - 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. 뒤에서부터 시작해서 값이 감소할때까지 움직이고...
stack_v2_sparse_classes_10k_train_005673
1,756
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums: List[int]) -> None" }, { "docstring": "Do not return anything, modify nums in-place instead. 뒤에서부터 시작해서 값이 감소할때까지 움직이고, 그 위치에서 이전 보다 큰 값을 찾고, 뒤집는다. 123...
2
stack_v2_sparse_classes_30k_train_005132
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums: List[int]) -> None: Do not return anyt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums: List[int]) -> None: Do not return anyt...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. 뒤에서부터 시작해서 값이 감소할때까지 움직이고...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" N, i, m = (len(nums), len(nums) - 1, float('-inf')) while i >= 0 and nums[i] >= m: m, i = (max(m, nums[i]), i - 1) if i >= 0: j = i ...
the_stack_v2_python_sparse
Leetcode/31.py
hanwgyu/algorithm_problem_solving
train
5
ac12766ab40db82d403104e19ffe82c6060f678e
[ "if isinstance(data_particle, DataParticle):\n sample_dict = data_particle.generate_dict()\nelif isinstance(data_particle, basestring):\n sample_dict = json.loads(data_particle)\nelif isinstance(data_particle, dict):\n sample_dict = data_particle\nelse:\n raise IDKException('invalid data particle type: ...
<|body_start_0|> if isinstance(data_particle, DataParticle): sample_dict = data_particle.generate_dict() elif isinstance(data_particle, basestring): sample_dict = json.loads(data_particle) elif isinstance(data_particle, dict): sample_dict = data_particle ...
A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base.
ParticleTestMixin
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParticleTestMixin: """A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base.""" def convert_data_particle_to_dict(self, data_particle): """Convert a data particle object to a dic...
stack_v2_sparse_classes_10k_train_005674
5,556
permissive
[ { "docstring": "Convert a data particle object to a dict. This will work for data particles as DataParticle object, dictionaries or a string @param data_particle data particle @return dictionary representation of a data particle", "name": "convert_data_particle_to_dict", "signature": "def convert_data_p...
4
null
Implement the Python class `ParticleTestMixin` described below. Class description: A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base. Method signatures and docstrings: - def convert_data_particle_to_dict(self...
Implement the Python class `ParticleTestMixin` described below. Class description: A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base. Method signatures and docstrings: - def convert_data_particle_to_dict(self...
bdbf01f5614e7188ce19596704794466e5683b30
<|skeleton|> class ParticleTestMixin: """A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base.""" def convert_data_particle_to_dict(self, data_particle): """Convert a data particle object to a dic...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParticleTestMixin: """A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base.""" def convert_data_particle_to_dict(self, data_particle): """Convert a data particle object to a dict. This will ...
the_stack_v2_python_sparse
mi/core/unit_test.py
oceanobservatories/mi-instrument
train
1
dd861d776d14bf9bddb38906d327d4a8ee46ae1b
[ "logger.info('GENERATE FINGERPRINTS')\nlogger.info(f'Number of input structures: {len(structure_klifs_ids)}')\nstart_time = datetime.datetime.now()\nlogger.info(f'Fingerprint generation started at: {start_time}')\nif klifs_session is None:\n klifs_session = setup_remote()\nn_cores = set_n_cores(n_cores)\nfingerp...
<|body_start_0|> logger.info('GENERATE FINGERPRINTS') logger.info(f'Number of input structures: {len(structure_klifs_ids)}') start_time = datetime.datetime.now() logger.info(f'Fingerprint generation started at: {start_time}') if klifs_session is None: klifs_session = ...
FingerprintGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FingerprintGenerator: def from_structure_klifs_ids(cls, structure_klifs_ids, klifs_session=None, n_cores=1): """Calculate fingerprints for one or more KLIFS structures (by structure KLIFS IDs). Parameters ---------- structure_klifs_id : int Input structure KLIFS ID (output fingerprints m...
stack_v2_sparse_classes_10k_train_005675
3,626
permissive
[ { "docstring": "Calculate fingerprints for one or more KLIFS structures (by structure KLIFS IDs). Parameters ---------- structure_klifs_id : int Input structure KLIFS ID (output fingerprints may contain less IDs because some structures could not be encoded). klifs_session : opencadd.databases.klifs.session.Sess...
3
stack_v2_sparse_classes_30k_train_002327
Implement the Python class `FingerprintGenerator` described below. Class description: Implement the FingerprintGenerator class. Method signatures and docstrings: - def from_structure_klifs_ids(cls, structure_klifs_ids, klifs_session=None, n_cores=1): Calculate fingerprints for one or more KLIFS structures (by structu...
Implement the Python class `FingerprintGenerator` described below. Class description: Implement the FingerprintGenerator class. Method signatures and docstrings: - def from_structure_klifs_ids(cls, structure_klifs_ids, klifs_session=None, n_cores=1): Calculate fingerprints for one or more KLIFS structures (by structu...
8433bb64062ed785503b96b52f39bbdb02f66381
<|skeleton|> class FingerprintGenerator: def from_structure_klifs_ids(cls, structure_klifs_ids, klifs_session=None, n_cores=1): """Calculate fingerprints for one or more KLIFS structures (by structure KLIFS IDs). Parameters ---------- structure_klifs_id : int Input structure KLIFS ID (output fingerprints m...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FingerprintGenerator: def from_structure_klifs_ids(cls, structure_klifs_ids, klifs_session=None, n_cores=1): """Calculate fingerprints for one or more KLIFS structures (by structure KLIFS IDs). Parameters ---------- structure_klifs_id : int Input structure KLIFS ID (output fingerprints may contain les...
the_stack_v2_python_sparse
kissim/encoding/fingerprint_generator.py
volkamerlab/kissim
train
26
77e5a76db2ae23811be058a7db3f2900aa38b920
[ "flag = None\nif isinstance(str_one, str):\n str_one = str_one.encode('unicode-escape').decode('string_escape')\n return operator(str_one, str_two)\nif str_one in str_two:\n flag = True\nelse:\n flag = False\nreturn flag", "if isinstance(dict_one, str):\n dict_one = json.loads(dict_one)\n print(...
<|body_start_0|> flag = None if isinstance(str_one, str): str_one = str_one.encode('unicode-escape').decode('string_escape') return operator(str_one, str_two) if str_one in str_two: flag = True else: flag = False return flag <|end_b...
CommonUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonUtil: def is_contain(self, str_one, str_two): """判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串""" <|body_0|> def is_equal_dict(self, dict_one, dict_two): """判断两个字典是否相等""" <|body_1|> def is_json(self, data): """判断是否json格式""" <|bo...
stack_v2_sparse_classes_10k_train_005676
1,480
no_license
[ { "docstring": "判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串", "name": "is_contain", "signature": "def is_contain(self, str_one, str_two)" }, { "docstring": "判断两个字典是否相等", "name": "is_equal_dict", "signature": "def is_equal_dict(self, dict_one, dict_two)" }, { "docstring": "判...
3
stack_v2_sparse_classes_30k_train_002026
Implement the Python class `CommonUtil` described below. Class description: Implement the CommonUtil class. Method signatures and docstrings: - def is_contain(self, str_one, str_two): 判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串 - def is_equal_dict(self, dict_one, dict_two): 判断两个字典是否相等 - def is_json(self, data):...
Implement the Python class `CommonUtil` described below. Class description: Implement the CommonUtil class. Method signatures and docstrings: - def is_contain(self, str_one, str_two): 判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串 - def is_equal_dict(self, dict_one, dict_two): 判断两个字典是否相等 - def is_json(self, data):...
7e84a4a93d7e7774b7f5bcc71beeba4fb4a5334b
<|skeleton|> class CommonUtil: def is_contain(self, str_one, str_two): """判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串""" <|body_0|> def is_equal_dict(self, dict_one, dict_two): """判断两个字典是否相等""" <|body_1|> def is_json(self, data): """判断是否json格式""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommonUtil: def is_contain(self, str_one, str_two): """判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串""" flag = None if isinstance(str_one, str): str_one = str_one.encode('unicode-escape').decode('string_escape') return operator(str_one, str_two) if s...
the_stack_v2_python_sparse
util/common_util.py
yuzj1113/APIAutoTestForUp360
train
5
639f990371bf20341eeb8b78734bac7be8cf8876
[ "oper = {'and': 'intersection', 'or': 'union', 'not': 'complement'}\nif len(item) < 2 or len(item) > 3:\n raise TypeError('{} must be exactly 1 operator and 1-2 items'.format(item))\nself._check('operator', item[0], str, choices=oper.keys())\nself._check('operand1', item[1], (int, tuple))\nif len(item) == 3:\n ...
<|body_start_0|> oper = {'and': 'intersection', 'or': 'union', 'not': 'complement'} if len(item) < 2 or len(item) > 3: raise TypeError('{} must be exactly 1 operator and 1-2 items'.format(item)) self._check('operator', item[0], str, choices=oper.keys()) self._check('operand1'...
SCEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SCEndpoint: def _combo_expansion(self, item): """Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_005677
12,037
permissive
[ { "docstring": "Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.", "name": "_combo_expansion", "signature": "def _combo_expansion(self, item)...
3
stack_v2_sparse_classes_30k_train_001878
Implement the Python class `SCEndpoint` described below. Class description: Implement the SCEndpoint class. Method signatures and docstrings: - def _combo_expansion(self, item): Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`d...
Implement the Python class `SCEndpoint` described below. Class description: Implement the SCEndpoint class. Method signatures and docstrings: - def _combo_expansion(self, item): Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`d...
4e31049891f55016168b14ae30d332a965523640
<|skeleton|> class SCEndpoint: def _combo_expansion(self, item): """Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SCEndpoint: def _combo_expansion(self, item): """Expands the asset combination expressions from nested tuples to the nested dictionary structure that's expected. Args: item Returns: :obj:`dict`: The dictionary structure of the expanded asset list combinations.""" oper = {'and': 'intersection',...
the_stack_v2_python_sparse
tenable/sc/base.py
tenable/pyTenable
train
300
767d9c3833c0818432748ddbfc8a00274ae2ac76
[ "super().__init__(**kwargs)\nself._sublayers = []\nfor num_units in units[:-1]:\n self._sublayers.append(tf.keras.layers.Dense(num_units, activation=activation, use_bias=use_bias))\nself._sublayers.append(tf.keras.layers.Dense(units[-1], activation=final_activation, use_bias=use_bias))", "for layer in self._su...
<|body_start_0|> super().__init__(**kwargs) self._sublayers = [] for num_units in units[:-1]: self._sublayers.append(tf.keras.layers.Dense(num_units, activation=activation, use_bias=use_bias)) self._sublayers.append(tf.keras.layers.Dense(units[-1], activation=final_activation...
Sequential multi-layer perceptron (MLP) block.
MLP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """Sequential multi-layer perceptron (MLP) block.""" def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) -> None: """Initializes the MLP layer. Args: units: Sequenti...
stack_v2_sparse_classes_10k_train_005678
1,936
permissive
[ { "docstring": "Initializes the MLP layer. Args: units: Sequential list of layer sizes. use_bias: Whether to include a bias term. activation: Type of activation to use on all except the last layer. final_activation: Type of activation to use on last layer. **kwargs: Extra args passed to the Keras Layer base cla...
2
stack_v2_sparse_classes_30k_train_002534
Implement the Python class `MLP` described below. Class description: Sequential multi-layer perceptron (MLP) block. Method signatures and docstrings: - def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) ...
Implement the Python class `MLP` described below. Class description: Sequential multi-layer perceptron (MLP) block. Method signatures and docstrings: - def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) ...
f4f42c1a183a262539e21f5ab8d25f0dc3e5621d
<|skeleton|> class MLP: """Sequential multi-layer perceptron (MLP) block.""" def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) -> None: """Initializes the MLP layer. Args: units: Sequenti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MLP: """Sequential multi-layer perceptron (MLP) block.""" def __init__(self, units: List[int], use_bias: bool=True, activation: Optional[types.Activation]='relu', final_activation: Optional[types.Activation]=None, **kwargs) -> None: """Initializes the MLP layer. Args: units: Sequential list of la...
the_stack_v2_python_sparse
tensorflow_recommenders/layers/blocks.py
tensorflow/recommenders
train
1,666
85a0fd1109ee42068b83739de8dad750ed437f61
[ "if not root:\n return []\nl = []\nque = [root]\nwhile que:\n node = que[0]\n que = que[1:]\n if node:\n l.append(node.val)\n que.append(node.left)\n que.append(node.right)\n else:\n l.append(None)\nreturn l", "datalist = data\nif len(datalist) == 0:\n return []\nroot...
<|body_start_0|> if not root: return [] l = [] que = [root] while que: node = que[0] que = que[1:] if node: l.append(node.val) que.append(node.left) que.append(node.right) else: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str 'a,b,c,d,e' 执行用时 : 1792 ms, 在所有 Python3 提交中击败了5.23%的用户 内存消耗 : 18.4 MB, 在所有 Python3 提交中击败了50.00%的用户""" <|body_0|> def deserialize(self, data): """Decodes your enco...
stack_v2_sparse_classes_10k_train_005679
1,965
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str 'a,b,c,d,e' 执行用时 : 1792 ms, 在所有 Python3 提交中击败了5.23%的用户 内存消耗 : 18.4 MB, 在所有 Python3 提交中击败了50.00%的用户", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to t...
2
stack_v2_sparse_classes_30k_train_003193
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str 'a,b,c,d,e' 执行用时 : 1792 ms, 在所有 Python3 提交中击败了5.23%的用户 内存消耗 : 18.4 MB, 在所有 Python3 提交中击败了...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str 'a,b,c,d,e' 执行用时 : 1792 ms, 在所有 Python3 提交中击败了5.23%的用户 内存消耗 : 18.4 MB, 在所有 Python3 提交中击败了...
89f44b711ea1788f1a25fcd07a974a22539587ef
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str 'a,b,c,d,e' 执行用时 : 1792 ms, 在所有 Python3 提交中击败了5.23%的用户 内存消耗 : 18.4 MB, 在所有 Python3 提交中击败了50.00%的用户""" <|body_0|> def deserialize(self, data): """Decodes your enco...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str 'a,b,c,d,e' 执行用时 : 1792 ms, 在所有 Python3 提交中击败了5.23%的用户 内存消耗 : 18.4 MB, 在所有 Python3 提交中击败了50.00%的用户""" if not root: return [] l = [] que = [root] while qu...
the_stack_v2_python_sparse
297二叉树的序列化与反序列化.py
bettyzry/leetcode
train
0
bb23e9faaf55c9dc2505fc0ca36fd20f31300a6d
[ "super().__init__(ambient, mac_address, station_name, description)\nif description.key == TYPE_SOLARRADIATION_LX:\n self.entity_id = f'sensor.{station_name}_solar_rad_lx'", "key = self.entity_description.key\nraw = self._ambient.stations[self._mac_address][ATTR_LAST_DATA][key]\nif key == TYPE_LASTRAIN:\n se...
<|body_start_0|> super().__init__(ambient, mac_address, station_name, description) if description.key == TYPE_SOLARRADIATION_LX: self.entity_id = f'sensor.{station_name}_solar_rad_lx' <|end_body_0|> <|body_start_1|> key = self.entity_description.key raw = self._ambient.stati...
Define an Ambient sensor.
AmbientWeatherSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmbientWeatherSensor: """Define an Ambient sensor.""" def __init__(self, ambient: AmbientStation, mac_address: str, station_name: str, description: EntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def update_from_latest_data(self) -> None: """F...
stack_v2_sparse_classes_10k_train_005680
24,902
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, ambient: AmbientStation, mac_address: str, station_name: str, description: EntityDescription) -> None" }, { "docstring": "Fetch new state data for the sensor.", "name": "update_from_latest_data", ...
2
null
Implement the Python class `AmbientWeatherSensor` described below. Class description: Define an Ambient sensor. Method signatures and docstrings: - def __init__(self, ambient: AmbientStation, mac_address: str, station_name: str, description: EntityDescription) -> None: Initialize the sensor. - def update_from_latest_...
Implement the Python class `AmbientWeatherSensor` described below. Class description: Define an Ambient sensor. Method signatures and docstrings: - def __init__(self, ambient: AmbientStation, mac_address: str, station_name: str, description: EntityDescription) -> None: Initialize the sensor. - def update_from_latest_...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AmbientWeatherSensor: """Define an Ambient sensor.""" def __init__(self, ambient: AmbientStation, mac_address: str, station_name: str, description: EntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def update_from_latest_data(self) -> None: """F...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AmbientWeatherSensor: """Define an Ambient sensor.""" def __init__(self, ambient: AmbientStation, mac_address: str, station_name: str, description: EntityDescription) -> None: """Initialize the sensor.""" super().__init__(ambient, mac_address, station_name, description) if descrip...
the_stack_v2_python_sparse
homeassistant/components/ambient_station/sensor.py
home-assistant/core
train
35,501
5055468924fa40be02902451f8716c95c3eca4ae
[ "self.max_cols = max_cols\nself.max_h_space = max_h_space\nself.max_fontsize = max_fontsize\nself.min_fontsize = min_fontsize\nself.total_fontsize = total_fontsize\nself.rows_per_col = rows_per_col\nself.space_scale = space_scale", "if self.max_cols is not None:\n return int(max(min(ceil(num_plots / self.rows_...
<|body_start_0|> self.max_cols = max_cols self.max_h_space = max_h_space self.max_fontsize = max_fontsize self.min_fontsize = min_fontsize self.total_fontsize = total_fontsize self.rows_per_col = rows_per_col self.space_scale = space_scale <|end_body_0|> <|body_s...
A class to store the constants and methods for generating a nice legend outside the subplot area (matplotlib)
LegendSize
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LegendSize: """A class to store the constants and methods for generating a nice legend outside the subplot area (matplotlib)""" def __init__(self, max_cols, max_h_space, max_fontsize, min_fontsize, total_fontsize, rows_per_col, space_scale): """Initialize a LegendSize instance :param...
stack_v2_sparse_classes_10k_train_005681
2,909
permissive
[ { "docstring": "Initialize a LegendSize instance :param max_cols: maximum allowed number of columns for the legend :param max_h_space: maximum proportion of horizontal space to be apportioned to the legend :param max_fontsize: maximum font size for legend labels :param min_fontsize: minimum font size for legend...
4
stack_v2_sparse_classes_30k_train_000690
Implement the Python class `LegendSize` described below. Class description: A class to store the constants and methods for generating a nice legend outside the subplot area (matplotlib) Method signatures and docstrings: - def __init__(self, max_cols, max_h_space, max_fontsize, min_fontsize, total_fontsize, rows_per_c...
Implement the Python class `LegendSize` described below. Class description: A class to store the constants and methods for generating a nice legend outside the subplot area (matplotlib) Method signatures and docstrings: - def __init__(self, max_cols, max_h_space, max_fontsize, min_fontsize, total_fontsize, rows_per_c...
4a03664f1cc9552787bd9cb39d1409b507f10777
<|skeleton|> class LegendSize: """A class to store the constants and methods for generating a nice legend outside the subplot area (matplotlib)""" def __init__(self, max_cols, max_h_space, max_fontsize, min_fontsize, total_fontsize, rows_per_col, space_scale): """Initialize a LegendSize instance :param...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LegendSize: """A class to store the constants and methods for generating a nice legend outside the subplot area (matplotlib)""" def __init__(self, max_cols, max_h_space, max_fontsize, min_fontsize, total_fontsize, rows_per_col, space_scale): """Initialize a LegendSize instance :param max_cols: ma...
the_stack_v2_python_sparse
src/LegendSize.py
dilynfullerton/tr-A_dependence_plots
train
1
5e52d56c3763f619a06de8225185562aa1dc113d
[ "super().__init__(weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries)\nself.unit_descriptions = unit_descriptions\nif self.entity_description.is_forecast_item:\n self.forecast_data = getattr(self.forecast_coordinator.data, 'forecast')\n self.day_data: ForecastDetailDescriptio...
<|body_start_0|> super().__init__(weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries) self.unit_descriptions = unit_descriptions if self.entity_description.is_forecast_item: self.forecast_data = getattr(self.forecast_coordinator.data, 'forecast') ...
Implementation of Weatherbit sensor.
WeatherbitSensor
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeatherbitSensor: """Implementation of Weatherbit sensor.""" def __init__(self, weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries: ConfigEntry, unit_descriptions): """Initialize an WeatherFlow sensor.""" <|body_0|> def native_value(self...
stack_v2_sparse_classes_10k_train_005682
17,617
permissive
[ { "docstring": "Initialize an WeatherFlow sensor.", "name": "__init__", "signature": "def __init__(self, weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries: ConfigEntry, unit_descriptions)" }, { "docstring": "Return the state of the sensor.", "name": "native...
4
stack_v2_sparse_classes_30k_train_001272
Implement the Python class `WeatherbitSensor` described below. Class description: Implementation of Weatherbit sensor. Method signatures and docstrings: - def __init__(self, weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries: ConfigEntry, unit_descriptions): Initialize an WeatherFlow...
Implement the Python class `WeatherbitSensor` described below. Class description: Implementation of Weatherbit sensor. Method signatures and docstrings: - def __init__(self, weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries: ConfigEntry, unit_descriptions): Initialize an WeatherFlow...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class WeatherbitSensor: """Implementation of Weatherbit sensor.""" def __init__(self, weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries: ConfigEntry, unit_descriptions): """Initialize an WeatherFlow sensor.""" <|body_0|> def native_value(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WeatherbitSensor: """Implementation of Weatherbit sensor.""" def __init__(self, weatherbitapi, coordinator, forecast_coordinator, station_data, description, entries: ConfigEntry, unit_descriptions): """Initialize an WeatherFlow sensor.""" super().__init__(weatherbitapi, coordinator, forec...
the_stack_v2_python_sparse
custom_components/weatherbit/sensor.py
bacco007/HomeAssistantConfig
train
98
dac925a2145fa34e8bd7ef71b271c2d78bc05f2c
[ "samples = len(y_pred)\ny_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07)\nif len(y_true.shape) == 1:\n correct_confidences = y_pred_clipped[range(samples), y_true]\nelif len(y_true.shape) == 2:\n correct_confidences = np.sum(y_pred_clipped * y_true, axis=1)\nnegative_log_likelihoods = -np.log(correct_confid...
<|body_start_0|> samples = len(y_pred) y_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07) if len(y_true.shape) == 1: correct_confidences = y_pred_clipped[range(samples), y_true] elif len(y_true.shape) == 2: correct_confidences = np.sum(y_pred_clipped * y_true, axi...
The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]
CategoricalCrossentropy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward p...
stack_v2_sparse_classes_10k_train_005683
2,192
no_license
[ { "docstring": "Performs the forward pass. Args : y_pred(np.array): Model predictions y_true(np.array): Actual values Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]", "name": "forward", "signature": "def forward(self, y_pred, y_true)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_005063
Implement the Python class `CategoricalCrossentropy` described below. Class description: The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116] Method signatures and docstrings: - ...
Implement the Python class `CategoricalCrossentropy` described below. Class description: The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116] Method signatures and docstrings: - ...
8ffd24971d8808e7c9caa722a7ff4df306b75b90
<|skeleton|> class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward pass. Args : y...
the_stack_v2_python_sparse
Music Recognizer/Metrics/CategoricalCrossentropy.py
andutzu7/Lucrare-Licenta-MusicRecognizer
train
0
85a49d2f9085f149f8311fc61507e5d9fbd93550
[ "self.cluster_count = cluster_count\nself.end_time_usecs = end_time_usecs\nself.error = error\nself.job_count = job_count\nself.name = name\nself.search_job_status = search_job_status\nself.search_job_uid = search_job_uid\nself.start_time_usecs = start_time_usecs\nself.vault_id = vault_id\nself.vault_name = vault_n...
<|body_start_0|> self.cluster_count = cluster_count self.end_time_usecs = end_time_usecs self.error = error self.job_count = job_count self.name = name self.search_job_status = search_job_status self.search_job_uid = search_job_uid self.start_time_usecs = ...
Implementation of the 'RemoteVaultSearchJobInformation' model. Specifies information about a search of a remote Vault. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault and match the search criteria for this job, up to this point in the search. If the search is complet...
RemoteVaultSearchJobInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteVaultSearchJobInformation: """Implementation of the 'RemoteVaultSearchJobInformation' model. Specifies information about a search of a remote Vault. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault and match the search criteria for this jo...
stack_v2_sparse_classes_10k_train_005684
5,384
permissive
[ { "docstring": "Constructor for the RemoteVaultSearchJobInformation class", "name": "__init__", "signature": "def __init__(self, cluster_count=None, end_time_usecs=None, error=None, job_count=None, name=None, search_job_status=None, search_job_uid=None, start_time_usecs=None, vault_id=None, vault_name=N...
2
stack_v2_sparse_classes_30k_train_002150
Implement the Python class `RemoteVaultSearchJobInformation` described below. Class description: Implementation of the 'RemoteVaultSearchJobInformation' model. Specifies information about a search of a remote Vault. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault an...
Implement the Python class `RemoteVaultSearchJobInformation` described below. Class description: Implementation of the 'RemoteVaultSearchJobInformation' model. Specifies information about a search of a remote Vault. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault an...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RemoteVaultSearchJobInformation: """Implementation of the 'RemoteVaultSearchJobInformation' model. Specifies information about a search of a remote Vault. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault and match the search criteria for this jo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RemoteVaultSearchJobInformation: """Implementation of the 'RemoteVaultSearchJobInformation' model. Specifies information about a search of a remote Vault. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault and match the search criteria for this job, up to this...
the_stack_v2_python_sparse
cohesity_management_sdk/models/remote_vault_search_job_information.py
cohesity/management-sdk-python
train
24
377161134525ffa0d72a7e3fcc0b345c66006f9a
[ "setup_metrics = {tuple(m.path): m.id for m in metrics if m.metric in {'SLA | JITTER', 'SLA | UDP RTT'}}\nv = self.cli('show ip sla statistics')\nmetric_map = {'ipsla operation id': 'name', 'latest rtt': 'rtt', 'source to destination jitter min/avg/max': 'sd_jitter', 'destination to source jitter min/avg/max': 'ds_...
<|body_start_0|> setup_metrics = {tuple(m.path): m.id for m in metrics if m.metric in {'SLA | JITTER', 'SLA | UDP RTT'}} v = self.cli('show ip sla statistics') metric_map = {'ipsla operation id': 'name', 'latest rtt': 'rtt', 'source to destination jitter min/avg/max': 'sd_jitter', 'destination t...
Script
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Script: def get_ip_sla_udp_jitter_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:""" <|body_0|> def get_ip_sla_icmp_echo_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe...
stack_v2_sparse_classes_10k_train_005685
6,963
permissive
[ { "docstring": "Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:", "name": "get_ip_sla_udp_jitter_metrics_cli", "signature": "def get_ip_sla_udp_jitter_metrics_cli(self, metrics)" }, { "docstring": "Returns collected ip sla metrics in form probe id -> { rtt: ...
3
null
Implement the Python class `Script` described below. Class description: Implement the Script class. Method signatures and docstrings: - def get_ip_sla_udp_jitter_metrics_cli(self, metrics): Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return: - def get_ip_sla_icmp_echo_metrics_cli(sel...
Implement the Python class `Script` described below. Class description: Implement the Script class. Method signatures and docstrings: - def get_ip_sla_udp_jitter_metrics_cli(self, metrics): Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return: - def get_ip_sla_icmp_echo_metrics_cli(sel...
aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb
<|skeleton|> class Script: def get_ip_sla_udp_jitter_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:""" <|body_0|> def get_ip_sla_icmp_echo_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Script: def get_ip_sla_udp_jitter_metrics_cli(self, metrics): """Returns collected ip sla metrics in form probe id -> { rtt: RTT in seconds } :return:""" setup_metrics = {tuple(m.path): m.id for m in metrics if m.metric in {'SLA | JITTER', 'SLA | UDP RTT'}} v = self.cli('show ip sla st...
the_stack_v2_python_sparse
sa/profiles/Cisco/IOS/get_metrics.py
ewwwcha/noc
train
1
2814fac3fba92e37576e616520bb00f0de005f37
[ "self.change_password_on_next_logon = change_password_on_next_logon\nself.leave_state_disabled = leave_state_disabled\nself.object_guids = object_guids\nself.organization_unit_path = organization_unit_path\nself.password = password", "if dictionary is None:\n return None\nchange_password_on_next_logon = dictio...
<|body_start_0|> self.change_password_on_next_logon = change_password_on_next_logon self.leave_state_disabled = leave_state_disabled self.object_guids = object_guids self.organization_unit_path = organization_unit_path self.password = password <|end_body_0|> <|body_start_1|> ...
Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' type of objects to change password when they next logo...
AdObjectRestoreParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdObjectRestoreParameters: """Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' t...
stack_v2_sparse_classes_10k_train_005686
4,435
permissive
[ { "docstring": "Constructor for the AdObjectRestoreParameters class", "name": "__init__", "signature": "def __init__(self, change_password_on_next_logon=None, leave_state_disabled=None, object_guids=None, organization_unit_path=None, password=None)" }, { "docstring": "Creates an instance of this...
2
null
Implement the Python class `AdObjectRestoreParameters` described below. Class description: Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool...
Implement the Python class `AdObjectRestoreParameters` described below. Class description: Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AdObjectRestoreParameters: """Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdObjectRestoreParameters: """Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' type of object...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ad_object_restore_parameters.py
cohesity/management-sdk-python
train
24
797379f560bc20f6f5f1f295e3476dbeee322b73
[ "res = []\nself._distance(root, target, K, res)\nreturn res", "if not root:\n return -1\nif root == target:\n self.collect(target, K, res)\n return 0\nl = self._distance(root.left, target, K, res)\nr = self._distance(root.right, target, K, res)\nif l >= 0:\n if l + 1 == K:\n res.append(root.val...
<|body_start_0|> res = [] self._distance(root, target, K, res) return res <|end_body_0|> <|body_start_1|> if not root: return -1 if root == target: self.collect(target, K, res) return 0 l = self._distance(root.left, target, K, res) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def distanceK(self, root, target, K): """:type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int]""" <|body_0|> def _distance(self, root, target, K, res): """return distance from root to target return -1 if target does not found from root"...
stack_v2_sparse_classes_10k_train_005687
1,872
no_license
[ { "docstring": ":type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int]", "name": "distanceK", "signature": "def distanceK(self, root, target, K)" }, { "docstring": "return distance from root to target return -1 if target does not found from root", "name": "_distance", ...
3
stack_v2_sparse_classes_30k_train_004292
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distanceK(self, root, target, K): :type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int] - def _distance(self, root, target, K, res): return distance from...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distanceK(self, root, target, K): :type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int] - def _distance(self, root, target, K, res): return distance from...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def distanceK(self, root, target, K): """:type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int]""" <|body_0|> def _distance(self, root, target, K, res): """return distance from root to target return -1 if target does not found from root"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def distanceK(self, root, target, K): """:type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int]""" res = [] self._distance(root, target, K, res) return res def _distance(self, root, target, K, res): """return distance from root to targ...
the_stack_v2_python_sparse
Algorithm/863_All_Nodes_Distance_K_in_BT.py
Gi1ia/TechNoteBook
train
7
aaf06090255286caa526f1d98760fdde623367cb
[ "jewels_set = set(J)\nret = 0\nfor c in S:\n if c in jewels_set:\n ret += 1\nreturn ret", "jewels_map = {}\nfor c in J:\n jewels_map[c] = 1\nret = 0\nfor c in S:\n if jewels_map.get(c, 0) == 1:\n ret += 1\nreturn ret" ]
<|body_start_0|> jewels_set = set(J) ret = 0 for c in S: if c in jewels_set: ret += 1 return ret <|end_body_0|> <|body_start_1|> jewels_map = {} for c in J: jewels_map[c] = 1 ret = 0 for c in S: if jewel...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_0|> def numJewelsInStones1(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> jewels_set = set(J) ...
stack_v2_sparse_classes_10k_train_005688
730
no_license
[ { "docstring": ":type J: str :type S: str :rtype: int", "name": "numJewelsInStones", "signature": "def numJewelsInStones(self, J, S)" }, { "docstring": ":type J: str :type S: str :rtype: int", "name": "numJewelsInStones1", "signature": "def numJewelsInStones1(self, J, S)" } ]
2
stack_v2_sparse_classes_30k_train_005696
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numJewelsInStones(self, J, S): :type J: str :type S: str :rtype: int - def numJewelsInStones1(self, J, S): :type J: str :type S: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numJewelsInStones(self, J, S): :type J: str :type S: str :rtype: int - def numJewelsInStones1(self, J, S): :type J: str :type S: str :rtype: int <|skeleton|> class Solution:...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_0|> def numJewelsInStones1(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" jewels_set = set(J) ret = 0 for c in S: if c in jewels_set: ret += 1 return ret def numJewelsInStones1(self, J, S): """:type J: str :type S:...
the_stack_v2_python_sparse
python/leetcode_bak/771_Jewels_and_Stones.py
bobcaoge/my-code
train
0
d14f8beeb9e8e03cbbb7f62f5d364e9578d23aa4
[ "ReconstFit.__init__(self, fiber_model, vox_data)\nself.life_matrix = life_matrix\nself.vox_coords = vox_coords\nself.fit_data = to_fit\nself.beta = beta\nself.weighted_signal = weighted_signal\nself.b0_signal = b0_signal\nself.relative_signal = relative_signal\nself.mean_signal = mean_sig\nself.streamline = stream...
<|body_start_0|> ReconstFit.__init__(self, fiber_model, vox_data) self.life_matrix = life_matrix self.vox_coords = vox_coords self.fit_data = to_fit self.beta = beta self.weighted_signal = weighted_signal self.b0_signal = b0_signal self.relative_signal = r...
A fit of the LiFE model to diffusion data
FiberFit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FiberFit: """A fit of the LiFE model to diffusion data""" def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): """Parameters ---------- fiber_model : A FiberModel class inst...
stack_v2_sparse_classes_10k_train_005689
20,065
permissive
[ { "docstring": "Parameters ---------- fiber_model : A FiberModel class instance params : the parameters derived from a fit of the model to the data.", "name": "__init__", "signature": "def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mea...
2
stack_v2_sparse_classes_30k_train_000215
Implement the Python class `FiberFit` described below. Class description: A fit of the LiFE model to diffusion data Method signatures and docstrings: - def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): Pa...
Implement the Python class `FiberFit` described below. Class description: A fit of the LiFE model to diffusion data Method signatures and docstrings: - def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): Pa...
3c3acc55de8ba741e673063378e6cbaf10b64c7a
<|skeleton|> class FiberFit: """A fit of the LiFE model to diffusion data""" def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): """Parameters ---------- fiber_model : A FiberModel class inst...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FiberFit: """A fit of the LiFE model to diffusion data""" def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): """Parameters ---------- fiber_model : A FiberModel class instance params :...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/dipy/tracking/life.py
Raniac/NEURO-LEARN
train
9
7e9bb487978070a94bb50c02b69fe24294e9a02f
[ "if prob_win > 1 or prob_win < 0:\n raise AttributeError('prob_win must be between 0 and 1')\nself.prob_win = prob_win", "draw = random()\ndraw = draw * (player1.elo / player1.elo)\ndraw = draw * (player2.elo / player2.elo)\nif draw < self.prob_win:\n return 1\nreturn 0" ]
<|body_start_0|> if prob_win > 1 or prob_win < 0: raise AttributeError('prob_win must be between 0 and 1') self.prob_win = prob_win <|end_body_0|> <|body_start_1|> draw = random() draw = draw * (player1.elo / player1.elo) draw = draw * (player2.elo / player2.elo) ...
Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1).
CoinFlipEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoinFlipEngine: """Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1).""" def __init__(self, prob_win=0.5): """Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (be...
stack_v2_sparse_classes_10k_train_005690
1,361
permissive
[ { "docstring": "Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (between 0 and 1). Default is 0.5.", "name": "__init__", "signature": "def __init__(self, prob_win=0.5)" }, { "docstring": "Run the game, in this case draw from U...
2
stack_v2_sparse_classes_30k_train_006701
Implement the Python class `CoinFlipEngine` described below. Class description: Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1). Method signatures and docstrings: - def __init__(self, prob_win=0.5): Initialize a random Coin Flip Engine, winner decided by a coin f...
Implement the Python class `CoinFlipEngine` described below. Class description: Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1). Method signatures and docstrings: - def __init__(self, prob_win=0.5): Initialize a random Coin Flip Engine, winner decided by a coin f...
c7365a2face3ba10f5cb502d8bd964b60990a9f5
<|skeleton|> class CoinFlipEngine: """Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1).""" def __init__(self, prob_win=0.5): """Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (be...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CoinFlipEngine: """Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1).""" def __init__(self, prob_win=0.5): """Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (between 0 and 1...
the_stack_v2_python_sparse
battle_engine/coinflip.py
aturfah/cmplxsys530-final
train
4
a45bd42e3b29a6af758443782d1d7d411982823b
[ "super(DecoderBlock, self).__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernor...
<|body_start_0|> super(DecoderBlock, self).__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(dm) self.layernorm1 = tf.keras....
DecoderBlock class for machine translation
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """DecoderBlock class for machine translation""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.""" ...
stack_v2_sparse_classes_10k_train_005691
12,086
no_license
[ { "docstring": "[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "[summary] Args...
2
stack_v2_sparse_classes_30k_train_004492
Implement the Python class `DecoderBlock` described below. Class description: DecoderBlock class for machine translation Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): [summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (...
Implement the Python class `DecoderBlock` described below. Class description: DecoderBlock class for machine translation Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): [summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (...
5f86dee95f4d1c32014d0d74a368f342ff3ce6f7
<|skeleton|> class DecoderBlock: """DecoderBlock class for machine translation""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """DecoderBlock class for machine translation""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.""" super(Dec...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
d1sd41n/holbertonschool-machine_learning
train
0
97421b1a9d8db2b24f66e72effb56c021431a0d4
[ "if hasattr(request, 'user_rbac'):\n if request.user_rbac is not None:\n return True\nreturn False", "if hasattr(request, 'user_rbac'):\n user_rbac = request.user_rbac\n if user_rbac is not None:\n user = user_rbac.user\n if hasattr(user, 'userinfo'):\n return user.userinf...
<|body_start_0|> if hasattr(request, 'user_rbac'): if request.user_rbac is not None: return True return False <|end_body_0|> <|body_start_1|> if hasattr(request, 'user_rbac'): user_rbac = request.user_rbac if user_rbac is not None: ...
UserAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAPI: def is_login(request): """连接是否登录 :param request: :return:""" <|body_0|> def get_per_page(request): """获取用户设置的页信息 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if hasattr(request, 'user_rbac'): if reque...
stack_v2_sparse_classes_10k_train_005692
1,407
permissive
[ { "docstring": "连接是否登录 :param request: :return:", "name": "is_login", "signature": "def is_login(request)" }, { "docstring": "获取用户设置的页信息 :param request: :return:", "name": "get_per_page", "signature": "def get_per_page(request)" } ]
2
stack_v2_sparse_classes_30k_train_003876
Implement the Python class `UserAPI` described below. Class description: Implement the UserAPI class. Method signatures and docstrings: - def is_login(request): 连接是否登录 :param request: :return: - def get_per_page(request): 获取用户设置的页信息 :param request: :return:
Implement the Python class `UserAPI` described below. Class description: Implement the UserAPI class. Method signatures and docstrings: - def is_login(request): 连接是否登录 :param request: :return: - def get_per_page(request): 获取用户设置的页信息 :param request: :return: <|skeleton|> class UserAPI: def is_login(request): ...
8b97efdc9287645ea6b99dcf3a99fbe3f6ba6862
<|skeleton|> class UserAPI: def is_login(request): """连接是否登录 :param request: :return:""" <|body_0|> def get_per_page(request): """获取用户设置的页信息 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserAPI: def is_login(request): """连接是否登录 :param request: :return:""" if hasattr(request, 'user_rbac'): if request.user_rbac is not None: return True return False def get_per_page(request): """获取用户设置的页信息 :param request: :return:""" if ha...
the_stack_v2_python_sparse
natrix/common/user_api.py
creditease-natrix/natrix
train
4
fe61f19f2b83fd465fb0a05ffb77f3aeec435276
[ "dp = [float('inf')] * len(triangle[-1])\ndp[0] = triangle[0][0]\nfor i in range(1, len(triangle)):\n previous = [n for n in dp]\n for j in range(i + 1):\n if j == 0:\n dp[j] = previous[0] + triangle[i][j]\n elif j == i:\n dp[j] = previous[j - 1] + triangle[i][j]\n e...
<|body_start_0|> dp = [float('inf')] * len(triangle[-1]) dp[0] = triangle[0][0] for i in range(1, len(triangle)): previous = [n for n in dp] for j in range(i + 1): if j == 0: dp[j] = previous[0] + triangle[i][j] elif j =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotal_dp2(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> def minimumTotal_bottomup(self, triangle): ...
stack_v2_sparse_classes_10k_train_005693
2,435
no_license
[ { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle)" }, { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal_dp2", "signature": "def minimumTotal_dp2(self, triangle)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotal_dp2(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTot...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotal_dp2(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTot...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotal_dp2(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> def minimumTotal_bottomup(self, triangle): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" dp = [float('inf')] * len(triangle[-1]) dp[0] = triangle[0][0] for i in range(1, len(triangle)): previous = [n for n in dp] for j in range(i + 1): ...
the_stack_v2_python_sparse
src/lt_120.py
oxhead/CodingYourWay
train
0
fa76714830181e6c3b977d4e34b46f6101e5b10a
[ "self.start_all_services()\nclient = self.get_client('deproxy')\nclient.parsing = False\nfor length in range(1, 5):\n header = 'x' * length\n client.send_request(self.get_request + [(header, 'test')], '200')", "self.start_all_services()\nclient = self.get_client('deproxy')\nclient.parsing = False\nclient.se...
<|body_start_0|> self.start_all_services() client = self.get_client('deproxy') client.parsing = False for length in range(1, 5): header = 'x' * length client.send_request(self.get_request + [(header, 'test')], '200') <|end_body_0|> <|body_start_1|> self.s...
HeadersParsing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeadersParsing: def test_small_header_in_request(self): """Request with small header name length completes successfully.""" <|body_0|> def test_transfer_encoding_header_in_request(self): """The only exception to this is the TE header field, which MAY be present in an...
stack_v2_sparse_classes_10k_train_005694
49,368
no_license
[ { "docstring": "Request with small header name length completes successfully.", "name": "test_small_header_in_request", "signature": "def test_small_header_in_request(self)" }, { "docstring": "The only exception to this is the TE header field, which MAY be present in an HTTP/2 request; when it i...
4
null
Implement the Python class `HeadersParsing` described below. Class description: Implement the HeadersParsing class. Method signatures and docstrings: - def test_small_header_in_request(self): Request with small header name length completes successfully. - def test_transfer_encoding_header_in_request(self): The only e...
Implement the Python class `HeadersParsing` described below. Class description: Implement the HeadersParsing class. Method signatures and docstrings: - def test_small_header_in_request(self): Request with small header name length completes successfully. - def test_transfer_encoding_header_in_request(self): The only e...
d56358ea653dbb367624937197ce5e489abf0b00
<|skeleton|> class HeadersParsing: def test_small_header_in_request(self): """Request with small header name length completes successfully.""" <|body_0|> def test_transfer_encoding_header_in_request(self): """The only exception to this is the TE header field, which MAY be present in an...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HeadersParsing: def test_small_header_in_request(self): """Request with small header name length completes successfully.""" self.start_all_services() client = self.get_client('deproxy') client.parsing = False for length in range(1, 5): header = 'x' * length ...
the_stack_v2_python_sparse
http2_general/test_h2_headers.py
tempesta-tech/tempesta-test
train
13
d0c41771af1d9c24129c4fdc5f760ba36d813b45
[ "len_s = len(s)\nif len_s < 1:\n return ''\nstart, end = (0, 0)\nprint('str: ', s)\nfor i in range(len_s):\n print('len1:')\n len1 = self.expandAroundCenter(s, i, i)\n print('len2:')\n len2 = self.expandAroundCenter(s, i, i + 1)\n length = max(len1, len2)\n print(f'i: {i}, len1: {len1}, len2: {...
<|body_start_0|> len_s = len(s) if len_s < 1: return '' start, end = (0, 0) print('str: ', s) for i in range(len_s): print('len1:') len1 = self.expandAroundCenter(s, i, i) print('len2:') len2 = self.expandAroundCenter(s,...
Time complexity : O(n^2). Since expanding a palindrome around its center could take O(n) time, the overall complexity is O(n^2). Space complexity : O(1).
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Time complexity : O(n^2). Since expanding a palindrome around its center could take O(n) time, the overall complexity is O(n^2). Space complexity : O(1).""" def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def expandAroundCenter(self...
stack_v2_sparse_classes_10k_train_005695
4,079
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :type left: int :type right: int :rtype: int", "name": "expandAroundCenter", "signature": "def expandAroundCenter(self, s, left, right)" ...
2
stack_v2_sparse_classes_30k_train_000843
Implement the Python class `Solution` described below. Class description: Time complexity : O(n^2). Since expanding a palindrome around its center could take O(n) time, the overall complexity is O(n^2). Space complexity : O(1). Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: s...
Implement the Python class `Solution` described below. Class description: Time complexity : O(n^2). Since expanding a palindrome around its center could take O(n) time, the overall complexity is O(n^2). Space complexity : O(1). Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: s...
551cd3b4616c16a6562eb7c577ce671b419f0616
<|skeleton|> class Solution: """Time complexity : O(n^2). Since expanding a palindrome around its center could take O(n) time, the overall complexity is O(n^2). Space complexity : O(1).""" def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def expandAroundCenter(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Time complexity : O(n^2). Since expanding a palindrome around its center could take O(n) time, the overall complexity is O(n^2). Space complexity : O(1).""" def longestPalindrome(self, s): """:type s: str :rtype: str""" len_s = len(s) if len_s < 1: return ...
the_stack_v2_python_sparse
python/005_LongestPalindromicSubstring.py
lizzzcai/leetcode
train
1
7686d6bb42e57f535ab7deced8b2acaf32e1bd0d
[ "self.name = name\nself.charge = charge\nself.radius = radius\nself.resname = resname\nself.group = group", "try:\n item = getattr(self, name)\n return item\nexcept AttributeError:\n message = 'Unable to access object \"%s\" in class ForcefieldAtom' % name\n raise ValueError(message)", "txt = '%s:\\...
<|body_start_0|> self.name = name self.charge = charge self.radius = radius self.resname = resname self.group = group <|end_body_0|> <|body_start_1|> try: item = getattr(self, name) return item except AttributeError: message = ...
ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level
ForcefieldAtom
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForcefieldAtom: """ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level""" def __init__(self, name, charge, radius, resname, group=''): """Initialize the object Parameters name: The atom name (string) charge: The charge o...
stack_v2_sparse_classes_10k_train_005696
36,720
permissive
[ { "docstring": "Initialize the object Parameters name: The atom name (string) charge: The charge on the atom (float) radius: The radius of the atom (float) resname: The residue name (string) group: The group name (string)", "name": "__init__", "signature": "def __init__(self, name, charge, radius, resna...
3
stack_v2_sparse_classes_30k_train_003252
Implement the Python class `ForcefieldAtom` described below. Class description: ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level Method signatures and docstrings: - def __init__(self, name, charge, radius, resname, group=''): Initialize the object Par...
Implement the Python class `ForcefieldAtom` described below. Class description: ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level Method signatures and docstrings: - def __init__(self, name, charge, radius, resname, group=''): Initialize the object Par...
f4eaad40eebefafa25b3aa77493499deb1a72cc4
<|skeleton|> class ForcefieldAtom: """ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level""" def __init__(self, name, charge, radius, resname, group=''): """Initialize the object Parameters name: The atom name (string) charge: The charge o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ForcefieldAtom: """ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level""" def __init__(self, name, charge, radius, resname, group=''): """Initialize the object Parameters name: The atom name (string) charge: The charge on the atom (f...
the_stack_v2_python_sparse
bin/pdb2pqr-1.6/src/forcefield.py
MonZop/BioBlender21
train
0
d7eeb73e4b61324a3ce88c5b7c42284923b15b2d
[ "login_page.LoginPage(self.driver).login()\nsleep(3)\nlandlord_nav_page.LandlordNavPage(self.driver).Iamlandlord()\nsleep(3)\nlandlord_nav_page.LandlordNavPage(self.driver).close_weiChat()\nsleep(3)\nlandlord_nav_page.LandlordNavPage(self.driver).roommanager()\nsleep(3)\npo = landlord_read_page.LandlordReadPage(sel...
<|body_start_0|> login_page.LoginPage(self.driver).login() sleep(3) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(3) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(3) landlord_nav_page.LandlordNavPage(self.driver).roomman...
房源管理-房东必读
TestLandlordRead
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLandlordRead: """房源管理-房东必读""" def test_agreement(self): """服务协议""" <|body_0|> def test_landlord_read(self): """房东规则""" <|body_1|> def test_tenant_rule(self): """房客规则""" <|body_2|> def test_roomauditrule(self): """房间审核...
stack_v2_sparse_classes_10k_train_005697
4,003
permissive
[ { "docstring": "服务协议", "name": "test_agreement", "signature": "def test_agreement(self)" }, { "docstring": "房东规则", "name": "test_landlord_read", "signature": "def test_landlord_read(self)" }, { "docstring": "房客规则", "name": "test_tenant_rule", "signature": "def test_tenant...
6
stack_v2_sparse_classes_30k_train_001367
Implement the Python class `TestLandlordRead` described below. Class description: 房源管理-房东必读 Method signatures and docstrings: - def test_agreement(self): 服务协议 - def test_landlord_read(self): 房东规则 - def test_tenant_rule(self): 房客规则 - def test_roomauditrule(self): 房间审核规范 - def test_privacypolicy(self): 隐私条款 - def test_...
Implement the Python class `TestLandlordRead` described below. Class description: 房源管理-房东必读 Method signatures and docstrings: - def test_agreement(self): 服务协议 - def test_landlord_read(self): 房东规则 - def test_tenant_rule(self): 房客规则 - def test_roomauditrule(self): 房间审核规范 - def test_privacypolicy(self): 隐私条款 - def test_...
192c70c49a8e9e072b9d0d0136f02c653c589410
<|skeleton|> class TestLandlordRead: """房源管理-房东必读""" def test_agreement(self): """服务协议""" <|body_0|> def test_landlord_read(self): """房东规则""" <|body_1|> def test_tenant_rule(self): """房客规则""" <|body_2|> def test_roomauditrule(self): """房间审核...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestLandlordRead: """房源管理-房东必读""" def test_agreement(self): """服务协议""" login_page.LoginPage(self.driver).login() sleep(3) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(3) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() ...
the_stack_v2_python_sparse
mayi/test_case/test_landlord_read.py
18701016443/mayi
train
0
c6342a13335a05f97988c7653720eb0c3b5aedfb
[ "self.maxiter = maxiter\nself.ftol = ftol\nself.minimize = minimize\nself.prev_fvals = None\nself.iter = 0", "self.iter += 1\nif self.iter == self.maxiter:\n return True\nelif self.prev_fvals is not None:\n fmax = torch.stack([self.prev_fvals.abs(), fvals.abs(), torch.ones_like(fvals)], dim=0).max(dim=0)[0]...
<|body_start_0|> self.maxiter = maxiter self.ftol = ftol self.minimize = minimize self.prev_fvals = None self.iter = 0 <|end_body_0|> <|body_start_1|> self.iter += 1 if self.iter == self.maxiter: return True elif self.prev_fvals is not None: ...
Basic class for evaluating optimization convergence.
ConvergenceCriterion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvergenceCriterion: """Basic class for evaluating optimization convergence.""" def __init__(self, maxiter: int=15000, ftol: float=2.220446049250313e-09, minimize: bool=True) -> None: """Constructor for ConvergenceCriterion. Args: maxiter: maximum number of iterations. ftol: Functio...
stack_v2_sparse_classes_10k_train_005698
10,267
permissive
[ { "docstring": "Constructor for ConvergenceCriterion. Args: maxiter: maximum number of iterations. ftol: Function value relative tolerance for termination. minimize: boolean indicating the optimization direction.", "name": "__init__", "signature": "def __init__(self, maxiter: int=15000, ftol: float=2.22...
2
stack_v2_sparse_classes_30k_train_001725
Implement the Python class `ConvergenceCriterion` described below. Class description: Basic class for evaluating optimization convergence. Method signatures and docstrings: - def __init__(self, maxiter: int=15000, ftol: float=2.220446049250313e-09, minimize: bool=True) -> None: Constructor for ConvergenceCriterion. A...
Implement the Python class `ConvergenceCriterion` described below. Class description: Basic class for evaluating optimization convergence. Method signatures and docstrings: - def __init__(self, maxiter: int=15000, ftol: float=2.220446049250313e-09, minimize: bool=True) -> None: Constructor for ConvergenceCriterion. A...
af13f0a38b579ab504f49a01f1ced13532a3ad49
<|skeleton|> class ConvergenceCriterion: """Basic class for evaluating optimization convergence.""" def __init__(self, maxiter: int=15000, ftol: float=2.220446049250313e-09, minimize: bool=True) -> None: """Constructor for ConvergenceCriterion. Args: maxiter: maximum number of iterations. ftol: Functio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConvergenceCriterion: """Basic class for evaluating optimization convergence.""" def __init__(self, maxiter: int=15000, ftol: float=2.220446049250313e-09, minimize: bool=True) -> None: """Constructor for ConvergenceCriterion. Args: maxiter: maximum number of iterations. ftol: Function value relat...
the_stack_v2_python_sparse
botorch/optim/utils.py
shalijiang/bo
train
1
3b1eb63c7c5b22c4c784c696ff03a3b0f8430efc
[ "number = ''.join((c for c in number if c.isnumeric()))\nif len(number) == number_length:\n return number\nreturn None", "number = number.replace(' ', '')\nresult = re.match('^[0-9]+$', number)\nif not result:\n return True\nreturn False", "ni_nuber = re.match('^\\\\s*[a-zA-Z]{2}(?:\\\\s*\\\\d\\\\s*){6}[a...
<|body_start_0|> number = ''.join((c for c in number if c.isnumeric())) if len(number) == number_length: return number return None <|end_body_0|> <|body_start_1|> number = number.replace(' ', '') result = re.match('^[0-9]+$', number) if not result: ...
NumberLengthValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumberLengthValidator: def normalise_number(number, number_length): """Return a normalised NHS number if valid, or None if not,""" <|body_0|> def number_only(number): """Return a normalised NHS number if valid, or None if not,""" <|body_1|> def ni_number...
stack_v2_sparse_classes_10k_train_005699
1,349
permissive
[ { "docstring": "Return a normalised NHS number if valid, or None if not,", "name": "normalise_number", "signature": "def normalise_number(number, number_length)" }, { "docstring": "Return a normalised NHS number if valid, or None if not,", "name": "number_only", "signature": "def number_...
3
stack_v2_sparse_classes_30k_train_006307
Implement the Python class `NumberLengthValidator` described below. Class description: Implement the NumberLengthValidator class. Method signatures and docstrings: - def normalise_number(number, number_length): Return a normalised NHS number if valid, or None if not, - def number_only(number): Return a normalised NHS...
Implement the Python class `NumberLengthValidator` described below. Class description: Implement the NumberLengthValidator class. Method signatures and docstrings: - def normalise_number(number, number_length): Return a normalised NHS number if valid, or None if not, - def number_only(number): Return a normalised NHS...
ad049db27650e850742a3bd466f96d36a3420589
<|skeleton|> class NumberLengthValidator: def normalise_number(number, number_length): """Return a normalised NHS number if valid, or None if not,""" <|body_0|> def number_only(number): """Return a normalised NHS number if valid, or None if not,""" <|body_1|> def ni_number...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumberLengthValidator: def normalise_number(number, number_length): """Return a normalised NHS number if valid, or None if not,""" number = ''.join((c for c in number if c.isnumeric())) if len(number) == number_length: return number return None def number_only(...
the_stack_v2_python_sparse
ndopapp/main/ndop_validator.py
uk-gov-mirror/nhsconnect.ndop-nojs
train
0