blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
bc0faf3d68d2fbcb70948a28e9775500e22cb58b
[ "super(AddPrepositions, self).__init__(scenario, args)\nif self.language is None:\n raise LoadingException('Language must be defined!')", "match = re.match('^(?:n|adj):(.+)[+]', tnode.formeme)\nif not match:\n return None\nreturn match.group(1).split('_')", "tchildren = tnode.get_children(preceding_only=T...
<|body_start_0|> super(AddPrepositions, self).__init__(scenario, args) if self.language is None: raise LoadingException('Language must be defined!') <|end_body_0|> <|body_start_1|> match = re.match('^(?:n|adj):(.+)[+]', tnode.formeme) if not match: return None ...
Add prepositional a-nodes according to formemes. Arguments: language: the language of the target tree selector: the selector of the target tree
AddPrepositions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddPrepositions: """Add prepositional a-nodes according to formemes. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenario, args): """Constructor, just checking the argument values""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_026100
1,962
permissive
[ { "docstring": "Constructor, just checking the argument values", "name": "__init__", "signature": "def __init__(self, scenario, args)" }, { "docstring": "Find prepositional nodes to be created.", "name": "get_aux_forms", "signature": "def get_aux_forms(self, tnode)" }, { "docstri...
4
null
Implement the Python class `AddPrepositions` described below. Class description: Add prepositional a-nodes according to formemes. Arguments: language: the language of the target tree selector: the selector of the target tree Method signatures and docstrings: - def __init__(self, scenario, args): Constructor, just che...
Implement the Python class `AddPrepositions` described below. Class description: Add prepositional a-nodes according to formemes. Arguments: language: the language of the target tree selector: the selector of the target tree Method signatures and docstrings: - def __init__(self, scenario, args): Constructor, just che...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class AddPrepositions: """Add prepositional a-nodes according to formemes. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenario, args): """Constructor, just checking the argument values""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddPrepositions: """Add prepositional a-nodes according to formemes. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenario, args): """Constructor, just checking the argument values""" super(AddPrepositions, self).__in...
the_stack_v2_python_sparse
alex/components/nlg/tectotpl/block/t2a/cs/addprepositions.py
oplatek/alex
train
0
eb665d6473397346e5ff452ad47375f12e54c900
[ "if numRows < 2 or not s or numRows >= len(s):\n return s\nlth = len(s)\nwidth = -(-lth / numRows) * (numRows - 1)\nheight = numRows\nrecord = [[''] * width for _ in range(height)]\ndown = True\ni, j = (0, 0)\nfor c in s:\n record[i][j] = c\n if down and i == height - 1:\n down = False\n elif not...
<|body_start_0|> if numRows < 2 or not s or numRows >= len(s): return s lth = len(s) width = -(-lth / numRows) * (numRows - 1) height = numRows record = [[''] * width for _ in range(height)] down = True i, j = (0, 0) for c in s: rec...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convert_1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_0|> def convert_2(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if numRows < 2 or...
stack_v2_sparse_classes_36k_train_026101
1,985
no_license
[ { "docstring": ":type s: str :type numRows: int :rtype: str", "name": "convert_1", "signature": "def convert_1(self, s, numRows)" }, { "docstring": ":type s: str :type numRows: int :rtype: str", "name": "convert_2", "signature": "def convert_2(self, s, numRows)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert_1(self, s, numRows): :type s: str :type numRows: int :rtype: str - def convert_2(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 convert_1(self, s, numRows): :type s: str :type numRows: int :rtype: str - def convert_2(self, s, numRows): :type s: str :type numRows: int :rtype: str <|skeleton|> class So...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def convert_1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_0|> def convert_2(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def convert_1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" if numRows < 2 or not s or numRows >= len(s): return s lth = len(s) width = -(-lth / numRows) * (numRows - 1) height = numRows record = [[''] * width for _ i...
the_stack_v2_python_sparse
medium/arrayandstring/test_6_ZigZag_Conversion.py
wuxu1019/leetcode_sophia
train
1
3d52ad8fde6c4856c597c9cf9b40301c74a7f5af
[ "super().__init__(coordinator, device_info, room_name, shade.id)\nself._shade_name = shade_name\nself._shade = shade", "device_info = {'identifiers': {(DOMAIN, self._shade.id)}, 'name': self._shade_name, 'suggested_area': self._room_name, 'manufacturer': MANUFACTURER, 'model': self._shade.raw_data[ATTR_TYPE], 'vi...
<|body_start_0|> super().__init__(coordinator, device_info, room_name, shade.id) self._shade_name = shade_name self._shade = shade <|end_body_0|> <|body_start_1|> device_info = {'identifiers': {(DOMAIN, self._shade.id)}, 'name': self._shade_name, 'suggested_area': self._room_name, 'manu...
Base class for hunter douglas shade entities.
ShadeEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShadeEntity: """Base class for hunter douglas shade entities.""" def __init__(self, coordinator, device_info, room_name, shade, shade_name): """Initialize the shade.""" <|body_0|> def device_info(self): """Return the device_info of the device.""" <|body_1...
stack_v2_sparse_classes_36k_train_026102
2,930
permissive
[ { "docstring": "Initialize the shade.", "name": "__init__", "signature": "def __init__(self, coordinator, device_info, room_name, shade, shade_name)" }, { "docstring": "Return the device_info of the device.", "name": "device_info", "signature": "def device_info(self)" } ]
2
null
Implement the Python class `ShadeEntity` described below. Class description: Base class for hunter douglas shade entities. Method signatures and docstrings: - def __init__(self, coordinator, device_info, room_name, shade, shade_name): Initialize the shade. - def device_info(self): Return the device_info of the device...
Implement the Python class `ShadeEntity` described below. Class description: Base class for hunter douglas shade entities. Method signatures and docstrings: - def __init__(self, coordinator, device_info, room_name, shade, shade_name): Initialize the shade. - def device_info(self): Return the device_info of the device...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ShadeEntity: """Base class for hunter douglas shade entities.""" def __init__(self, coordinator, device_info, room_name, shade, shade_name): """Initialize the shade.""" <|body_0|> def device_info(self): """Return the device_info of the device.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShadeEntity: """Base class for hunter douglas shade entities.""" def __init__(self, coordinator, device_info, room_name, shade, shade_name): """Initialize the shade.""" super().__init__(coordinator, device_info, room_name, shade.id) self._shade_name = shade_name self._shad...
the_stack_v2_python_sparse
homeassistant/components/hunterdouglas_powerview/entity.py
BenWoodford/home-assistant
train
11
2b1f50089e57aa15008055ed5be78d6de98c8f2d
[ "used_ids = model_admin.model.objects.values_list(field.attname, flat=True).distinct()\nqs = field.related_model.objects.filter(pk__in=used_ids)\nchoice_ids = field.related_model.objects.get_queryset_ancestors(qs, include_self=True).values_list('id', flat=True).distinct()\nordering = self.field_admin_ordering(field...
<|body_start_0|> used_ids = model_admin.model.objects.values_list(field.attname, flat=True).distinct() qs = field.related_model.objects.filter(pk__in=used_ids) choice_ids = field.related_model.objects.get_queryset_ancestors(qs, include_self=True).values_list('id', flat=True).distinct() o...
TreeModelFieldListFilter
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeModelFieldListFilter: def field_choices(self, field, request, model_admin): """Return only choices, which are actually used. Include children of selected object in the results""" <|body_0|> def queryset(self, request, queryset): """Remove old filter and replace i...
stack_v2_sparse_classes_36k_train_026103
14,210
permissive
[ { "docstring": "Return only choices, which are actually used. Include children of selected object in the results", "name": "field_choices", "signature": "def field_choices(self, field, request, model_admin)" }, { "docstring": "Remove old filter and replace it with a filter that includes children...
2
stack_v2_sparse_classes_30k_train_017041
Implement the Python class `TreeModelFieldListFilter` described below. Class description: Implement the TreeModelFieldListFilter class. Method signatures and docstrings: - def field_choices(self, field, request, model_admin): Return only choices, which are actually used. Include children of selected object in the res...
Implement the Python class `TreeModelFieldListFilter` described below. Class description: Implement the TreeModelFieldListFilter class. Method signatures and docstrings: - def field_choices(self, field, request, model_admin): Return only choices, which are actually used. Include children of selected object in the res...
aef660099fa251b66c5a8c56214a09e9b52bcc57
<|skeleton|> class TreeModelFieldListFilter: def field_choices(self, field, request, model_admin): """Return only choices, which are actually used. Include children of selected object in the results""" <|body_0|> def queryset(self, request, queryset): """Remove old filter and replace i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeModelFieldListFilter: def field_choices(self, field, request, model_admin): """Return only choices, which are actually used. Include children of selected object in the results""" used_ids = model_admin.model.objects.values_list(field.attname, flat=True).distinct() qs = field.relate...
the_stack_v2_python_sparse
traffic_control/admin/utils.py
City-of-Helsinki/city-infrastructure-platform
train
5
51cee148528959e58f43a270a584048594784560
[ "super().__init__()\nself.fwd = decomposition_resolver.make(query=decomposition, pos_kwargs=decomposition_kwargs, input_dim=input_dim, output_dim=output_dim, num_relations=num_relations)\nself.bwd = decomposition_resolver.make(query=decomposition, pos_kwargs=decomposition_kwargs, input_dim=input_dim, output_dim=out...
<|body_start_0|> super().__init__() self.fwd = decomposition_resolver.make(query=decomposition, pos_kwargs=decomposition_kwargs, input_dim=input_dim, output_dim=output_dim, num_relations=num_relations) self.bwd = decomposition_resolver.make(query=decomposition, pos_kwargs=decomposition_kwargs, i...
An RGCN layer from [schlichtkrull2018]_ updated to match the official implementation. This layer uses separate decompositions for forward and backward edges (i.e., "normal" and implicitly created inverse relations), as well as a separate transformation for self-loops. Ignoring dropouts, decomposition and normalization,...
RGCNLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RGCNLayer: """An RGCN layer from [schlichtkrull2018]_ updated to match the official implementation. This layer uses separate decompositions for forward and backward edges (i.e., "normal" and implicitly created inverse relations), as well as a separate transformation for self-loops. Ignoring dropo...
stack_v2_sparse_classes_36k_train_026104
29,396
permissive
[ { "docstring": "Initialize the layer. :param input_dim: >0 the input dimension :param num_relations: the number of relations :param output_dim: >0 the output dimension. If none is given, use the input dimension. :param use_bias: whether to use a trainable bias :param activation: the activation function to use. ...
2
null
Implement the Python class `RGCNLayer` described below. Class description: An RGCN layer from [schlichtkrull2018]_ updated to match the official implementation. This layer uses separate decompositions for forward and backward edges (i.e., "normal" and implicitly created inverse relations), as well as a separate transf...
Implement the Python class `RGCNLayer` described below. Class description: An RGCN layer from [schlichtkrull2018]_ updated to match the official implementation. This layer uses separate decompositions for forward and backward edges (i.e., "normal" and implicitly created inverse relations), as well as a separate transf...
5ff3597b18ab9a220e34361d3c3f262060811df1
<|skeleton|> class RGCNLayer: """An RGCN layer from [schlichtkrull2018]_ updated to match the official implementation. This layer uses separate decompositions for forward and backward edges (i.e., "normal" and implicitly created inverse relations), as well as a separate transformation for self-loops. Ignoring dropo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RGCNLayer: """An RGCN layer from [schlichtkrull2018]_ updated to match the official implementation. This layer uses separate decompositions for forward and backward edges (i.e., "normal" and implicitly created inverse relations), as well as a separate transformation for self-loops. Ignoring dropouts, decompos...
the_stack_v2_python_sparse
src/pykeen/nn/message_passing.py
pykeen/pykeen
train
1,308
9640f1f4dfa642d258e2ac2bb13f40e38cbf99d7
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. A single trace may contain span(s) from multiple ...
TraceServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TraceServiceServicer: """This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. A...
stack_v2_sparse_classes_36k_train_026105
3,567
permissive
[ { "docstring": "Sends new spans to new or existing traces. You cannot update existing spans.", "name": "BatchWriteSpans", "signature": "def BatchWriteSpans(self, request, context)" }, { "docstring": "Creates a new span.", "name": "CreateSpan", "signature": "def CreateSpan(self, request, ...
2
stack_v2_sparse_classes_30k_train_012309
Implement the Python class `TraceServiceServicer` described below. Class description: This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event ...
Implement the Python class `TraceServiceServicer` described below. Class description: This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event ...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class TraceServiceServicer: """This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TraceServiceServicer: """This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. A single trace...
the_stack_v2_python_sparse
trace/google/cloud/trace_v2/proto/tracing_pb2_grpc.py
tswast/google-cloud-python
train
1
446673c23c6df008d27813a75a718b499c6e50b5
[ "m = 100\nctx.save_for_backward(k)\nk = k.double()\nanswer = (m / 2 - 1) * torch.log(k) - torch.log(scipy.special.ive(m / 2 - 1, k.cpu())) - k - m / 2 * np.log(2 * np.pi)\nanswer = answer.float()\nreturn answer", "k, = ctx.saved_tensors\nm = 100\nk = k.double()\nx = -(scipy.special.ive(m / 2, k.cpu()) / scipy.spe...
<|body_start_0|> m = 100 ctx.save_for_backward(k) k = k.double() answer = (m / 2 - 1) * torch.log(k) - torch.log(scipy.special.ive(m / 2 - 1, k.cpu())) - k - m / 2 * np.log(2 * np.pi) answer = answer.float() return answer <|end_body_0|> <|body_start_1|> k, = ctx....
The exponentially scaled modified Bessel function of the first kind
Logcmk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logcmk: """The exponentially scaled modified Bessel function of the first kind""" def forward(ctx, k): """In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward...
stack_v2_sparse_classes_36k_train_026106
11,289
no_license
[ { "docstring": "In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using the ctx.save_for_backward method.", ...
2
stack_v2_sparse_classes_30k_train_000237
Implement the Python class `Logcmk` described below. Class description: The exponentially scaled modified Bessel function of the first kind Method signatures and docstrings: - def forward(ctx, k): In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context ...
Implement the Python class `Logcmk` described below. Class description: The exponentially scaled modified Bessel function of the first kind Method signatures and docstrings: - def forward(ctx, k): In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context ...
251142b2e704e595e664031f5a469ebad6de8333
<|skeleton|> class Logcmk: """The exponentially scaled modified Bessel function of the first kind""" def forward(ctx, k): """In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logcmk: """The exponentially scaled modified Bessel function of the first kind""" def forward(ctx, k): """In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation....
the_stack_v2_python_sparse
contrastive_vmf.py
dheeraj7596/Coarse2Fine
train
1
b41ec46cf9c2113467c51e9c4fb656d9a9f1a320
[ "data = parsers.parse_key(file_key='icrf2_non_vcs').as_dict()\ndata.update(parsers.parse_key(file_key='icrf2_vcs_only').as_dict())\nreturn data", "source_info = self.data[source]\nvector = Direction(ra=source_info['ra'], dec=source_info['dec'], time=self.time)\nreturn np.squeeze(vector)" ]
<|body_start_0|> data = parsers.parse_key(file_key='icrf2_non_vcs').as_dict() data.update(parsers.parse_key(file_key='icrf2_vcs_only').as_dict()) return data <|end_body_0|> <|body_start_1|> source_info = self.data[source] vector = Direction(ra=source_info['ra'], dec=source_info[...
A class to provide information from radio sources defined in ICRF2
Icrf2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Icrf2: """A class to provide information from radio sources defined in ICRF2""" def _read_data(self): """Read data needed by this Celestial Reference Frame for calculating positions of sources Returns: Dict: Dictionary containing data about each source defined in this reference frame...
stack_v2_sparse_classes_36k_train_026107
1,419
permissive
[ { "docstring": "Read data needed by this Celestial Reference Frame for calculating positions of sources Returns: Dict: Dictionary containing data about each source defined in this reference frame.", "name": "_read_data", "signature": "def _read_data(self)" }, { "docstring": "Calculate position f...
2
null
Implement the Python class `Icrf2` described below. Class description: A class to provide information from radio sources defined in ICRF2 Method signatures and docstrings: - def _read_data(self): Read data needed by this Celestial Reference Frame for calculating positions of sources Returns: Dict: Dictionary containi...
Implement the Python class `Icrf2` described below. Class description: A class to provide information from radio sources defined in ICRF2 Method signatures and docstrings: - def _read_data(self): Read data needed by this Celestial Reference Frame for calculating positions of sources Returns: Dict: Dictionary containi...
0c8c5c68adca08f97e22cab1bce10e382a7fbf77
<|skeleton|> class Icrf2: """A class to provide information from radio sources defined in ICRF2""" def _read_data(self): """Read data needed by this Celestial Reference Frame for calculating positions of sources Returns: Dict: Dictionary containing data about each source defined in this reference frame...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Icrf2: """A class to provide information from radio sources defined in ICRF2""" def _read_data(self): """Read data needed by this Celestial Reference Frame for calculating positions of sources Returns: Dict: Dictionary containing data about each source defined in this reference frame.""" ...
the_stack_v2_python_sparse
where/apriori/crf/icrf2.py
kartverket/where
train
21
e563081bd06de46d07aa505d6e7670695d9dda24
[ "self.res = 0\nself.dfs(root)\nreturn self.res", "if not root:\n return 0\nleft = self.dfs(root.left)\nright = self.dfs(root.right)\nif root.left and root.left.val == root.val:\n left += 1\nelse:\n left = 0\nif root.right and root.right.val == root.val:\n right += 1\nelse:\n right = 0\nself.res = m...
<|body_start_0|> self.res = 0 self.dfs(root) return self.res <|end_body_0|> <|body_start_1|> if not root: return 0 left = self.dfs(root.left) right = self.dfs(root.right) if root.left and root.left.val == root.val: left += 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestUnivaluePath(self, root): """Args: root: TreeNode Return: int""" <|body_0|> def dfs(self, root): """Args: root: TreeNode Return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res = 0 self.dfs(root) ret...
stack_v2_sparse_classes_36k_train_026108
1,692
no_license
[ { "docstring": "Args: root: TreeNode Return: int", "name": "longestUnivaluePath", "signature": "def longestUnivaluePath(self, root)" }, { "docstring": "Args: root: TreeNode Return: int", "name": "dfs", "signature": "def dfs(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_017115
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestUnivaluePath(self, root): Args: root: TreeNode Return: int - def dfs(self, root): Args: root: TreeNode Return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestUnivaluePath(self, root): Args: root: TreeNode Return: int - def dfs(self, root): Args: root: TreeNode Return: int <|skeleton|> class Solution: def longestUnival...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def longestUnivaluePath(self, root): """Args: root: TreeNode Return: int""" <|body_0|> def dfs(self, root): """Args: root: TreeNode Return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestUnivaluePath(self, root): """Args: root: TreeNode Return: int""" self.res = 0 self.dfs(root) return self.res def dfs(self, root): """Args: root: TreeNode Return: int""" if not root: return 0 left = self.dfs(root.left...
the_stack_v2_python_sparse
code/687. 最长同值路径.py
AiZhanghan/Leetcode
train
0
13b59db3f2968efaadf006a57e566787a23a11d2
[ "site = get_current_site()\nnew_node = cms_models.TreeNode(site=site)\nif self.parent:\n return self.parent.node.add_child(instance=new_node)\nreturn cms_models.TreeNode.add_root(instance=new_node)", "super()._after_postgeneration(instance, create, results=results)\ninstance.rescan_placeholders()\nif results.g...
<|body_start_0|> site = get_current_site() new_node = cms_models.TreeNode(site=site) if self.parent: return self.parent.node.add_child(instance=new_node) return cms_models.TreeNode.add_root(instance=new_node) <|end_body_0|> <|body_start_1|> super()._after_postgenerat...
Create random CMS pages.
PageFactory
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageFactory: """Create random CMS pages.""" def node(self): """Create a node for the page (under its parent if applicable).""" <|body_0|> def _after_postgeneration(cls, instance, create, results=None): """This hook method is called last when generating an instanc...
stack_v2_sparse_classes_36k_train_026109
11,346
permissive
[ { "docstring": "Create a node for the page (under its parent if applicable).", "name": "node", "signature": "def node(self)" }, { "docstring": "This hook method is called last when generating an instance from a factory. The super method saves the instance one last time after all the \"post_gener...
3
null
Implement the Python class `PageFactory` described below. Class description: Create random CMS pages. Method signatures and docstrings: - def node(self): Create a node for the page (under its parent if applicable). - def _after_postgeneration(cls, instance, create, results=None): This hook method is called last when ...
Implement the Python class `PageFactory` described below. Class description: Create random CMS pages. Method signatures and docstrings: - def node(self): Create a node for the page (under its parent if applicable). - def _after_postgeneration(cls, instance, create, results=None): This hook method is called last when ...
f2d46fc46b271eb3b4d565039a29c15ba15f027c
<|skeleton|> class PageFactory: """Create random CMS pages.""" def node(self): """Create a node for the page (under its parent if applicable).""" <|body_0|> def _after_postgeneration(cls, instance, create, results=None): """This hook method is called last when generating an instanc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PageFactory: """Create random CMS pages.""" def node(self): """Create a node for the page (under its parent if applicable).""" site = get_current_site() new_node = cms_models.TreeNode(site=site) if self.parent: return self.parent.node.add_child(instance=new_nod...
the_stack_v2_python_sparse
src/richie/apps/core/factories.py
openfun/richie
train
238
d336959fdd9497f2acabeef683885824f8ce7414
[ "if x < 0:\n return False\nreturn self.reverse(x) == x", "if x == 0:\n return 0\nsign = 1 if x > 0 else -1\nx = x * sign\nrev = 0\nwhile x != 0:\n x, rev = (x // 10, rev * 10 + x % 10)\nrev = rev * sign\nreturn rev" ]
<|body_start_0|> if x < 0: return False return self.reverse(x) == x <|end_body_0|> <|body_start_1|> if x == 0: return 0 sign = 1 if x > 0 else -1 x = x * sign rev = 0 while x != 0: x, rev = (x // 10, rev * 10 + x % 10) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def reverse(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False return self.reverse(x) == x ...
stack_v2_sparse_classes_36k_train_026110
1,138
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_003173
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def reverse(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def reverse(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def isPalindrome(self, x): """:ty...
4af44f7364c6fb4d95309056f7a7853de779b3bb
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def reverse(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False return self.reverse(x) == x def reverse(self, x): """:type x: int :rtype: int""" if x == 0: return 0 sign = 1 if x > 0 else -1 x = x ...
the_stack_v2_python_sparse
codes_python/0009_Palindrome_Number.py
mondler/leetcode
train
0
327d3a88a0f4e25c719c7b1b1113866183ccf6f4
[ "if not cls.data[symbol].truncate(after=Clock.curr_time).tail(1).empty:\n return cls.data[symbol].truncate(after=Clock.curr_time).tail(1)\nelse:\n return pd.DataFrame()", "if not cls.data[symbol].truncate(after=Clock.curr_time).tail(lookback).empty:\n return cls.data[symbol].truncate(after=Clock.curr_tim...
<|body_start_0|> if not cls.data[symbol].truncate(after=Clock.curr_time).tail(1).empty: return cls.data[symbol].truncate(after=Clock.curr_time).tail(1) else: return pd.DataFrame() <|end_body_0|> <|body_start_1|> if not cls.data[symbol].truncate(after=Clock.curr_time).tai...
Data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Data: def current(cls, symbol: str, end: str, timeframe: str='1Min'): """Get the current barset at end date :param symbols: asset to look up :param end: end date ("current" date) :param timeframe: One of minute, 1Min, 5Min, 15Min, day or 1D. minute is an alias of 1Min. Similarly, day is ...
stack_v2_sparse_classes_36k_train_026111
7,137
no_license
[ { "docstring": "Get the current barset at end date :param symbols: asset to look up :param end: end date (\"current\" date) :param timeframe: One of minute, 1Min, 5Min, 15Min, day or 1D. minute is an alias of 1Min. Similarly, day is of 1D. :return: pd.Series of length 1", "name": "current", "signature":...
2
stack_v2_sparse_classes_30k_train_001371
Implement the Python class `Data` described below. Class description: Implement the Data class. Method signatures and docstrings: - def current(cls, symbol: str, end: str, timeframe: str='1Min'): Get the current barset at end date :param symbols: asset to look up :param end: end date ("current" date) :param timeframe...
Implement the Python class `Data` described below. Class description: Implement the Data class. Method signatures and docstrings: - def current(cls, symbol: str, end: str, timeframe: str='1Min'): Get the current barset at end date :param symbols: asset to look up :param end: end date ("current" date) :param timeframe...
07af1702057ca1e2c8dcca1ad29fcb78d9d72bc1
<|skeleton|> class Data: def current(cls, symbol: str, end: str, timeframe: str='1Min'): """Get the current barset at end date :param symbols: asset to look up :param end: end date ("current" date) :param timeframe: One of minute, 1Min, 5Min, 15Min, day or 1D. minute is an alias of 1Min. Similarly, day is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Data: def current(cls, symbol: str, end: str, timeframe: str='1Min'): """Get the current barset at end date :param symbols: asset to look up :param end: end date ("current" date) :param timeframe: One of minute, 1Min, 5Min, 15Min, day or 1D. minute is an alias of 1Min. Similarly, day is of 1D. :return...
the_stack_v2_python_sparse
venv/Lib/Backtest/run.py
peiranhu1997/stock-trade
train
0
795153bb130e4176e5034a201746d31595325472
[ "if dut_node['type'] == NodeType.DUT:\n adj_mac0, adj_mac1 = L3fwdTest.get_adj_mac(nodes_info, dut_node, dut_if1, dut_if2)\n list_cores = [int(item) for item in lcores_list.split(',')]\n nb_cores = int(nb_cores)\n index = 0\n port_config = ''\n for port in range(0, 2):\n for queue in range(...
<|body_start_0|> if dut_node['type'] == NodeType.DUT: adj_mac0, adj_mac1 = L3fwdTest.get_adj_mac(nodes_info, dut_node, dut_if1, dut_if2) list_cores = [int(item) for item in lcores_list.split(',')] nb_cores = int(nb_cores) index = 0 port_config = '' ...
Test the DPDK l3fwd performance.
L3fwdTest
[ "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class L3fwdTest: """Test the DPDK l3fwd performance.""" def start_the_l3fwd_test(nodes_info, dut_node, dut_if1, dut_if2, nb_cores, lcores_list, queue_nums, jumbo_frames): """Execute the l3fwd on the dut_node. :param nodes_info: All the nodes info in the topology file. :param dut_node: Will...
stack_v2_sparse_classes_36k_train_026112
5,529
permissive
[ { "docstring": "Execute the l3fwd on the dut_node. :param nodes_info: All the nodes info in the topology file. :param dut_node: Will execute the l3fwd on this node :param dut_if1: The test link interface 1. :param dut_if2: The test link interface 2. :param nb_cores: The cores number for the forwarding :param lc...
3
null
Implement the Python class `L3fwdTest` described below. Class description: Test the DPDK l3fwd performance. Method signatures and docstrings: - def start_the_l3fwd_test(nodes_info, dut_node, dut_if1, dut_if2, nb_cores, lcores_list, queue_nums, jumbo_frames): Execute the l3fwd on the dut_node. :param nodes_info: All t...
Implement the Python class `L3fwdTest` described below. Class description: Test the DPDK l3fwd performance. Method signatures and docstrings: - def start_the_l3fwd_test(nodes_info, dut_node, dut_if1, dut_if2, nb_cores, lcores_list, queue_nums, jumbo_frames): Execute the l3fwd on the dut_node. :param nodes_info: All t...
3151c98618c78e3782e48bbe4d9c8f906c126f69
<|skeleton|> class L3fwdTest: """Test the DPDK l3fwd performance.""" def start_the_l3fwd_test(nodes_info, dut_node, dut_if1, dut_if2, nb_cores, lcores_list, queue_nums, jumbo_frames): """Execute the l3fwd on the dut_node. :param nodes_info: All the nodes info in the topology file. :param dut_node: Will...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class L3fwdTest: """Test the DPDK l3fwd performance.""" def start_the_l3fwd_test(nodes_info, dut_node, dut_if1, dut_if2, nb_cores, lcores_list, queue_nums, jumbo_frames): """Execute the l3fwd on the dut_node. :param nodes_info: All the nodes info in the topology file. :param dut_node: Will execute the ...
the_stack_v2_python_sparse
resources/libraries/python/DPDK/L3fwdTest.py
preym17/csit
train
0
f4c83df86710cab187ff272df237ae5067e5e0d7
[ "values = board_config_string.split(delimiter)\ncount = len(values)\nif not values[0]:\n raise ValueError('board_config_string')\nself.name = values[0]\ntry:\n self.difficulty = Difficulty[values[1]]\nexcept:\n self.difficulty = Difficulty.default\ntry:\n self.attribute = CharacterAttribute[values[2]]\n...
<|body_start_0|> values = board_config_string.split(delimiter) count = len(values) if not values[0]: raise ValueError('board_config_string') self.name = values[0] try: self.difficulty = Difficulty[values[1]] except: self.difficulty = Di...
Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default difficulty for this board. attribute (script...
BoardConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoardConfig: """Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default diffi...
stack_v2_sparse_classes_36k_train_026113
2,453
permissive
[ { "docstring": "Initialises the BoardConfig instance. Args: board_config_string (str): The board configuration string. This is a packed string containing up to four options, delimited by `delimiter`. E.G.:: 'board_name|difficulty|attribute|user' If the user field is not specified, then it defaults to `all_cards...
2
stack_v2_sparse_classes_30k_train_019085
Implement the Python class `BoardConfig` described below. Class description: Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (sc...
Implement the Python class `BoardConfig` described below. Class description: Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (sc...
0d0cf71814e98954850891fa0887bdcffcf7147d
<|skeleton|> class BoardConfig: """Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default diffi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoardConfig: """Board configuration details, parsed from the command line arguments. Attributes: name (str): the board name. all_cards (bool): If True, all cards should be used; otherwise only cards assigned to the current user should be used. difficulty (scriptabit.Difficulty): the default difficulty for thi...
the_stack_v2_python_sparse
scriptabit/plugins/trello/board_config.py
DC23/scriptabit
train
10
7c9075be0612ac805de36f0c5bef5cb542047334
[ "self.trie = Trie()\nfor w, wo in enumerate(words):\n wo += '#'\n for i in range(len(wo)):\n cur = self.trie\n cur[WEIGHT] = w\n for j in range(i, 2 * len(wo) - 1):\n cur = cur[wo[j % len(wo)]]\n cur[WEIGHT] = w", "cur = self.trie\nfor le in suffix + '#' + prefix:\...
<|body_start_0|> self.trie = Trie() for w, wo in enumerate(words): wo += '#' for i in range(len(wo)): cur = self.trie cur[WEIGHT] = w for j in range(i, 2 * len(wo) - 1): cur = cur[wo[j % len(wo)]] ...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.trie = Trie() for w, wo in en...
stack_v2_sparse_classes_36k_train_026114
962
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
stack_v2_sparse_classes_30k_val_000112
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
20623defecf65cbc35b194d8b60d8b211816ee4f
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordFilter: def __init__(self, words): """:type words: List[str]""" self.trie = Trie() for w, wo in enumerate(words): wo += '#' for i in range(len(wo)): cur = self.trie cur[WEIGHT] = w for j in range(i, 2 * len(wo)...
the_stack_v2_python_sparse
in_Python_v2/0745 Prefix and Suffix Search.py
YangLiyli131/Leetcode2020
train
0
4d37508937b388abae7d546805e83ec0a8352902
[ "def construct(r, lt, rt):\n if r is None:\n return r\n root = TreeNode(r)\n lroot = max(lt + [None])\n rroot = max(rt + [None])\n root.left = construct(lroot, lt[:lt.index(lroot)], lt[lt.index(lroot) + 1:]) if lroot is not None else None\n root.right = construct(rroot, rt[:rt.index(rroot)]...
<|body_start_0|> def construct(r, lt, rt): if r is None: return r root = TreeNode(r) lroot = max(lt + [None]) rroot = max(rt + [None]) root.left = construct(lroot, lt[:lt.index(lroot)], lt[lt.index(lroot) + 1:]) if lroot is not None els...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_0|> def rewrite(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> def construct(r, lt, rt)...
stack_v2_sparse_classes_36k_train_026115
2,854
no_license
[ { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "constructMaximumBinaryTree", "signature": "def constructMaximumBinaryTree(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "rewrite", "signature": "def rewrite(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def rewrite(self, nums): :type nums: List[int] :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def rewrite(self, nums): :type nums: List[int] :rtype: TreeNode <|skeleton|> class Solution:...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_0|> def rewrite(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" def construct(r, lt, rt): if r is None: return r root = TreeNode(r) lroot = max(lt + [None]) rroot = max(rt + [None]) r...
the_stack_v2_python_sparse
tree/654_Maximum_Binary_Tree.py
vsdrun/lc_public
train
6
3175fb9349588bb3e7cca403342792cf0ad2e144
[ "self.client_subnet_whitelist_vec = client_subnet_whitelist_vec\nself.disable_nfs_access = disable_nfs_access\nself.protocol_access_info = protocol_access_info\nself.qos_mapping_vec = qos_mapping_vec\nself.storage_policy_override = storage_policy_override\nself.view_description = view_description\nself.worm_lock_ex...
<|body_start_0|> self.client_subnet_whitelist_vec = client_subnet_whitelist_vec self.disable_nfs_access = disable_nfs_access self.protocol_access_info = protocol_access_info self.qos_mapping_vec = qos_mapping_vec self.storage_policy_override = storage_policy_override self...
Implementation of the 'ViewParams' model. TODO: type description here. Attributes: client_subnet_whitelist_vec (list of ClusterConfigProto_Subnet): List of external client subnets from where requests will be received for the new view. disable_nfs_access (bool): Whether to disable NFS access in the new view. protocol_ac...
ViewParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewParams: """Implementation of the 'ViewParams' model. TODO: type description here. Attributes: client_subnet_whitelist_vec (list of ClusterConfigProto_Subnet): List of external client subnets from where requests will be received for the new view. disable_nfs_access (bool): Whether to disable N...
stack_v2_sparse_classes_36k_train_026116
5,235
permissive
[ { "docstring": "Constructor for the ViewParams class", "name": "__init__", "signature": "def __init__(self, client_subnet_whitelist_vec=None, disable_nfs_access=None, protocol_access_info=None, qos_mapping_vec=None, storage_policy_override=None, view_description=None, worm_lock_expiry_usecs=None)" }, ...
2
null
Implement the Python class `ViewParams` described below. Class description: Implementation of the 'ViewParams' model. TODO: type description here. Attributes: client_subnet_whitelist_vec (list of ClusterConfigProto_Subnet): List of external client subnets from where requests will be received for the new view. disable_...
Implement the Python class `ViewParams` described below. Class description: Implementation of the 'ViewParams' model. TODO: type description here. Attributes: client_subnet_whitelist_vec (list of ClusterConfigProto_Subnet): List of external client subnets from where requests will be received for the new view. disable_...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ViewParams: """Implementation of the 'ViewParams' model. TODO: type description here. Attributes: client_subnet_whitelist_vec (list of ClusterConfigProto_Subnet): List of external client subnets from where requests will be received for the new view. disable_nfs_access (bool): Whether to disable N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViewParams: """Implementation of the 'ViewParams' model. TODO: type description here. Attributes: client_subnet_whitelist_vec (list of ClusterConfigProto_Subnet): List of external client subnets from where requests will be received for the new view. disable_nfs_access (bool): Whether to disable NFS access in ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/view_params.py
cohesity/management-sdk-python
train
24
6de48c4c16f0af448e8807bcc9091b96682764c8
[ "m = len(grid)\nn = len(grid[0])\nfor i in range(1, n):\n grid[0][i] += grid[0][i - 1]\nfor i in range(1, m):\n grid[i][0] += grid[i - 1][0]\nfor i in range(1, m):\n for j in range(1, n):\n grid[i][j] = min(grid[i][j] + grid[i - 1][j], grid[i][j] + grid[i][j - 1])\nreturn grid[m - 1][n - 1]", "res...
<|body_start_0|> m = len(grid) n = len(grid[0]) for i in range(1, n): grid[0][i] += grid[0][i - 1] for i in range(1, m): grid[i][0] += grid[i - 1][0] for i in range(1, m): for j in range(1, n): grid[i][j] = min(grid[i][j] + grid...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def minPathSum1(self, grid): """不修改grid,用一个新的list保存每一行的结果 :param grid: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> m = len(grid) n = ...
stack_v2_sparse_classes_36k_train_026117
1,332
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "minPathSum", "signature": "def minPathSum(self, grid)" }, { "docstring": "不修改grid,用一个新的list保存每一行的结果 :param grid: :return:", "name": "minPathSum1", "signature": "def minPathSum1(self, grid)" } ]
2
stack_v2_sparse_classes_30k_train_008718
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum1(self, grid): 不修改grid,用一个新的list保存每一行的结果 :param grid: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum1(self, grid): 不修改grid,用一个新的list保存每一行的结果 :param grid: :return: <|skeleton|> class Solution: ...
11ad9d3841de09c0b4dc3a667e7e63c3558656a5
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def minPathSum1(self, grid): """不修改grid,用一个新的list保存每一行的结果 :param grid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" m = len(grid) n = len(grid[0]) for i in range(1, n): grid[0][i] += grid[0][i - 1] for i in range(1, m): grid[i][0] += grid[i - 1][0] for i in range(1, m):...
the_stack_v2_python_sparse
minimum-path-sum.py
ganlanshu/leetcode
train
0
2cb9d8f7283ad29fff2a4732f8e29636e4e8ff2f
[ "num_cases, num_dim = X.shape\noutput_df = pd.DataFrame()\nfor dim in range(num_dim):\n dim_data = X.iloc[:, dim]\n out = self.row_wise_get_der(dim_data)\n output_df['der_dim_' + str(dim)] = pd.Series(out)\nreturn output_df", "def get_der(x):\n der = []\n for i in range(1, len(x) - 1):\n der...
<|body_start_0|> num_cases, num_dim = X.shape output_df = pd.DataFrame() for dim in range(num_dim): dim_data = X.iloc[:, dim] out = self.row_wise_get_der(dim_data) output_df['der_dim_' + str(dim)] = pd.Series(out) return output_df <|end_body_0|> <|bod...
Derivative slope transformer.
DerivativeSlopeTransformer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DerivativeSlopeTransformer: """Derivative slope transformer.""" def _transform(self, X, y=None): """Transform X.""" <|body_0|> def row_wise_get_der(X): """Get derivatives.""" <|body_1|> <|end_skeleton|> <|body_start_0|> num_cases, num_dim = X.sh...
stack_v2_sparse_classes_36k_train_026118
16,453
permissive
[ { "docstring": "Transform X.", "name": "_transform", "signature": "def _transform(self, X, y=None)" }, { "docstring": "Get derivatives.", "name": "row_wise_get_der", "signature": "def row_wise_get_der(X)" } ]
2
stack_v2_sparse_classes_30k_train_002000
Implement the Python class `DerivativeSlopeTransformer` described below. Class description: Derivative slope transformer. Method signatures and docstrings: - def _transform(self, X, y=None): Transform X. - def row_wise_get_der(X): Get derivatives.
Implement the Python class `DerivativeSlopeTransformer` described below. Class description: Derivative slope transformer. Method signatures and docstrings: - def _transform(self, X, y=None): Transform X. - def row_wise_get_der(X): Get derivatives. <|skeleton|> class DerivativeSlopeTransformer: """Derivative slop...
70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f
<|skeleton|> class DerivativeSlopeTransformer: """Derivative slope transformer.""" def _transform(self, X, y=None): """Transform X.""" <|body_0|> def row_wise_get_der(X): """Get derivatives.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DerivativeSlopeTransformer: """Derivative slope transformer.""" def _transform(self, X, y=None): """Transform X.""" num_cases, num_dim = X.shape output_df = pd.DataFrame() for dim in range(num_dim): dim_data = X.iloc[:, dim] out = self.row_wise_get_...
the_stack_v2_python_sparse
sktime/transformations/panel/summarize/_extract.py
sktime/sktime
train
1,117
c1e0bf539cc4247efe1dcd41b12e6d60ce6416cb
[ "self.name = name\nself.number = number\nself.collectioin = show_collection", "lst = []\nfor i in self.collectioin:\n if i.cast_contains(actor):\n lst.append(i)\nreturn lst" ]
<|body_start_0|> self.name = name self.number = number self.collectioin = show_collection <|end_body_0|> <|body_start_1|> lst = [] for i in self.collectioin: if i.cast_contains(actor): lst.append(i) return lst <|end_body_1|>
Channel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Channel: def __init__(self, name, number, show_collection): """Constructor -- creates an channel object Parameters: self -- the current piece object name -- channel name, String number == channel number, integer show_collection -- a list of shows that the channel has""" <|body_0|...
stack_v2_sparse_classes_36k_train_026119
924
no_license
[ { "docstring": "Constructor -- creates an channel object Parameters: self -- the current piece object name -- channel name, String number == channel number, integer show_collection -- a list of shows that the channel has", "name": "__init__", "signature": "def __init__(self, name, number, show_collectio...
2
stack_v2_sparse_classes_30k_train_000311
Implement the Python class `Channel` described below. Class description: Implement the Channel class. Method signatures and docstrings: - def __init__(self, name, number, show_collection): Constructor -- creates an channel object Parameters: self -- the current piece object name -- channel name, String number == chan...
Implement the Python class `Channel` described below. Class description: Implement the Channel class. Method signatures and docstrings: - def __init__(self, name, number, show_collection): Constructor -- creates an channel object Parameters: self -- the current piece object name -- channel name, String number == chan...
79a13f3152c7e61d8d6cc10da2213a15c8a364e5
<|skeleton|> class Channel: def __init__(self, name, number, show_collection): """Constructor -- creates an channel object Parameters: self -- the current piece object name -- channel name, String number == channel number, integer show_collection -- a list of shows that the channel has""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Channel: def __init__(self, name, number, show_collection): """Constructor -- creates an channel object Parameters: self -- the current piece object name -- channel name, String number == channel number, integer show_collection -- a list of shows that the channel has""" self.name = name ...
the_stack_v2_python_sparse
Labs/Lab10/channel.py
Johnspeanut/Computer_science_fundation_course
train
0
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('level_result', kwargs={'level': int(data['level'])})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Level Result To Display'\ncontext['detail_text'] = 'Please select the <strong>Level/Session\...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('level_result', kwargs={'level': int(data['level'])}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context['title_text'] = 'Choose Level Result To...
View for choosing which level/session result to display. Check that the user's account is still active. Redirects to level_result view on form valid.
ShowLevelResultView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowLevelResultView: """View for choosing which level/session result to display. Check that the user's account is still active. Redirects to level_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_026120
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_train_003303
Implement the Python class `ShowLevelResultView` described below. Class description: View for choosing which level/session result to display. Check that the user's account is still active. Redirects to level_result view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success...
Implement the Python class `ShowLevelResultView` described below. Class description: View for choosing which level/session result to display. Check that the user's account is still active. Redirects to level_result view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ShowLevelResultView: """View for choosing which level/session result to display. Check that the user's account is still active. Redirects to level_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowLevelResultView: """View for choosing which level/session result to display. Check that the user's account is still active. Redirects to level_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleaned_data ...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
17b09a181aaca5ee5ae190d34d65806695eca136
[ "self.root = path\nself.params = params\nself.ruby_version = ruby_version\nself.entrypoint = entrypoint\nself.packages = packages\nif params.deploy:\n self.notify = log.info\nelse:\n self.notify = log.status.Print", "all_config_files = []\nif not self.params.appinfo:\n all_config_files.append(self._Gener...
<|body_start_0|> self.root = path self.params = params self.ruby_version = ruby_version self.entrypoint = entrypoint self.packages = packages if params.deploy: self.notify = log.info else: self.notify = log.status.Print <|end_body_0|> <|bo...
Generates configuration for a Ruby app.
RubyConfigurator
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RubyConfigurator: """Generates configuration for a Ruby app.""" def __init__(self, path, params, ruby_version, entrypoint, packages): """Constructor. Args: path: (str) Root path of the source tree. params: (ext_runtime.Params) Parameters passed through to the fingerprinters. ruby_ver...
stack_v2_sparse_classes_36k_train_026121
18,608
permissive
[ { "docstring": "Constructor. Args: path: (str) Root path of the source tree. params: (ext_runtime.Params) Parameters passed through to the fingerprinters. ruby_version: (str) The ruby interpreter in rbenv format entrypoint: (str) The entrypoint command packages: ([str, ...]) A set of packages to install", "...
6
null
Implement the Python class `RubyConfigurator` described below. Class description: Generates configuration for a Ruby app. Method signatures and docstrings: - def __init__(self, path, params, ruby_version, entrypoint, packages): Constructor. Args: path: (str) Root path of the source tree. params: (ext_runtime.Params) ...
Implement the Python class `RubyConfigurator` described below. Class description: Generates configuration for a Ruby app. Method signatures and docstrings: - def __init__(self, path, params, ruby_version, entrypoint, packages): Constructor. Args: path: (str) Root path of the source tree. params: (ext_runtime.Params) ...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class RubyConfigurator: """Generates configuration for a Ruby app.""" def __init__(self, path, params, ruby_version, entrypoint, packages): """Constructor. Args: path: (str) Root path of the source tree. params: (ext_runtime.Params) Parameters passed through to the fingerprinters. ruby_ver...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RubyConfigurator: """Generates configuration for a Ruby app.""" def __init__(self, path, params, ruby_version, entrypoint, packages): """Constructor. Args: path: (str) Root path of the source tree. params: (ext_runtime.Params) Parameters passed through to the fingerprinters. ruby_version: (str) T...
the_stack_v2_python_sparse
google-cloud-sdk/.install/.backup/lib/googlecloudsdk/api_lib/app/runtimes/ruby.py
KaranToor/MA450
train
1
117667b9b4a865829ff4d17242d43b146b12c307
[ "dxf = super().load_dxf_attribs(processor)\nif processor:\n processor.simple_dxfattribs_loader(dxf, acdb_entity_group_codes)\nreturn dxf", "super().export_entity(tagwriter)\nif tagwriter.dxfversion > DXF12:\n tagwriter.write_tag2(SUBCLASS_MARKER, acdb_entity.name)\nif self.dxf.hasattr('paperspace'):\n ta...
<|body_start_0|> dxf = super().load_dxf_attribs(processor) if processor: processor.simple_dxfattribs_loader(dxf, acdb_entity_group_codes) return dxf <|end_body_0|> <|body_start_1|> super().export_entity(tagwriter) if tagwriter.dxfversion > DXF12: tagwrite...
DXF ENDBLK entity
EndBlk
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EndBlk: """DXF ENDBLK entity""" def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: """Loading interface. (internal API)""" <|body_0|> def export_entity(self, tagwriter: AbstractTagWriter) -> None: """Export entity specific da...
stack_v2_sparse_classes_36k_train_026122
8,611
permissive
[ { "docstring": "Loading interface. (internal API)", "name": "load_dxf_attribs", "signature": "def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace" }, { "docstring": "Export entity specific data as DXF tags.", "name": "export_entity", "signature": "def ...
2
null
Implement the Python class `EndBlk` described below. Class description: DXF ENDBLK entity Method signatures and docstrings: - def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: Loading interface. (internal API) - def export_entity(self, tagwriter: AbstractTagWriter) -> None: Expo...
Implement the Python class `EndBlk` described below. Class description: DXF ENDBLK entity Method signatures and docstrings: - def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: Loading interface. (internal API) - def export_entity(self, tagwriter: AbstractTagWriter) -> None: Expo...
ba6ab0264dcb6833173042a37b1b5ae878d75113
<|skeleton|> class EndBlk: """DXF ENDBLK entity""" def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: """Loading interface. (internal API)""" <|body_0|> def export_entity(self, tagwriter: AbstractTagWriter) -> None: """Export entity specific da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EndBlk: """DXF ENDBLK entity""" def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: """Loading interface. (internal API)""" dxf = super().load_dxf_attribs(processor) if processor: processor.simple_dxfattribs_loader(dxf, acdb_entity_...
the_stack_v2_python_sparse
src/ezdxf/entities/block.py
mozman/ezdxf
train
750
2d2cee9d7cc51dbc4f3941f4006cc7a7b57a3ad9
[ "with Database() as db:\n data = db.get_all('SELECT * FROM tbl_building_contact WHERE id_building=%s;', (id_building,))\nreturn {'data': data}", "with Database() as db:\n db.execute('INSERT INTO tbl_building_contact (\\n\\t\\t\\t\\t\\t\\t\\tid_building_contact, id_building, first_name, last_name, phone_numb...
<|body_start_0|> with Database() as db: data = db.get_all('SELECT * FROM tbl_building_contact WHERE id_building=%s;', (id_building,)) return {'data': data} <|end_body_0|> <|body_start_1|> with Database() as db: db.execute('INSERT INTO tbl_building_contact (\n\t\t\t\t\t\t...
BuildingContact
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildingContact: def get(self, id_building): """Return all contact for one building :param id_building: UUID""" <|body_0|> def assign(self, body): """Assign new contact to building :param body: { id_building: UUID, first_name: STRING, last_name: STRING, phone_number:...
stack_v2_sparse_classes_36k_train_026123
2,702
no_license
[ { "docstring": "Return all contact for one building :param id_building: UUID", "name": "get", "signature": "def get(self, id_building)" }, { "docstring": "Assign new contact to building :param body: { id_building: UUID, first_name: STRING, last_name: STRING, phone_number: INTEGER, phone_extensio...
4
null
Implement the Python class `BuildingContact` described below. Class description: Implement the BuildingContact class. Method signatures and docstrings: - def get(self, id_building): Return all contact for one building :param id_building: UUID - def assign(self, body): Assign new contact to building :param body: { id_...
Implement the Python class `BuildingContact` described below. Class description: Implement the BuildingContact class. Method signatures and docstrings: - def get(self, id_building): Return all contact for one building :param id_building: UUID - def assign(self, body): Assign new contact to building :param body: { id_...
43bd57c466a5cd3b133ddc437cb4a6b9f007d267
<|skeleton|> class BuildingContact: def get(self, id_building): """Return all contact for one building :param id_building: UUID""" <|body_0|> def assign(self, body): """Assign new contact to building :param body: { id_building: UUID, first_name: STRING, last_name: STRING, phone_number:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildingContact: def get(self, id_building): """Return all contact for one building :param id_building: UUID""" with Database() as db: data = db.get_all('SELECT * FROM tbl_building_contact WHERE id_building=%s;', (id_building,)) return {'data': data} def assign(self, b...
the_stack_v2_python_sparse
resturls/buildingcontact.py
CAUCA-9-1-1/survip-api
train
1
846edef5d5b25f5bc49a12da17b9731c7a20e8c0
[ "if x < 0:\n x = int(str(x)[::-1][-1] + str(x)[::-1][:-1])\nelse:\n x = int(str(x)[::-1])\nif abs(x) > 2147483647:\n return 0\nelse:\n return x", "result = 0\npos_int = abs(x)\nwhile pos_int:\n result = result * 10 + pos_int % 10\n pos_int = pos_int // 10\nif result <= 2147483647:\n if x < 0:...
<|body_start_0|> if x < 0: x = int(str(x)[::-1][-1] + str(x)[::-1][:-1]) else: x = int(str(x)[::-1]) if abs(x) > 2147483647: return 0 else: return x <|end_body_0|> <|body_start_1|> result = 0 pos_int = abs(x) while ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse1(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse2(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: x = int(str(x)[::-1][-1] + str(x)[::-1][:-1]) ...
stack_v2_sparse_classes_36k_train_026124
1,475
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse1", "signature": "def reverse1(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse2", "signature": "def reverse2(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_015659
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse1(self, x): :type x: int :rtype: int - def reverse2(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse1(self, x): :type x: int :rtype: int - def reverse2(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def reverse1(self, x): """:type x: in...
96dd15210bcf9efe1f8cf31ce0566a7eabb3e221
<|skeleton|> class Solution: def reverse1(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse2(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse1(self, x): """:type x: int :rtype: int""" if x < 0: x = int(str(x)[::-1][-1] + str(x)[::-1][:-1]) else: x = int(str(x)[::-1]) if abs(x) > 2147483647: return 0 else: return x def reverse2(self, x)...
the_stack_v2_python_sparse
Python/ReverseInteger.py
abhi-verma/LeetCode-Algo
train
0
098ee1fdb9e6211c1e98e97e726b125f48b0bb1e
[ "if not head:\n return None\nif head.next and head.val == head.next.val:\n while head.next and head.val == head.next.val:\n head = head.next\n return self.deleteDuplicates_recursive(head.next)\nhead.next = self.deleteDuplicates_recursive(head.next)\nreturn head", "if not head:\n return None\nfa...
<|body_start_0|> if not head: return None if head.next and head.val == head.next.val: while head.next and head.val == head.next.val: head = head.next return self.deleteDuplicates_recursive(head.next) head.next = self.deleteDuplicates_recursive(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates_recursive(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates_iterative(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not ...
stack_v2_sparse_classes_36k_train_026125
1,802
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates_recursive", "signature": "def deleteDuplicates_recursive(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates_iterative", "signature": "def deleteDuplicates_iter...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates_recursive(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates_iterative(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates_recursive(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates_iterative(self, head): :type head: ListNode :rtype: ListNode <|skeleton|...
9ac54720f571a4bea09d0cceb0039381a78df9e8
<|skeleton|> class Solution: def deleteDuplicates_recursive(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates_iterative(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates_recursive(self, head): """:type head: ListNode :rtype: ListNode""" if not head: return None if head.next and head.val == head.next.val: while head.next and head.val == head.next.val: head = head.next ret...
the_stack_v2_python_sparse
code/082_remove-duplicates-from-sorted-list-ii.py
linhdvu14/leetcode-solutions
train
2
9f90abb3bdcaf58118bf3455587e27a8fccc0069
[ "super(EncoderImageFull, self).__init__()\nself.embed_size = embed_size\nself.no_imgnorm = no_imgnorm\nself.use_abs = use_abs\nmodel = get_model(name=cnn_type, num_classes=5607)\nmodel = torch.nn.DataParallel(model)\nmodel.to('cuda')\ncheckpoint = torch.load('/mnt/data2/betty/webvision_train/results/resnet50/5000cl...
<|body_start_0|> super(EncoderImageFull, self).__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm self.use_abs = use_abs model = get_model(name=cnn_type, num_classes=5607) model = torch.nn.DataParallel(model) model.to('cuda') checkpoint =...
EncoderImageFull
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderImageFull: def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" <|body_0|> def load_state_dict(self, load_path): """Handle the models saved before commit...
stack_v2_sparse_classes_36k_train_026126
22,197
no_license
[ { "docstring": "Load pretrained VGG19 and replace top fc layer.", "name": "__init__", "signature": "def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False)" }, { "docstring": "Handle the models saved before commit pytorch/vision@989d52a", "nam...
4
stack_v2_sparse_classes_30k_train_019190
Implement the Python class `EncoderImageFull` described below. Class description: Implement the EncoderImageFull class. Method signatures and docstrings: - def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): Load pretrained VGG19 and replace top fc layer. - def lo...
Implement the Python class `EncoderImageFull` described below. Class description: Implement the EncoderImageFull class. Method signatures and docstrings: - def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): Load pretrained VGG19 and replace top fc layer. - def lo...
4779d33a921be0c0adaf5971ec853317eb072af1
<|skeleton|> class EncoderImageFull: def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" <|body_0|> def load_state_dict(self, load_path): """Handle the models saved before commit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderImageFull: def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" super(EncoderImageFull, self).__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm ...
the_stack_v2_python_sparse
cnn/encoder.py
bledem/webvision
train
0
7092c532c79feb18b6296cd3c9a95c8c33cbb0df
[ "if value is None:\n return default_value\nif not isinstance(value, int) and (not isinstance(value, float)):\n raise ValidationException(f'Parameter {name} must be a number')\nif value < 0:\n raise ValidationException(f'Parameter {name} cannot be lower than 0')\nreturn value", "value = self.validate_numb...
<|body_start_0|> if value is None: return default_value if not isinstance(value, int) and (not isinstance(value, float)): raise ValidationException(f'Parameter {name} must be a number') if value < 0: raise ValidationException(f'Parameter {name} cannot be lower...
Class for validating API options.
OptionsValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsValidator: """Class for validating API options.""" def validate_number(self, value: int or float or None, default_value: int or float, name: str): """Validates a number parameter. Args: value: Value to validate. default_value: Default value for an option. name: Option name. Re...
stack_v2_sparse_classes_36k_train_026127
2,079
no_license
[ { "docstring": "Validates a number parameter. Args: value: Value to validate. default_value: Default value for an option. name: Option name. Returns: Validated value. Raises: ValidationException: If value is invalid.", "name": "validate_number", "signature": "def validate_number(self, value: int or floa...
3
null
Implement the Python class `OptionsValidator` described below. Class description: Class for validating API options. Method signatures and docstrings: - def validate_number(self, value: int or float or None, default_value: int or float, name: str): Validates a number parameter. Args: value: Value to validate. default_...
Implement the Python class `OptionsValidator` described below. Class description: Class for validating API options. Method signatures and docstrings: - def validate_number(self, value: int or float or None, default_value: int or float, name: str): Validates a number parameter. Args: value: Value to validate. default_...
b410e4c6bc4b11fc6ed85c91aca43e07fcd5fd2c
<|skeleton|> class OptionsValidator: """Class for validating API options.""" def validate_number(self, value: int or float or None, default_value: int or float, name: str): """Validates a number parameter. Args: value: Value to validate. default_value: Default value for an option. name: Option name. Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptionsValidator: """Class for validating API options.""" def validate_number(self, value: int or float or None, default_value: int or float, name: str): """Validates a number parameter. Args: value: Value to validate. default_value: Default value for an option. name: Option name. Returns: Valida...
the_stack_v2_python_sparse
lib/clients/optionsValidator.py
alading241/metaapi-python-sdk
train
0
b8a7284ede1736ed8b7dad09018242b411d9b883
[ "integration_id = request.GET.get('integrationId')\nqueryset = RepositoryProjectPathConfig.objects.all()\nif integration_id:\n org_integration = self.get_organization_integration(organization, integration_id)\n queryset = queryset.filter(organization_integration=org_integration)\nelse:\n projects = self.ge...
<|body_start_0|> integration_id = request.GET.get('integrationId') queryset = RepositoryProjectPathConfig.objects.all() if integration_id: org_integration = self.get_organization_integration(organization, integration_id) queryset = queryset.filter(organization_integration...
OrganizationCodeMappingsEndpoint
[ "Apache-2.0", "BUSL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationCodeMappingsEndpoint: def get(self, request: Request, organization) -> Response: """Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integrati...
stack_v2_sparse_classes_36k_train_026128
7,699
permissive
[ { "docstring": "Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integration id. :qparam int project: Optional. Pass \"-1\" to filter to 'all projects user has access to'. Omit t...
2
stack_v2_sparse_classes_30k_train_011211
Implement the Python class `OrganizationCodeMappingsEndpoint` described below. Class description: Implement the OrganizationCodeMappingsEndpoint class. Method signatures and docstrings: - def get(self, request: Request, organization) -> Response: Get the list of repository project path configs :pparam string organiza...
Implement the Python class `OrganizationCodeMappingsEndpoint` described below. Class description: Implement the OrganizationCodeMappingsEndpoint class. Method signatures and docstrings: - def get(self, request: Request, organization) -> Response: Get the list of repository project path configs :pparam string organiza...
d9dd4f382f96b5c4576b64cbf015db651556c18b
<|skeleton|> class OrganizationCodeMappingsEndpoint: def get(self, request: Request, organization) -> Response: """Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integrati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationCodeMappingsEndpoint: def get(self, request: Request, organization) -> Response: """Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integration id. :qparam...
the_stack_v2_python_sparse
src/sentry/api/endpoints/organization_code_mappings.py
nagyist/sentry
train
0
58fcf1f3ede0f8d2ab808178f27b949d8fcd6d49
[ "question = '你喜欢的女朋友有什么样的气质?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_respond('温柔')\nassert '温柔', my_survey.responses", "question = '你喜欢的女朋友有什么样的气质?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['温柔', '聪明', '美丽']\nfor response in responses:\n my_survey.store_respond(response)\n asser...
<|body_start_0|> question = '你喜欢的女朋友有什么样的气质?' my_survey = AnonymousSurvey(question) my_survey.store_respond('温柔') assert '温柔', my_survey.responses <|end_body_0|> <|body_start_1|> question = '你喜欢的女朋友有什么样的气质?' my_survey = AnonymousSurvey(question) responses = ['温柔'...
针对AnonymousSurvey类的测试
TestAnonymousSurvey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnonymousSurvey: """针对AnonymousSurvey类的测试""" def test_single_response(self): """测试单个答案会被妥善的存储""" <|body_0|> def test_store_three_response(self): """测试三个答案会被被妥善地存储""" <|body_1|> <|end_skeleton|> <|body_start_0|> question = '你喜欢的女朋友有什么样的气质?' ...
stack_v2_sparse_classes_36k_train_026129
911
no_license
[ { "docstring": "测试单个答案会被妥善的存储", "name": "test_single_response", "signature": "def test_single_response(self)" }, { "docstring": "测试三个答案会被被妥善地存储", "name": "test_store_three_response", "signature": "def test_store_three_response(self)" } ]
2
stack_v2_sparse_classes_30k_train_002105
Implement the Python class `TestAnonymousSurvey` described below. Class description: 针对AnonymousSurvey类的测试 Method signatures and docstrings: - def test_single_response(self): 测试单个答案会被妥善的存储 - def test_store_three_response(self): 测试三个答案会被被妥善地存储
Implement the Python class `TestAnonymousSurvey` described below. Class description: 针对AnonymousSurvey类的测试 Method signatures and docstrings: - def test_single_response(self): 测试单个答案会被妥善的存储 - def test_store_three_response(self): 测试三个答案会被被妥善地存储 <|skeleton|> class TestAnonymousSurvey: """针对AnonymousSurvey类的测试""" ...
8fb4224c6b7464086e874a654ca5e8e6a6b26029
<|skeleton|> class TestAnonymousSurvey: """针对AnonymousSurvey类的测试""" def test_single_response(self): """测试单个答案会被妥善的存储""" <|body_0|> def test_store_three_response(self): """测试三个答案会被被妥善地存储""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAnonymousSurvey: """针对AnonymousSurvey类的测试""" def test_single_response(self): """测试单个答案会被妥善的存储""" question = '你喜欢的女朋友有什么样的气质?' my_survey = AnonymousSurvey(question) my_survey.store_respond('温柔') assert '温柔', my_survey.responses def test_store_three_response...
the_stack_v2_python_sparse
src/chapter7unit/class_examples/test_survey.py
lindafanglizhi/pytest_book1
train
0
b4f09c87f6d20b9e70d512b5bac383b9cd070388
[ "even_arr, odd_arr = ([], [])\nfor i in A:\n if i % 2 == 0:\n even_arr.append(i)\n else:\n odd_arr.append(i)\nreturn even_arr + odd_arr", "l, r = (0, len(A) - 1)\nwhile r >= l:\n if A[l] % 2 == 0:\n l += 1\n else:\n A[l], A[r] = (A[r], A[l])\n r -= 1\nreturn A" ]
<|body_start_0|> even_arr, odd_arr = ([], []) for i in A: if i % 2 == 0: even_arr.append(i) else: odd_arr.append(i) return even_arr + odd_arr <|end_body_0|> <|body_start_1|> l, r = (0, len(A) - 1) while r >= l: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortArrayByParity_sol1(self, A): """:type: A: List[int] :rtype: List[int]""" <|body_0|> def sortArrayByParity_sol2(self, A): """:type: A: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> even_arr, odd_arr = (...
stack_v2_sparse_classes_36k_train_026130
665
no_license
[ { "docstring": ":type: A: List[int] :rtype: List[int]", "name": "sortArrayByParity_sol1", "signature": "def sortArrayByParity_sol1(self, A)" }, { "docstring": ":type: A: List[int] :rtype: List[int]", "name": "sortArrayByParity_sol2", "signature": "def sortArrayByParity_sol2(self, A)" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParity_sol1(self, A): :type: A: List[int] :rtype: List[int] - def sortArrayByParity_sol2(self, A): :type: A: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParity_sol1(self, A): :type: A: List[int] :rtype: List[int] - def sortArrayByParity_sol2(self, A): :type: A: List[int] :rtype: List[int] <|skeleton|> class Soluti...
885a9af8a7bee3c228c7ae4e295dca810bd91d01
<|skeleton|> class Solution: def sortArrayByParity_sol1(self, A): """:type: A: List[int] :rtype: List[int]""" <|body_0|> def sortArrayByParity_sol2(self, A): """:type: A: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortArrayByParity_sol1(self, A): """:type: A: List[int] :rtype: List[int]""" even_arr, odd_arr = ([], []) for i in A: if i % 2 == 0: even_arr.append(i) else: odd_arr.append(i) return even_arr + odd_arr d...
the_stack_v2_python_sparse
Python/905.py
kevin851066/Leetcode
train
0
bb007a35f89b932c40a56e404cd5e508a968c0b3
[ "current = head\nnthPrev = None\nnodeToDelete = None\nstep = 1\nwhile current.next:\n current = current.next\n if step + 1 == n:\n nodeToDelete = head\n elif nodeToDelete:\n nodeToDelete = nodeToDelete.next\n if step == n:\n nthPrev = head\n elif nthPrev:\n nthPrev = nthPr...
<|body_start_0|> current = head nthPrev = None nodeToDelete = None step = 1 while current.next: current = current.next if step + 1 == n: nodeToDelete = head elif nodeToDelete: nodeToDelete = nodeToDelete.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEndTmp(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_026131
2,713
no_license
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head, n)" }, { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEndTmp", "signature": "def removeNthFromEndTmp...
2
stack_v2_sparse_classes_30k_train_004085
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEndTmp(self, head, n): :type head: ListNode :type n: int :rtype: ListNo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEndTmp(self, head, n): :type head: ListNode :type n: int :rtype: ListNo...
507d4982eb4fc1d3afa5dfdc0e7b6830ff8594ad
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEndTmp(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" current = head nthPrev = None nodeToDelete = None step = 1 while current.next: current = current.next if step + 1 == n: ...
the_stack_v2_python_sparse
remove-nth-node-from-end-of-list.py
igor-nov/algorithms
train
0
1fdd31a738eb85ea71093a3f65f9185e7b1e9691
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn BrowserSite()", "from .browser_site_compatibility_mode import BrowserSiteCompatibilityMode\nfrom .browser_site_history import BrowserSiteHistory\nfrom .browser_site_merge_type import BrowserSiteMergeType\nfrom .browser_site_status impo...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return BrowserSite() <|end_body_0|> <|body_start_1|> from .browser_site_compatibility_mode import BrowserSiteCompatibilityMode from .browser_site_history import BrowserSiteHistory from ...
Singleton entity which is used to specify IE mode site metadata
BrowserSite
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserSite: """Singleton entity which is used to specify IE mode site metadata""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSite: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod...
stack_v2_sparse_classes_36k_train_026132
6,396
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: BrowserSite", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(p...
3
null
Implement the Python class `BrowserSite` described below. Class description: Singleton entity which is used to specify IE mode site metadata Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSite: Creates a new instance of the appropriate class bas...
Implement the Python class `BrowserSite` described below. Class description: Singleton entity which is used to specify IE mode site metadata Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSite: Creates a new instance of the appropriate class bas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class BrowserSite: """Singleton entity which is used to specify IE mode site metadata""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSite: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrowserSite: """Singleton entity which is used to specify IE mode site metadata""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSite: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to r...
the_stack_v2_python_sparse
msgraph/generated/models/browser_site.py
microsoftgraph/msgraph-sdk-python
train
135
20918df95b835cb3e568f3dbfaeb26dbc538c9c2
[ "try:\n _lat = Decimal(lat.strip())\n _lng = Decimal(lng.strip())\n if (_lat > 90 or _lat < -90) or (_lng > 180 or _lng < -180):\n return None\n else:\n return Location(_lat, _lng)\nexcept ValueError:\n return None", "p1 = (location1.Latitude, location1.Longitude)\np2 = (location2.Lat...
<|body_start_0|> try: _lat = Decimal(lat.strip()) _lng = Decimal(lng.strip()) if (_lat > 90 or _lat < -90) or (_lng > 180 or _lng < -180): return None else: return Location(_lat, _lng) except ValueError: return N...
A helper class which provides helper methods for location based operations
CoordinateHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordinateHelper: """A helper class which provides helper methods for location based operations""" def CastString2Coordinates(lat, lng): """Returns a Location object from given string parameters.""" <|body_0|> def GetDistanceMeters(location1, location2): """Calcu...
stack_v2_sparse_classes_36k_train_026133
1,303
no_license
[ { "docstring": "Returns a Location object from given string parameters.", "name": "CastString2Coordinates", "signature": "def CastString2Coordinates(lat, lng)" }, { "docstring": "Calculates the distance between points represented by two Location objects", "name": "GetDistanceMeters", "si...
3
stack_v2_sparse_classes_30k_train_002808
Implement the Python class `CoordinateHelper` described below. Class description: A helper class which provides helper methods for location based operations Method signatures and docstrings: - def CastString2Coordinates(lat, lng): Returns a Location object from given string parameters. - def GetDistanceMeters(locatio...
Implement the Python class `CoordinateHelper` described below. Class description: A helper class which provides helper methods for location based operations Method signatures and docstrings: - def CastString2Coordinates(lat, lng): Returns a Location object from given string parameters. - def GetDistanceMeters(locatio...
63a1f25876c5d72e515099beb9379ac92a59168c
<|skeleton|> class CoordinateHelper: """A helper class which provides helper methods for location based operations""" def CastString2Coordinates(lat, lng): """Returns a Location object from given string parameters.""" <|body_0|> def GetDistanceMeters(location1, location2): """Calcu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoordinateHelper: """A helper class which provides helper methods for location based operations""" def CastString2Coordinates(lat, lng): """Returns a Location object from given string parameters.""" try: _lat = Decimal(lat.strip()) _lng = Decimal(lng.strip()) ...
the_stack_v2_python_sparse
server/coordinateHelper.py
flaskmc/challenge
train
0
953d30b4e14a697e78887ebe837ff05bdda87a1d
[ "if xml is None:\n self.defaultInit()\nelse:\n self.fromXml(xml)", "self.GPU = Size(XYstr='256x256')\nself.CPU = Size(XYstr='32x32')\nself.BI = Size(XYstr='256x256')", "self.GPU = Size(xml=xml.find('GPU'))\nself.CPU = Size(xml=xml.find('CPU'))\nself.BI = Size(xml=xml.find('BI'))", "txt = '<tilesSet>\\n'...
<|body_start_0|> if xml is None: self.defaultInit() else: self.fromXml(xml) <|end_body_0|> <|body_start_1|> self.GPU = Size(XYstr='256x256') self.CPU = Size(XYstr='32x32') self.BI = Size(XYstr='256x256') <|end_body_1|> <|body_start_2|> self.GPU =...
class to manage tiles sizes
Tiles
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tiles: """class to manage tiles sizes""" def __init__(self, xml=None): """initialize tiles sizes with default value or values extracted from an xml object""" <|body_0|> def defaultInit(self): """initialize tiles sizes with default value""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_026134
2,352
permissive
[ { "docstring": "initialize tiles sizes with default value or values extracted from an xml object", "name": "__init__", "signature": "def __init__(self, xml=None)" }, { "docstring": "initialize tiles sizes with default value", "name": "defaultInit", "signature": "def defaultInit(self)" ...
6
stack_v2_sparse_classes_30k_train_009605
Implement the Python class `Tiles` described below. Class description: class to manage tiles sizes Method signatures and docstrings: - def __init__(self, xml=None): initialize tiles sizes with default value or values extracted from an xml object - def defaultInit(self): initialize tiles sizes with default value - def...
Implement the Python class `Tiles` described below. Class description: class to manage tiles sizes Method signatures and docstrings: - def __init__(self, xml=None): initialize tiles sizes with default value or values extracted from an xml object - def defaultInit(self): initialize tiles sizes with default value - def...
39082e7833383bbe7dd414381f1b295e3b778439
<|skeleton|> class Tiles: """class to manage tiles sizes""" def __init__(self, xml=None): """initialize tiles sizes with default value or values extracted from an xml object""" <|body_0|> def defaultInit(self): """initialize tiles sizes with default value""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tiles: """class to manage tiles sizes""" def __init__(self, xml=None): """initialize tiles sizes with default value or values extracted from an xml object""" if xml is None: self.defaultInit() else: self.fromXml(xml) def defaultInit(self): """i...
the_stack_v2_python_sparse
Preferences/Tiles.py
chankeh/Blender-Render-Manager
train
0
a1d20d62b14e63c0ebe0a7fe8e17f38e4a4834d6
[ "self.stages = stages\nself.steps = np.cumsum([stage.steps for stage in self.stages])\nself.total_steps = self.steps[-1]\nself.stage_idx = -1\nself.min_steps = 0\nself.max_steps = 0\nself.stage = None", "epoch = max(min(epoch, self.total_steps), 0)\nwhile epoch >= self.max_steps and self.max_steps < self.total_st...
<|body_start_0|> self.stages = stages self.steps = np.cumsum([stage.steps for stage in self.stages]) self.total_steps = self.steps[-1] self.stage_idx = -1 self.min_steps = 0 self.max_steps = 0 self.stage = None <|end_body_0|> <|body_start_1|> epoch = max(...
Container for multiple stages of LinearDecay. Obtain the value corresponding to the `i`-th step by calling an instance of this class with the value `i`. # Parameters stages: List of `LinearDecay` objects to be sequentially applied for the number of steps in each stage.
MultiLinearDecay
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiLinearDecay: """Container for multiple stages of LinearDecay. Obtain the value corresponding to the `i`-th step by calling an instance of this class with the value `i`. # Parameters stages: List of `LinearDecay` objects to be sequentially applied for the number of steps in each stage.""" ...
stack_v2_sparse_classes_36k_train_026135
44,726
permissive
[ { "docstring": "Initializer. See class documentation for parameter definitions.", "name": "__init__", "signature": "def __init__(self, stages: Sequence[LinearDecay]) -> None" }, { "docstring": "Get the decayed value factor for `epoch` number of steps. # Parameters epoch : The number of steps. # ...
2
null
Implement the Python class `MultiLinearDecay` described below. Class description: Container for multiple stages of LinearDecay. Obtain the value corresponding to the `i`-th step by calling an instance of this class with the value `i`. # Parameters stages: List of `LinearDecay` objects to be sequentially applied for th...
Implement the Python class `MultiLinearDecay` described below. Class description: Container for multiple stages of LinearDecay. Obtain the value corresponding to the `i`-th step by calling an instance of this class with the value `i`. # Parameters stages: List of `LinearDecay` objects to be sequentially applied for th...
9772eeeb7eacc1f9a83c90d1cf549a3f7e783c12
<|skeleton|> class MultiLinearDecay: """Container for multiple stages of LinearDecay. Obtain the value corresponding to the `i`-th step by calling an instance of this class with the value `i`. # Parameters stages: List of `LinearDecay` objects to be sequentially applied for the number of steps in each stage.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiLinearDecay: """Container for multiple stages of LinearDecay. Obtain the value corresponding to the `i`-th step by calling an instance of this class with the value `i`. # Parameters stages: List of `LinearDecay` objects to be sequentially applied for the number of steps in each stage.""" def __init_...
the_stack_v2_python_sparse
allenact/utils/experiment_utils.py
allenai/allenact
train
266
4811413eb13e50bcabf208dbdfd24fc974a9f124
[ "self.defect_type = defect_type\nself.atom = atom\nself.chem_pot_input = chem_pot\nif defect_type == 'Vacancy':\n atomic_species = atom[0].split()[0]\n self.name = 'V_{' + atomic_species + '}'\n self.ID = 'Vac_' + atom[0].replace(' ', '')\n self.n = +1\n self.chem_pot = chem_pot[0]\n self.populati...
<|body_start_0|> self.defect_type = defect_type self.atom = atom self.chem_pot_input = chem_pot if defect_type == 'Vacancy': atomic_species = atom[0].split()[0] self.name = 'V_{' + atomic_species + '}' self.ID = 'Vac_' + atom[0].replace(' ', '') ...
Object containing various data on a defect
Defect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Defect: """Object containing various data on a defect""" def __init__(self, defect_type, atom, chem_pot): """:param defect_type: Type of defect ('Vacancy', 'Interstitial' or 'Substitutional') :param atom: list of atom(s) affected by the defect with the following pattern for each "ato...
stack_v2_sparse_classes_36k_train_026136
3,637
no_license
[ { "docstring": ":param defect_type: Type of defect ('Vacancy', 'Interstitial' or 'Substitutional') :param atom: list of atom(s) affected by the defect with the following pattern for each \"atomic_species + space + ( + atom_number + )\". The atom number depends on the defect_type: Vacancy : with respect to all a...
2
stack_v2_sparse_classes_30k_train_005443
Implement the Python class `Defect` described below. Class description: Object containing various data on a defect Method signatures and docstrings: - def __init__(self, defect_type, atom, chem_pot): :param defect_type: Type of defect ('Vacancy', 'Interstitial' or 'Substitutional') :param atom: list of atom(s) affect...
Implement the Python class `Defect` described below. Class description: Object containing various data on a defect Method signatures and docstrings: - def __init__(self, defect_type, atom, chem_pot): :param defect_type: Type of defect ('Vacancy', 'Interstitial' or 'Substitutional') :param atom: list of atom(s) affect...
1881be4f7a54defd307c62c3a3c634255181a6cb
<|skeleton|> class Defect: """Object containing various data on a defect""" def __init__(self, defect_type, atom, chem_pot): """:param defect_type: Type of defect ('Vacancy', 'Interstitial' or 'Substitutional') :param atom: list of atom(s) affected by the defect with the following pattern for each "ato...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Defect: """Object containing various data on a defect""" def __init__(self, defect_type, atom, chem_pot): """:param defect_type: Type of defect ('Vacancy', 'Interstitial' or 'Substitutional') :param atom: list of atom(s) affected by the defect with the following pattern for each "atomic_species +...
the_stack_v2_python_sparse
Previous versions/PyDEF 1.0.0/PyDEF 1.0.0 source code/pydef_core/defect.py
zhenming-xu/PyDEF
train
0
740b465b6ac9e75c9d5812b173476c924de4255e
[ "self.pa1_is_control = pa1_is_control\nself.flipped_by_0 = flipped_by_0\nassert pa1.size == 2 & pa2.size == 2, \"The parent nodes of the CNot don't both have size 2\"\nassert pa1.state_names == ['0', '1'], 'parent1 states not 0,1'\nassert pa2.state_names == ['0', '1'], 'parent2 states not 0,1'\nBayesNode.__init__(s...
<|body_start_0|> self.pa1_is_control = pa1_is_control self.flipped_by_0 = flipped_by_0 assert pa1.size == 2 & pa2.size == 2, "The parent nodes of the CNot don't both have size 2" assert pa1.state_names == ['0', '1'], 'parent1 states not 0,1' assert pa2.state_names == ['0', '1'], ...
The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are elements of {0,1}. Say M1 is the ...
CNot
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNot: """The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are e...
stack_v2_sparse_classes_36k_train_026137
4,466
permissive
[ { "docstring": "Constructor Parameters ---------- id_num : int id number of self (focus node) name : str name of self (focus node) is_quantum : bool pa1 : BayesNode parent 1 pa2 : BayesNode parent 2 pa1_is_control : bool True (False) when parent 1 (parent 2) is control flipped_by_0 : bool True (False) when targ...
2
null
Implement the Python class `CNot` described below. Class description: The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in t...
Implement the Python class `CNot` described below. Class description: The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in t...
5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2
<|skeleton|> class CNot: """The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CNot: """The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are elements of {0...
the_stack_v2_python_sparse
prefabricated_nodes/CNot.py
artiste-qb-net/quantum-fog
train
95
2a8b743b2f6bf620fe1080888a54ee19fbab46ec
[ "super().__init__(('', port), handler)\nself.delete_kv_lock = threading.Lock()\nself.delete_kv = {}\nself.kv_lock = threading.Lock()\nself.kv = {}", "ret = 0\nwith self.delete_kv_lock:\n ret = len(self.delete_kv.get(key, set()))\nreturn ret" ]
<|body_start_0|> super().__init__(('', port), handler) self.delete_kv_lock = threading.Lock() self.delete_kv = {} self.kv_lock = threading.Lock() self.kv = {} <|end_body_0|> <|body_start_1|> ret = 0 with self.delete_kv_lock: ret = len(self.delete_kv.g...
it is a http server storing kv pairs.
KVHTTPServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KVHTTPServer: """it is a http server storing kv pairs.""" def __init__(self, port, handler): """Init.""" <|body_0|> def get_deleted_size(self, key): """get deleted size in key.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__((''...
stack_v2_sparse_classes_36k_train_026138
5,744
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, port, handler)" }, { "docstring": "get deleted size in key.", "name": "get_deleted_size", "signature": "def get_deleted_size(self, key)" } ]
2
stack_v2_sparse_classes_30k_train_003578
Implement the Python class `KVHTTPServer` described below. Class description: it is a http server storing kv pairs. Method signatures and docstrings: - def __init__(self, port, handler): Init. - def get_deleted_size(self, key): get deleted size in key.
Implement the Python class `KVHTTPServer` described below. Class description: it is a http server storing kv pairs. Method signatures and docstrings: - def __init__(self, port, handler): Init. - def get_deleted_size(self, key): get deleted size in key. <|skeleton|> class KVHTTPServer: """it is a http server stor...
22a11a60e0e3d10a3cf610077a3d9942a6f964cb
<|skeleton|> class KVHTTPServer: """it is a http server storing kv pairs.""" def __init__(self, port, handler): """Init.""" <|body_0|> def get_deleted_size(self, key): """get deleted size in key.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KVHTTPServer: """it is a http server storing kv pairs.""" def __init__(self, port, handler): """Init.""" super().__init__(('', port), handler) self.delete_kv_lock = threading.Lock() self.delete_kv = {} self.kv_lock = threading.Lock() self.kv = {} def g...
the_stack_v2_python_sparse
python/paddle/distributed/fleet/utils/http_server.py
PaddlePaddle/Paddle
train
20,414
15efae4a45a5d99e3ec4902eb9a4988a80fd1b46
[ "if not isinstance(input_shape, Iterable):\n input_shape = (input_shape,)\nself.input_shape = input_shape\nself.steps = steps\nself.history = np.zeros((steps,) + input_shape)", "if isinstance(x, jnp.ndarray):\n self.history = jnp.roll(self.history, shift=1, axis=0)\n self.history = self.history.at[0].set...
<|body_start_0|> if not isinstance(input_shape, Iterable): input_shape = (input_shape,) self.input_shape = input_shape self.steps = steps self.history = np.zeros((steps,) + input_shape) <|end_body_0|> <|body_start_1|> if isinstance(x, jnp.ndarray): self.h...
Predict last value
PredictLast
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredictLast: """Predict last value""" def __init__(self, input_shape=1, steps=1): """init""" <|body_0|> def __call__(self, x): """call""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not isinstance(input_shape, Iterable): input_sh...
stack_v2_sparse_classes_36k_train_026139
1,431
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, input_shape=1, steps=1)" }, { "docstring": "call", "name": "__call__", "signature": "def __call__(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_020461
Implement the Python class `PredictLast` described below. Class description: Predict last value Method signatures and docstrings: - def __init__(self, input_shape=1, steps=1): init - def __call__(self, x): call
Implement the Python class `PredictLast` described below. Class description: Predict last value Method signatures and docstrings: - def __init__(self, input_shape=1, steps=1): init - def __call__(self, x): call <|skeleton|> class PredictLast: """Predict last value""" def __init__(self, input_shape=1, steps=...
5be08e2fa4ef8cad9a3c1d4134c13acf4c68637f
<|skeleton|> class PredictLast: """Predict last value""" def __init__(self, input_shape=1, steps=1): """init""" <|body_0|> def __call__(self, x): """call""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PredictLast: """Predict last value""" def __init__(self, input_shape=1, steps=1): """init""" if not isinstance(input_shape, Iterable): input_shape = (input_shape,) self.input_shape = input_shape self.steps = steps self.history = np.zeros((steps,) + inpu...
the_stack_v2_python_sparse
timecast/modules/_predict_last.py
NeoTim/timecast
train
0
43bbf56f80407f5494ca83052d1386aaf2432760
[ "acl.enforce('dynamic_actions:create', context.ctx())\nLOG.debug('Creating dynamic action [action=%s]', dyn_action)\nif not dyn_action.code_source_id and (not dyn_action.code_source_name):\n raise exc.InputException(\"Either 'code_source_id' or 'code_source_name' must be provided.\")\ncode_source = db_api.get_co...
<|body_start_0|> acl.enforce('dynamic_actions:create', context.ctx()) LOG.debug('Creating dynamic action [action=%s]', dyn_action) if not dyn_action.code_source_id and (not dyn_action.code_source_name): raise exc.InputException("Either 'code_source_id' or 'code_source_name' must be p...
DynamicActionsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicActionsController: def post(self, dyn_action): """Creates new dynamic action. :param dyn_action: Dynamic action to create.""" <|body_0|> def put(self, dyn_action): """Update dynamic action. :param dyn_action: Dynamic action to create.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_026140
9,796
permissive
[ { "docstring": "Creates new dynamic action. :param dyn_action: Dynamic action to create.", "name": "post", "signature": "def post(self, dyn_action)" }, { "docstring": "Update dynamic action. :param dyn_action: Dynamic action to create.", "name": "put", "signature": "def put(self, dyn_act...
5
stack_v2_sparse_classes_30k_train_020540
Implement the Python class `DynamicActionsController` described below. Class description: Implement the DynamicActionsController class. Method signatures and docstrings: - def post(self, dyn_action): Creates new dynamic action. :param dyn_action: Dynamic action to create. - def put(self, dyn_action): Update dynamic a...
Implement the Python class `DynamicActionsController` described below. Class description: Implement the DynamicActionsController class. Method signatures and docstrings: - def post(self, dyn_action): Creates new dynamic action. :param dyn_action: Dynamic action to create. - def put(self, dyn_action): Update dynamic a...
7baff017d0cf01d19c44055ad201ca59131b9f94
<|skeleton|> class DynamicActionsController: def post(self, dyn_action): """Creates new dynamic action. :param dyn_action: Dynamic action to create.""" <|body_0|> def put(self, dyn_action): """Update dynamic action. :param dyn_action: Dynamic action to create.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicActionsController: def post(self, dyn_action): """Creates new dynamic action. :param dyn_action: Dynamic action to create.""" acl.enforce('dynamic_actions:create', context.ctx()) LOG.debug('Creating dynamic action [action=%s]', dyn_action) if not dyn_action.code_source_i...
the_stack_v2_python_sparse
mistral/api/controllers/v2/dynamic_action.py
openstack/mistral
train
214
d61c2fd6ee9ffae01da70f7e27dcf212cbe8b779
[ "self.list = vec2d\nself.cur = 0\nself.iter = iter(vec2d[0]) if len(vec2d) else iter(vec2d)", "while True:\n try:\n return next(self.iter)\n except StopIteration as e:\n self.cur += 1\n if self.cur >= len(self.list):\n raise StopIteration()\n self.iter = iter(self.list...
<|body_start_0|> self.list = vec2d self.cur = 0 self.iter = iter(vec2d[0]) if len(vec2d) else iter(vec2d) <|end_body_0|> <|body_start_1|> while True: try: return next(self.iter) except StopIteration as e: self.cur += 1 ...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_026141
1,089
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
stack_v2_sparse_classes_30k_train_014441
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
8a6954928acb0961ec3b65d7b7882305c0e617cf
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.list = vec2d self.cur = 0 self.iter = iter(vec2d[0]) if len(vec2d) else iter(vec2d) def next(self): """:rtype: int""" while True: t...
the_stack_v2_python_sparse
flatten_2d_vector/flatten.py
yinxx/leetcode
train
0
873570f47c53dd46e7146554863e49d89deee314
[ "super().__init__()\nself.checkpoint_file = checkpoint_dir / 'checkpoint.tf_model'\nself.best_metrics_so_far: Dict[Text, Any] = {}", "if self._does_model_improve(logs):\n logger.debug(f'Creating model checkpoint at epoch={epoch + 1} ...')\n self.model.save_weights(self.checkpoint_file, overwrite=True, save_...
<|body_start_0|> super().__init__() self.checkpoint_file = checkpoint_dir / 'checkpoint.tf_model' self.best_metrics_so_far: Dict[Text, Any] = {} <|end_body_0|> <|body_start_1|> if self._does_model_improve(logs): logger.debug(f'Creating model checkpoint at epoch={epoch + 1} ....
Callback for saving intermediate model checkpoints.
RasaModelCheckpoint
[ "LicenseRef-scancode-generic-cla", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RasaModelCheckpoint: """Callback for saving intermediate model checkpoints.""" def __init__(self, checkpoint_dir: Path) -> None: """Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.""" <|body_0|> def on_epoch_end(self, epoch: int, logs: O...
stack_v2_sparse_classes_36k_train_026142
4,036
permissive
[ { "docstring": "Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.", "name": "__init__", "signature": "def __init__(self, checkpoint_dir: Path) -> None" }, { "docstring": "Save the model on epoch end if the model has improved. Args: epoch: The current epoch. logs:...
3
null
Implement the Python class `RasaModelCheckpoint` described below. Class description: Callback for saving intermediate model checkpoints. Method signatures and docstrings: - def __init__(self, checkpoint_dir: Path) -> None: Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to. - def on_epo...
Implement the Python class `RasaModelCheckpoint` described below. Class description: Callback for saving intermediate model checkpoints. Method signatures and docstrings: - def __init__(self, checkpoint_dir: Path) -> None: Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to. - def on_epo...
50857610bdf0c26dc61f3203a6cbb4bcf193768c
<|skeleton|> class RasaModelCheckpoint: """Callback for saving intermediate model checkpoints.""" def __init__(self, checkpoint_dir: Path) -> None: """Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.""" <|body_0|> def on_epoch_end(self, epoch: int, logs: O...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RasaModelCheckpoint: """Callback for saving intermediate model checkpoints.""" def __init__(self, checkpoint_dir: Path) -> None: """Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.""" super().__init__() self.checkpoint_file = checkpoint_dir / 'che...
the_stack_v2_python_sparse
rasa/utils/tensorflow/callback.py
RasaHQ/rasa
train
13,167
9c91186c1338ed6652693e36961593fc788b37ba
[ "departments = Service.objects.filter(status=1, parent_id=0)\nserializer = ServiceSerializer(departments, many=True)\nreturn Response({'status': True, 'message': '成功', 'data': serializer.data})", "request.data['parent_id'] = 0\nserializer = ServiceSerializer(data=request.data)\nif not serializer.is_valid():\n ...
<|body_start_0|> departments = Service.objects.filter(status=1, parent_id=0) serializer = ServiceSerializer(departments, many=True) return Response({'status': True, 'message': '成功', 'data': serializer.data}) <|end_body_0|> <|body_start_1|> request.data['parent_id'] = 0 serialize...
查询所有dubbo接口部门提供方
DepartmentList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepartmentList: """查询所有dubbo接口部门提供方""" def get(self, request): """返回所有dubbo接口部门提供方""" <|body_0|> def post(self, request): """新增一个部门""" <|body_1|> <|end_skeleton|> <|body_start_0|> departments = Service.objects.filter(status=1, parent_id=0) ...
stack_v2_sparse_classes_36k_train_026143
2,513
no_license
[ { "docstring": "返回所有dubbo接口部门提供方", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增一个部门", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_008498
Implement the Python class `DepartmentList` described below. Class description: 查询所有dubbo接口部门提供方 Method signatures and docstrings: - def get(self, request): 返回所有dubbo接口部门提供方 - def post(self, request): 新增一个部门
Implement the Python class `DepartmentList` described below. Class description: 查询所有dubbo接口部门提供方 Method signatures and docstrings: - def get(self, request): 返回所有dubbo接口部门提供方 - def post(self, request): 新增一个部门 <|skeleton|> class DepartmentList: """查询所有dubbo接口部门提供方""" def get(self, request): """返回所有dub...
1621ee90681a7796da7ad7173cc2a9b67494ed03
<|skeleton|> class DepartmentList: """查询所有dubbo接口部门提供方""" def get(self, request): """返回所有dubbo接口部门提供方""" <|body_0|> def post(self, request): """新增一个部门""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepartmentList: """查询所有dubbo接口部门提供方""" def get(self, request): """返回所有dubbo接口部门提供方""" departments = Service.objects.filter(status=1, parent_id=0) serializer = ServiceSerializer(departments, many=True) return Response({'status': True, 'message': '成功', 'data': serializer.dat...
the_stack_v2_python_sparse
at_server-master/dubbo/views_department.py
xiaominwanglast/reactjs
train
1
8e43691036f9dcded320b1e2f45e9f7698c44438
[ "super().__init__(model_dir, *args, **kwargs)\nself.model_dir: str = model_dir\nself.sequence_length = kwargs.pop('sequence_length', 512)\nself.tokenizer = AutoTokenizer.from_pretrained(model_dir, use_fast=True)", "text = data\noutput = self.tokenizer([text], return_tensors='pt')\nreturn {'text': text, 'input_ids...
<|body_start_0|> super().__init__(model_dir, *args, **kwargs) self.model_dir: str = model_dir self.sequence_length = kwargs.pop('sequence_length', 512) self.tokenizer = AutoTokenizer.from_pretrained(model_dir, use_fast=True) <|end_body_0|> <|body_start_1|> text = data ou...
The relation extraction preprocessor used in normal RE task.
RelationExtractionPreprocessor
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelationExtractionPreprocessor: """The relation extraction preprocessor used in normal RE task.""" def __init__(self, model_dir: str, *args, **kwargs): """preprocess the data Args: model_dir (str): model path""" <|body_0|> def __call__(self, data: str) -> Dict[str, Any]:...
stack_v2_sparse_classes_36k_train_026144
1,650
permissive
[ { "docstring": "preprocess the data Args: model_dir (str): model path", "name": "__init__", "signature": "def __init__(self, model_dir: str, *args, **kwargs)" }, { "docstring": "process the raw input data Args: data (str): a sentence Example: 'you are so handsome.' Returns: Dict[str, Any]: the p...
2
stack_v2_sparse_classes_30k_train_006287
Implement the Python class `RelationExtractionPreprocessor` described below. Class description: The relation extraction preprocessor used in normal RE task. Method signatures and docstrings: - def __init__(self, model_dir: str, *args, **kwargs): preprocess the data Args: model_dir (str): model path - def __call__(sel...
Implement the Python class `RelationExtractionPreprocessor` described below. Class description: The relation extraction preprocessor used in normal RE task. Method signatures and docstrings: - def __init__(self, model_dir: str, *args, **kwargs): preprocess the data Args: model_dir (str): model path - def __call__(sel...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class RelationExtractionPreprocessor: """The relation extraction preprocessor used in normal RE task.""" def __init__(self, model_dir: str, *args, **kwargs): """preprocess the data Args: model_dir (str): model path""" <|body_0|> def __call__(self, data: str) -> Dict[str, Any]:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelationExtractionPreprocessor: """The relation extraction preprocessor used in normal RE task.""" def __init__(self, model_dir: str, *args, **kwargs): """preprocess the data Args: model_dir (str): model path""" super().__init__(model_dir, *args, **kwargs) self.model_dir: str = mo...
the_stack_v2_python_sparse
ai/modelscope/modelscope/preprocessors/nlp/relation_extraction_preprocessor.py
alldatacenter/alldata
train
774
a18dced4b99aec0b86db3fd353198a86a4582dcf
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsAppHealthDevicePerformance()", "from .entity import Entity\nfrom .user_experience_analytics_health_state import UserExperienceAnalyticsHealthState\nfrom .entity import Entity\nfrom .user_experience_analytics_heal...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsAppHealthDevicePerformance() <|end_body_0|> <|body_start_1|> from .entity import Entity from .user_experience_analytics_health_state import UserExperienceAnalytics...
The user experience analytics device performance entity contains device performance details.
UserExperienceAnalyticsAppHealthDevicePerformance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsAppHealthDevicePerformance: """The user experience analytics device performance entity contains device performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthDevicePerformance: """Cre...
stack_v2_sparse_classes_36k_train_026145
6,373
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: UserExperienceAnalyticsAppHealthDevicePerformance", "name": "create_from_discriminator_value", "signature": ...
3
null
Implement the Python class `UserExperienceAnalyticsAppHealthDevicePerformance` described below. Class description: The user experience analytics device performance entity contains device performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) ...
Implement the Python class `UserExperienceAnalyticsAppHealthDevicePerformance` described below. Class description: The user experience analytics device performance entity contains device performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsAppHealthDevicePerformance: """The user experience analytics device performance entity contains device performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthDevicePerformance: """Cre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsAppHealthDevicePerformance: """The user experience analytics device performance entity contains device performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsAppHealthDevicePerformance: """Creates a new in...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_app_health_device_performance.py
microsoftgraph/msgraph-sdk-python
train
135
3e4df263d8590c3e383f063d4a4d066555a3cb44
[ "num_nodes = connectivity_matrix.shape[0]\nexc_mass_params = self._prepare_mass_params(exc_mass_params, num_nodes)\ninh_mass_params = self._prepare_mass_params(inh_mass_params, num_nodes)\nexc_lin_nonlin_transfer_function_filename = self._prepare_mass_params(exc_lin_nonlin_transfer_function_filename, num_nodes, nat...
<|body_start_0|> num_nodes = connectivity_matrix.shape[0] exc_mass_params = self._prepare_mass_params(exc_mass_params, num_nodes) inh_mass_params = self._prepare_mass_params(inh_mass_params, num_nodes) exc_lin_nonlin_transfer_function_filename = self._prepare_mass_params(exc_lin_nonlin_t...
Whole brain network of adaptive exponential integrate-and-fire mean-field excitatory and inhibitory nodes.
ALNNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ALNNetwork: """Whole brain network of adaptive exponential integrate-and-fire mean-field excitatory and inhibitory nodes.""" def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transf...
stack_v2_sparse_classes_36k_train_026146
35,756
permissive
[ { "docstring": ":param connectivity_matrix: connectivity matrix for coupling between nodes, defined as [from, to] :type connectivity_matrix: np.ndarray :param delay_matrix: delay matrix between nodes, if None, delays are all zeros, in ms, defined as [from, to] :type delay_matrix: np.ndarray|None :param exc_mass...
2
stack_v2_sparse_classes_30k_train_005987
Implement the Python class `ALNNetwork` described below. Class description: Whole brain network of adaptive exponential integrate-and-fire mean-field excitatory and inhibitory nodes. Method signatures and docstrings: - def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, e...
Implement the Python class `ALNNetwork` described below. Class description: Whole brain network of adaptive exponential integrate-and-fire mean-field excitatory and inhibitory nodes. Method signatures and docstrings: - def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, e...
bec8fbc5ffa7c3b45a266e21549cf392a6263136
<|skeleton|> class ALNNetwork: """Whole brain network of adaptive exponential integrate-and-fire mean-field excitatory and inhibitory nodes.""" def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ALNNetwork: """Whole brain network of adaptive exponential integrate-and-fire mean-field excitatory and inhibitory nodes.""" def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_f...
the_stack_v2_python_sparse
neurolib/models/multimodel/builder/aln.py
neurolib-dev/neurolib
train
363
23ca73cee025fb7658d3524a431659ca6d9d41af
[ "result = find_angle(10, 10)\nself.assertEqual(result, '45°')\nreturn", "result = find_angle(5, 5)\nself.assertEqual(result, '45°')\nreturn" ]
<|body_start_0|> result = find_angle(10, 10) self.assertEqual(result, '45°') return <|end_body_0|> <|body_start_1|> result = find_angle(5, 5) self.assertEqual(result, '45°') return <|end_body_1|>
Test angle MBC
TestFindAngle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFindAngle: """Test angle MBC""" def test_hackerrank_sample1(self): """Verify provided test case.""" <|body_0|> def test_hackerrank_sample2(self): """Verify provided test case.""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = find_ang...
stack_v2_sparse_classes_36k_train_026147
564
no_license
[ { "docstring": "Verify provided test case.", "name": "test_hackerrank_sample1", "signature": "def test_hackerrank_sample1(self)" }, { "docstring": "Verify provided test case.", "name": "test_hackerrank_sample2", "signature": "def test_hackerrank_sample2(self)" } ]
2
null
Implement the Python class `TestFindAngle` described below. Class description: Test angle MBC Method signatures and docstrings: - def test_hackerrank_sample1(self): Verify provided test case. - def test_hackerrank_sample2(self): Verify provided test case.
Implement the Python class `TestFindAngle` described below. Class description: Test angle MBC Method signatures and docstrings: - def test_hackerrank_sample1(self): Verify provided test case. - def test_hackerrank_sample2(self): Verify provided test case. <|skeleton|> class TestFindAngle: """Test angle MBC""" ...
fcf3755b62fe0644af763875e3a00be962941a6d
<|skeleton|> class TestFindAngle: """Test angle MBC""" def test_hackerrank_sample1(self): """Verify provided test case.""" <|body_0|> def test_hackerrank_sample2(self): """Verify provided test case.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFindAngle: """Test angle MBC""" def test_hackerrank_sample1(self): """Verify provided test case.""" result = find_angle(10, 10) self.assertEqual(result, '45°') return def test_hackerrank_sample2(self): """Verify provided test case.""" result = find...
the_stack_v2_python_sparse
python3/find_angle/test_find_angle.py
ayazhemani/hackerrank-py
train
0
ba169b4c35fcb6fbd2b53ad4fc4a629926b55d36
[ "if self.state_model.op_state in [DevState.UNKNOWN, DevState.DISABLE]:\n log_msg = f'ObsReset() is not allowed in {self.state_model.op_state}'\n tango.Except.throw_exception(log_msg, 'Failed to invoke ObsReset command on MccsSubarrayLeafNode.', 'mccssubarrayleafnode.ObsReset()', tango.ErrSeverity.ERR)\nself.t...
<|body_start_0|> if self.state_model.op_state in [DevState.UNKNOWN, DevState.DISABLE]: log_msg = f'ObsReset() is not allowed in {self.state_model.op_state}' tango.Except.throw_exception(log_msg, 'Failed to invoke ObsReset command on MccsSubarrayLeafNode.', 'mccssubarrayleafnode.ObsReset(...
A class for MccsSubarrayLeafNode's ObsReset() command. Command to reset the MCCS subarray and bring it to its RESETTING state.
ObsReset
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObsReset: """A class for MccsSubarrayLeafNode's ObsReset() command. Command to reset the MCCS subarray and bring it to its RESETTING state.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed...
stack_v2_sparse_classes_36k_train_026148
4,408
permissive
[ { "docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state", "name": "check_allowed", "signature": ...
3
null
Implement the Python class `ObsReset` described below. Class description: A class for MccsSubarrayLeafNode's ObsReset() command. Command to reset the MCCS subarray and bring it to its RESETTING state. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in curr...
Implement the Python class `ObsReset` described below. Class description: A class for MccsSubarrayLeafNode's ObsReset() command. Command to reset the MCCS subarray and bring it to its RESETTING state. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in curr...
7ee65a9c8dada9b28893144b372a398bd0646195
<|skeleton|> class ObsReset: """A class for MccsSubarrayLeafNode's ObsReset() command. Command to reset the MCCS subarray and bring it to its RESETTING state.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObsReset: """A class for MccsSubarrayLeafNode's ObsReset() command. Command to reset the MCCS subarray and bring it to its RESETTING state.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in...
the_stack_v2_python_sparse
temp_src/ska_tmc_mccssubarrayleafnode_low/obsreset_command.py
ska-telescope/tmc-prototype
train
4
fd04ed736e9a1f3f73c4b833d4151ff0f73fcf89
[ "time.sleep(2)\nRegistPage(web_page).regist(data['username'], data['code'], data['password'])\nlogging.info('开始断言')\ntime.sleep(3)\ntry:\n assert RegistPage(web_page).login_success() == data['check']\n assert 1 == 1\n logging.info('登录成功')\nexcept:\n print('登录失败')\n common.save_screenShot(web_page, mo...
<|body_start_0|> time.sleep(2) RegistPage(web_page).regist(data['username'], data['code'], data['password']) logging.info('开始断言') time.sleep(3) try: assert RegistPage(web_page).login_success() == data['check'] assert 1 == 1 logging.info('登录成功')...
TestRegist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRegist: def test_regist_success(self, data, web_page): """成功登录""" <|body_0|> def test_user_phone_err(self, data, web_page): """手机号码错误""" <|body_1|> def test_user_code_err(self, data, web_page): """验证码错误""" <|body_2|> def test_use...
stack_v2_sparse_classes_36k_train_026149
3,500
no_license
[ { "docstring": "成功登录", "name": "test_regist_success", "signature": "def test_regist_success(self, data, web_page)" }, { "docstring": "手机号码错误", "name": "test_user_phone_err", "signature": "def test_user_phone_err(self, data, web_page)" }, { "docstring": "验证码错误", "name": "test_...
5
null
Implement the Python class `TestRegist` described below. Class description: Implement the TestRegist class. Method signatures and docstrings: - def test_regist_success(self, data, web_page): 成功登录 - def test_user_phone_err(self, data, web_page): 手机号码错误 - def test_user_code_err(self, data, web_page): 验证码错误 - def test_u...
Implement the Python class `TestRegist` described below. Class description: Implement the TestRegist class. Method signatures and docstrings: - def test_regist_success(self, data, web_page): 成功登录 - def test_user_phone_err(self, data, web_page): 手机号码错误 - def test_user_code_err(self, data, web_page): 验证码错误 - def test_u...
b262c13e55a6e9eae1d4fa11d50b71814028261c
<|skeleton|> class TestRegist: def test_regist_success(self, data, web_page): """成功登录""" <|body_0|> def test_user_phone_err(self, data, web_page): """手机号码错误""" <|body_1|> def test_user_code_err(self, data, web_page): """验证码错误""" <|body_2|> def test_use...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestRegist: def test_regist_success(self, data, web_page): """成功登录""" time.sleep(2) RegistPage(web_page).regist(data['username'], data['code'], data['password']) logging.info('开始断言') time.sleep(3) try: assert RegistPage(web_page).login_success() == d...
the_stack_v2_python_sparse
TestCase/test_C_web/test_regist.py
xjx985426946/Test_UI
train
0
ea9a9fa10e4b7a94a57fe2e8f0ea4cd47c546d8c
[ "follow = 0\nfor byte in data:\n if not byte & 128:\n if follow:\n return False\n elif byte & 192 == 128:\n if not follow:\n return False\n follow -= 1\n elif byte & 224 == 192:\n if follow:\n return False\n follow = 1\n elif byte & 240...
<|body_start_0|> follow = 0 for byte in data: if not byte & 128: if follow: return False elif byte & 192 == 128: if not follow: return False follow -= 1 elif byte & 224 == 192: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def rewrite(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> def rewrite2(self, data): """:type data: List[int] :rtype: bool""" <|bod...
stack_v2_sparse_classes_36k_train_026150
6,087
no_license
[ { "docstring": ":type data: List[int] :rtype: bool", "name": "validUtf8", "signature": "def validUtf8(self, data)" }, { "docstring": ":type data: List[int] :rtype: bool", "name": "rewrite", "signature": "def rewrite(self, data)" }, { "docstring": ":type data: List[int] :rtype: bo...
3
stack_v2_sparse_classes_30k_train_006082
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def rewrite(self, data): :type data: List[int] :rtype: bool - def rewrite2(self, data): :type data: List[int] :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def rewrite(self, data): :type data: List[int] :rtype: bool - def rewrite2(self, data): :type data: List[int] :rty...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def rewrite(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> def rewrite2(self, data): """:type data: List[int] :rtype: bool""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" follow = 0 for byte in data: if not byte & 128: if follow: return False elif byte & 192 == 128: if not follow: r...
the_stack_v2_python_sparse
co_fb/393_UTF-8_Validation.py
vsdrun/lc_public
train
6
3ba98098466b472909ac637a0b4118f66025cc13
[ "if not self._saved_mail_backend:\n self._saved_mail_backend = smtp.EmailBackend(SMTP_HOST, SMTP_PORT)\nreturn self._saved_mail_backend", "emails = params\nif not emails:\n log.error('Invalid email address from params: %s' % params)\n raise gen.Return()\nsubject = 'Warning! %s has an alert!' % path\nbody...
<|body_start_0|> if not self._saved_mail_backend: self._saved_mail_backend = smtp.EmailBackend(SMTP_HOST, SMTP_PORT) return self._saved_mail_backend <|end_body_0|> <|body_start_1|> emails = params if not emails: log.error('Invalid email address from params: %s' %...
Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /services/foo/min_1: alerter: email: you@home....
EmailAlerter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailAlerter: """Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /servi...
stack_v2_sparse_classes_36k_train_026151
4,661
no_license
[ { "docstring": "Returns a single EmailBackend object every time its called", "name": "_mail_backend", "signature": "def _mail_backend(self)" }, { "docstring": "Send an email alert. args: path: String of the path that is being alerted. state: String of the monitor.states for given path. message: ...
2
stack_v2_sparse_classes_30k_train_006965
Implement the Python class `EmailAlerter` described below. Class description: Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configu...
Implement the Python class `EmailAlerter` described below. Class description: Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configu...
d33720eeec274396435896ed4fb1c71025344fc1
<|skeleton|> class EmailAlerter: """Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /servi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailAlerter: """Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /services/foo/min_1...
the_stack_v2_python_sparse
zk_monitor/alerts/email.py
Nextdoor/zkmonitor
train
4
964d7983595e9259e4dd682969d10c67599b2ad7
[ "self.transitions_C = transitions_C\nself.transitions_D = transitions_D\nself.emission_probabilities = emission_probabilities\nself.state = initial_state\nself._cache_C = dict()\nself._cache_D = dict()\nself._cache_deterministic_transitions()\nself._random = None", "for state in range(len(self.transitions_C)):\n ...
<|body_start_0|> self.transitions_C = transitions_C self.transitions_D = transitions_D self.emission_probabilities = emission_probabilities self.state = initial_state self._cache_C = dict() self._cache_D = dict() self._cache_deterministic_transitions() sel...
Implementation of a basic Hidden Markov Model. We assume that the transition matrix is conditioned on the opponent's last action, so there are two transition matrices. Emission distributions are stored as Bernoulli probabilities for each state. This is essentially a stochastic FSM. https://en.wikipedia.org/wiki/Hidden_...
SimpleHMM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleHMM: """Implementation of a basic Hidden Markov Model. We assume that the transition matrix is conditioned on the opponent's last action, so there are two transition matrices. Emission distributions are stored as Bernoulli probabilities for each state. This is essentially a stochastic FSM. ...
stack_v2_sparse_classes_36k_train_026152
16,774
permissive
[ { "docstring": "Params ------ transitions_C and transitions_D are square stochastic matrices: lists of lists with all values in [0, 1] and rows that sum to 1. emission_probabilities is a vector of values in [0, 1] initial_state is an element of range(0, len(emission_probabilities))", "name": "__init__", ...
5
stack_v2_sparse_classes_30k_train_018582
Implement the Python class `SimpleHMM` described below. Class description: Implementation of a basic Hidden Markov Model. We assume that the transition matrix is conditioned on the opponent's last action, so there are two transition matrices. Emission distributions are stored as Bernoulli probabilities for each state....
Implement the Python class `SimpleHMM` described below. Class description: Implementation of a basic Hidden Markov Model. We assume that the transition matrix is conditioned on the opponent's last action, so there are two transition matrices. Emission distributions are stored as Bernoulli probabilities for each state....
fa748627cd4f0333bb2dbfcb1454372a78a9098a
<|skeleton|> class SimpleHMM: """Implementation of a basic Hidden Markov Model. We assume that the transition matrix is conditioned on the opponent's last action, so there are two transition matrices. Emission distributions are stored as Bernoulli probabilities for each state. This is essentially a stochastic FSM. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleHMM: """Implementation of a basic Hidden Markov Model. We assume that the transition matrix is conditioned on the opponent's last action, so there are two transition matrices. Emission distributions are stored as Bernoulli probabilities for each state. This is essentially a stochastic FSM. https://en.wi...
the_stack_v2_python_sparse
axelrod/strategies/hmm.py
Axelrod-Python/Axelrod
train
673
1aeef0fbf8c657de5582c2fe43b9d8806e6909f1
[ "d = {'resourceType': 'Intervention'}\nfor attr in ('name', 'description', 'card_html', 'link_label', 'status_text', 'public_access', 'display_rank'):\n if getattr(self, attr, None) is not None:\n d[attr] = getattr(self, attr)\nreturn d", "if not 'name' in data:\n raise ValueError(\"required 'name' f...
<|body_start_0|> d = {'resourceType': 'Intervention'} for attr in ('name', 'description', 'card_html', 'link_label', 'status_text', 'public_access', 'display_rank'): if getattr(self, attr, None) is not None: d[attr] = getattr(self, attr) return d <|end_body_0|> <|bod...
Intervention
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Intervention: def as_json(self): """Returns the 'safe to export' portions of an intervention The client_id and link_url are non-portable between systems. The id is also independent - return the rest of the not null fields as a simple json dict.""" <|body_0|> def from_json(cl...
stack_v2_sparse_classes_36k_train_026153
10,034
permissive
[ { "docstring": "Returns the 'safe to export' portions of an intervention The client_id and link_url are non-portable between systems. The id is also independent - return the rest of the not null fields as a simple json dict.", "name": "as_json", "signature": "def as_json(self)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_014767
Implement the Python class `Intervention` described below. Class description: Implement the Intervention class. Method signatures and docstrings: - def as_json(self): Returns the 'safe to export' portions of an intervention The client_id and link_url are non-portable between systems. The id is also independent - retu...
Implement the Python class `Intervention` described below. Class description: Implement the Intervention class. Method signatures and docstrings: - def as_json(self): Returns the 'safe to export' portions of an intervention The client_id and link_url are non-portable between systems. The id is also independent - retu...
c756147b24cbc6988ac61c601491e4604074c3a7
<|skeleton|> class Intervention: def as_json(self): """Returns the 'safe to export' portions of an intervention The client_id and link_url are non-portable between systems. The id is also independent - return the rest of the not null fields as a simple json dict.""" <|body_0|> def from_json(cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Intervention: def as_json(self): """Returns the 'safe to export' portions of an intervention The client_id and link_url are non-portable between systems. The id is also independent - return the rest of the not null fields as a simple json dict.""" d = {'resourceType': 'Intervention'} f...
the_stack_v2_python_sparse
portal/models/intervention.py
jmillr/true_nth_usa_portal
train
0
3c55a0f73a5023cf7cbd2e3af41f1532948a4068
[ "if not root:\n return []\nres = [root.val]\nlevel = [root]\nwhile level:\n tem = []\n for l in level:\n if l:\n for child in [l.left, l.right]:\n tem.append(child)\n res.extend((i.val if i else None for i in tem))\n level = tem\nreturn res", "if not data:\n retu...
<|body_start_0|> if not root: return [] res = [root.val] level = [root] while level: tem = [] for l in level: if l: for child in [l.left, l.right]: tem.append(child) res.extend((i....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_026154
1,788
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003612
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:...
409d7db811d41dbcc7ce8cda82b77eff35585657
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] res = [root.val] level = [root] while level: tem = [] for l in level: if l: ...
the_stack_v2_python_sparse
Serialize and Deserialize Binary Tree.py
Windsooon/LeetCode
train
1
532d47c088fffdb36565d40832b6f2489bacd8f1
[ "super(DPSR, self).__init__()\nself.res = res\nself.sig = sig\nself.dim = len(res)\nself.denom = np.prod(res)\nG = spec_gaussian_filter(res=res, sig=sig).float()\nself.omega = fftfreqs(res, dtype=torch.float32)\nself.scale = scale\nself.shift = shift\nself.register_buffer('G', G)", "assert V.shape == N.shape\nras...
<|body_start_0|> super(DPSR, self).__init__() self.res = res self.sig = sig self.dim = len(res) self.denom = np.prod(res) G = spec_gaussian_filter(res=res, sig=sig).float() self.omega = fftfreqs(res, dtype=torch.float32) self.scale = scale self.shi...
DPSR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DPSR: def __init__(self, res, sig=10, scale=True, shift=True): """:param res: tuple of output field resolution. eg., (128,128) :param sig: degree of gaussian smoothing""" <|body_0|> def forward(self, V, N): """:param V: (batch, nv, 2 or 3) tensor for point cloud coor...
stack_v2_sparse_classes_36k_train_026155
2,955
permissive
[ { "docstring": ":param res: tuple of output field resolution. eg., (128,128) :param sig: degree of gaussian smoothing", "name": "__init__", "signature": "def __init__(self, res, sig=10, scale=True, shift=True)" }, { "docstring": ":param V: (batch, nv, 2 or 3) tensor for point cloud coordinates :...
2
stack_v2_sparse_classes_30k_train_016469
Implement the Python class `DPSR` described below. Class description: Implement the DPSR class. Method signatures and docstrings: - def __init__(self, res, sig=10, scale=True, shift=True): :param res: tuple of output field resolution. eg., (128,128) :param sig: degree of gaussian smoothing - def forward(self, V, N): ...
Implement the Python class `DPSR` described below. Class description: Implement the DPSR class. Method signatures and docstrings: - def __init__(self, res, sig=10, scale=True, shift=True): :param res: tuple of output field resolution. eg., (128,128) :param sig: degree of gaussian smoothing - def forward(self, V, N): ...
54c2783479c9514190af956b6e9dac25221a64c1
<|skeleton|> class DPSR: def __init__(self, res, sig=10, scale=True, shift=True): """:param res: tuple of output field resolution. eg., (128,128) :param sig: degree of gaussian smoothing""" <|body_0|> def forward(self, V, N): """:param V: (batch, nv, 2 or 3) tensor for point cloud coor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DPSR: def __init__(self, res, sig=10, scale=True, shift=True): """:param res: tuple of output field resolution. eg., (128,128) :param sig: degree of gaussian smoothing""" super(DPSR, self).__init__() self.res = res self.sig = sig self.dim = len(res) self.denom =...
the_stack_v2_python_sparse
src/dpsr.py
liruihui/shape_as_points
train
0
db670d2e7a76904bab5e226b1e3e4e92db484354
[ "self.X = X\nself.U_int = U[0]\nself.U_ext = U[1]\nself.P = P if P is not None else uc.UncertaintySet()", "u_max = self.U_ext.V[np.argmax([la.norm(u) for u in self.U_ext.V])]\nx_max = self.X.V[np.argmax([la.norm(x) for x in self.X.V])]\nR = np.eye(0)\nr = np.array([])\nj = 0\nfor i in range(len(self.P.sets)):\n ...
<|body_start_0|> self.X = X self.U_int = U[0] self.U_ext = U[1] self.P = P if P is not None else uc.UncertaintySet() <|end_body_0|> <|body_start_1|> u_max = self.U_ext.V[np.argmax([la.norm(u) for u in self.U_ext.V])] x_max = self.X.V[np.argmax([la.norm(x) for x in self.X...
Control problem specifications.
Specifications
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Specifications: """Control problem specifications.""" def __init__(self, X, U, P=None): """Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\in U_ext \\setminus U_int. Both U_int and U_ext are ass...
stack_v2_sparse_classes_36k_train_026156
2,232
no_license
[ { "docstring": "Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\\\in U_ext \\\\setminus U_int. Both U_int and U_ext are assumed to be Polytope type. P : UncertaintySet, optional Set of uncertainties. If ommitted, an empty ...
2
stack_v2_sparse_classes_30k_train_005963
Implement the Python class `Specifications` described below. Class description: Control problem specifications. Method signatures and docstrings: - def __init__(self, X, U, P=None): Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are ...
Implement the Python class `Specifications` described below. Class description: Control problem specifications. Method signatures and docstrings: - def __init__(self, X, U, P=None): Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are ...
858f2b673bedbec39fca9bdc9c825a3c2fefe513
<|skeleton|> class Specifications: """Control problem specifications.""" def __init__(self, X, U, P=None): """Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\in U_ext \\setminus U_int. Both U_int and U_ext are ass...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Specifications: """Control problem specifications.""" def __init__(self, X, U, P=None): """Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\in U_ext \\setminus U_int. Both U_int and U_ext are assumed to be Po...
the_stack_v2_python_sparse
lib/specifications.py
roguextech/DanyloMalyuta-explicit_hybrid_mpc
train
0
7b3b414f98866b1366f26d9fa557e1e11a2699dd
[ "self.cipher = cipher\nself.dukpt = dukpt\nself.tags = tags", "if dictionary is None:\n return None\ncipher = dictionary.get('cipher')\ntags = None\nif dictionary.get('tags') != None:\n tags = list()\n for structure in dictionary.get('tags'):\n tags.append(mundiapi.models.create_emv_data_tlv_decry...
<|body_start_0|> self.cipher = cipher self.dukpt = dukpt self.tags = tags <|end_body_0|> <|body_start_1|> if dictionary is None: return None cipher = dictionary.get('cipher') tags = None if dictionary.get('tags') != None: tags = list() ...
Implementation of the 'CreateEmvDataDecryptRequest' model. TODO: type model description here. Attributes: cipher (string): Emv Decrypt cipher type dukpt (CreateEmvDataDukptDecryptRequest): TODO: type description here. tags (list of CreateEmvDataTlvDecryptRequest): Encrypted tags list
CreateEmvDataDecryptRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateEmvDataDecryptRequest: """Implementation of the 'CreateEmvDataDecryptRequest' model. TODO: type model description here. Attributes: cipher (string): Emv Decrypt cipher type dukpt (CreateEmvDataDukptDecryptRequest): TODO: type description here. tags (list of CreateEmvDataTlvDecryptRequest): ...
stack_v2_sparse_classes_36k_train_026157
2,397
permissive
[ { "docstring": "Constructor for the CreateEmvDataDecryptRequest class", "name": "__init__", "signature": "def __init__(self, cipher=None, tags=None, dukpt=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of t...
2
stack_v2_sparse_classes_30k_train_015940
Implement the Python class `CreateEmvDataDecryptRequest` described below. Class description: Implementation of the 'CreateEmvDataDecryptRequest' model. TODO: type model description here. Attributes: cipher (string): Emv Decrypt cipher type dukpt (CreateEmvDataDukptDecryptRequest): TODO: type description here. tags (li...
Implement the Python class `CreateEmvDataDecryptRequest` described below. Class description: Implementation of the 'CreateEmvDataDecryptRequest' model. TODO: type model description here. Attributes: cipher (string): Emv Decrypt cipher type dukpt (CreateEmvDataDukptDecryptRequest): TODO: type description here. tags (li...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class CreateEmvDataDecryptRequest: """Implementation of the 'CreateEmvDataDecryptRequest' model. TODO: type model description here. Attributes: cipher (string): Emv Decrypt cipher type dukpt (CreateEmvDataDukptDecryptRequest): TODO: type description here. tags (list of CreateEmvDataTlvDecryptRequest): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateEmvDataDecryptRequest: """Implementation of the 'CreateEmvDataDecryptRequest' model. TODO: type model description here. Attributes: cipher (string): Emv Decrypt cipher type dukpt (CreateEmvDataDukptDecryptRequest): TODO: type description here. tags (list of CreateEmvDataTlvDecryptRequest): Encrypted tag...
the_stack_v2_python_sparse
mundiapi/models/create_emv_data_decrypt_request.py
mundipagg/MundiAPI-PYTHON
train
10
73fd9bf479cc61b02d821ad345a11a8a49b5f166
[ "cmd = 'fleetrun dist_queuedataset1.py'\npro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nout, err = pro.communicate()\nprint(out)\npro.wait()\npro.returncode == 0", "cmd = 'fleetrun dist_queuedataset2.py'\npro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, std...
<|body_start_0|> cmd = 'fleetrun dist_queuedataset1.py' pro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = pro.communicate() print(out) pro.wait() pro.returncode == 0 <|end_body_0|> <|body_start_1|> cmd = 'fleetrun ...
TestDistQueueDataSetApi
TestDistQueueDataSetApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDistQueueDataSetApi: """TestDistQueueDataSetApi""" def test_queuedataset1(self): """test_queuedataset1""" <|body_0|> def test_queuedataset2(self): """test_queuedataset2""" <|body_1|> <|end_skeleton|> <|body_start_0|> cmd = 'fleetrun dist_que...
stack_v2_sparse_classes_36k_train_026158
881
no_license
[ { "docstring": "test_queuedataset1", "name": "test_queuedataset1", "signature": "def test_queuedataset1(self)" }, { "docstring": "test_queuedataset2", "name": "test_queuedataset2", "signature": "def test_queuedataset2(self)" } ]
2
stack_v2_sparse_classes_30k_train_006488
Implement the Python class `TestDistQueueDataSetApi` described below. Class description: TestDistQueueDataSetApi Method signatures and docstrings: - def test_queuedataset1(self): test_queuedataset1 - def test_queuedataset2(self): test_queuedataset2
Implement the Python class `TestDistQueueDataSetApi` described below. Class description: TestDistQueueDataSetApi Method signatures and docstrings: - def test_queuedataset1(self): test_queuedataset1 - def test_queuedataset2(self): test_queuedataset2 <|skeleton|> class TestDistQueueDataSetApi: """TestDistQueueData...
e3562ab40b574f06bba68df6895a055fa31a085d
<|skeleton|> class TestDistQueueDataSetApi: """TestDistQueueDataSetApi""" def test_queuedataset1(self): """test_queuedataset1""" <|body_0|> def test_queuedataset2(self): """test_queuedataset2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDistQueueDataSetApi: """TestDistQueueDataSetApi""" def test_queuedataset1(self): """test_queuedataset1""" cmd = 'fleetrun dist_queuedataset1.py' pro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = pro.communicate() ...
the_stack_v2_python_sparse
dist_cts/dist_fleet_pipeline/test_dist_fleet_queue_dataset.py
gentelyang/scripts
train
0
36fdcc5cd16aedc4ba3f9aefe11afcc6532b4dd0
[ "if os.path.exists(os.path.join(self.detectorModel, self.detectorModel + '.xml')):\n LOG.notice('Found detector model: %s' % os.path.join(self.detectorModel, self.detectorModel + '.xml'))\n return S_OK(os.path.join(self.detectorModel, self.detectorModel + '.xml'))\nelif os.path.exists(self.detectorModel + '.z...
<|body_start_0|> if os.path.exists(os.path.join(self.detectorModel, self.detectorModel + '.xml')): LOG.notice('Found detector model: %s' % os.path.join(self.detectorModel, self.detectorModel + '.xml')) return S_OK(os.path.join(self.detectorModel, self.detectorModel + '.xml')) eli...
mixin class for DD4hep functionality
DD4hepMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DD4hepMixin: """mixin class for DD4hep functionality""" def _getDetectorXML(self): """returns the path to the detector XML file Checks the Configuration System for the Path to DetectorModels or extracts the input sandbox detector xml files :returns: S_OK(PathToXMLFile), S_ERROR""" ...
stack_v2_sparse_classes_36k_train_026159
3,493
no_license
[ { "docstring": "returns the path to the detector XML file Checks the Configuration System for the Path to DetectorModels or extracts the input sandbox detector xml files :returns: S_OK(PathToXMLFile), S_ERROR", "name": "_getDetectorXML", "signature": "def _getDetectorXML(self)" }, { "docstring":...
3
null
Implement the Python class `DD4hepMixin` described below. Class description: mixin class for DD4hep functionality Method signatures and docstrings: - def _getDetectorXML(self): returns the path to the detector XML file Checks the Configuration System for the Path to DetectorModels or extracts the input sandbox detect...
Implement the Python class `DD4hepMixin` described below. Class description: mixin class for DD4hep functionality Method signatures and docstrings: - def _getDetectorXML(self): returns the path to the detector XML file Checks the Configuration System for the Path to DetectorModels or extracts the input sandbox detect...
9c366957fdd680a284df675c318989cb88e5959c
<|skeleton|> class DD4hepMixin: """mixin class for DD4hep functionality""" def _getDetectorXML(self): """returns the path to the detector XML file Checks the Configuration System for the Path to DetectorModels or extracts the input sandbox detector xml files :returns: S_OK(PathToXMLFile), S_ERROR""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DD4hepMixin: """mixin class for DD4hep functionality""" def _getDetectorXML(self): """returns the path to the detector XML file Checks the Configuration System for the Path to DetectorModels or extracts the input sandbox detector xml files :returns: S_OK(PathToXMLFile), S_ERROR""" if os.p...
the_stack_v2_python_sparse
Workflow/Utilities/DD4hepMixin.py
LCDsoft/ILCDIRAC
train
1
178858c1a430110d0cdb753b18ea9cf4685bd5a7
[ "self.time = 0\nself.IDToUser = {}\nself.IDToTweet = {}", "if userId not in self.IDToUser:\n self.IDToUser[userId] = User(userId)\nuser = self.IDToUser[userId]\nself.time += 1\nnewTweet = Tweet(tweetId, self.time, userId)\nuser.tweets.add(newTweet)\nfor followee in user.followees:\n followee.newsFeed.add(ne...
<|body_start_0|> self.time = 0 self.IDToUser = {} self.IDToTweet = {} <|end_body_0|> <|body_start_1|> if userId not in self.IDToUser: self.IDToUser[userId] = User(userId) user = self.IDToUser[userId] self.time += 1 newTweet = Tweet(tweetId, self.time,...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: None""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k_train_026160
3,616
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: None", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: None - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: None - def getNew...
1d8821da01c9c200732a6b7037b8631689e2f7e7
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: None""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.time = 0 self.IDToUser = {} self.IDToTweet = {} def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: None""" if userId not in ...
the_stack_v2_python_sparse
Leetcode0355.py
xiaojinghu/Leetcode
train
0
3a02966fa268a6b6572ea85fe61b4cd461866dc1
[ "RadianceMaterial.__init__(self, name, materialType='light', modifier='void')\nself.red = red\n'A positive value for the Red channel of the light'\nself.green = green\n'A positive value for the Green channel of the light'\nself.blue = blue\n'A positive value for the Blue channel of the light'", "__baseString = se...
<|body_start_0|> RadianceMaterial.__init__(self, name, materialType='light', modifier='void') self.red = red 'A positive value for the Red channel of the light' self.green = green 'A positive value for the Green channel of the light' self.blue = blue 'A positive v...
LightMaterial
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LightMaterial: def __init__(self, name, red=0, green=0, blue=0): """Create light material Attributes: name: Material name as a string. The name should not have whitespaces or special characters. red: A positive value for the Red channel of the light green: A positive value for the Green ...
stack_v2_sparse_classes_36k_train_026161
1,559
permissive
[ { "docstring": "Create light material Attributes: name: Material name as a string. The name should not have whitespaces or special characters. red: A positive value for the Red channel of the light green: A positive value for the Green channel of the light blue: A positive value for the Blue channel of the ligh...
2
null
Implement the Python class `LightMaterial` described below. Class description: Implement the LightMaterial class. Method signatures and docstrings: - def __init__(self, name, red=0, green=0, blue=0): Create light material Attributes: name: Material name as a string. The name should not have whitespaces or special cha...
Implement the Python class `LightMaterial` described below. Class description: Implement the LightMaterial class. Method signatures and docstrings: - def __init__(self, name, red=0, green=0, blue=0): Create light material Attributes: name: Material name as a string. The name should not have whitespaces or special cha...
983fccc934e5546082557f6c2d1f2d9e00eba332
<|skeleton|> class LightMaterial: def __init__(self, name, red=0, green=0, blue=0): """Create light material Attributes: name: Material name as a string. The name should not have whitespaces or special characters. red: A positive value for the Red channel of the light green: A positive value for the Green ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LightMaterial: def __init__(self, name, red=0, green=0, blue=0): """Create light material Attributes: name: Material name as a string. The name should not have whitespaces or special characters. red: A positive value for the Red channel of the light green: A positive value for the Green channel of the...
the_stack_v2_python_sparse
honeybee/radiance/material/light.py
ladybug-tools/honeybee-server
train
7
44330ff170aadd8d8b8b5c2c0fb7ece56cb69b39
[ "class dummy_manager(object):\n\n def communicator(self):\n return Communicate()\n\n def perspective(self):\n return MyPerspective()\nf = DroppableDataLoadWidget(None, guimanager=dummy_manager())\nself.mime_data = QtCore.QMimeData()\nself.testfile = 'testfile.txt'\nself.mime_data.setUrls([QtCore...
<|body_start_0|> class dummy_manager(object): def communicator(self): return Communicate() def perspective(self): return MyPerspective() f = DroppableDataLoadWidget(None, guimanager=dummy_manager()) self.mime_data = QtCore.QMimeData() ...
Test the DroppableDataLoadWidget GUI
DroppableDataLoadWidgetTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DroppableDataLoadWidgetTest: """Test the DroppableDataLoadWidget GUI""" def form(self, qapp): """Create/Destroy the DroppableDataLoadWidget""" <|body_0|> def testDragIsOK(self, form): """Test the item being dragged over the load widget""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_026162
2,643
permissive
[ { "docstring": "Create/Destroy the DroppableDataLoadWidget", "name": "form", "signature": "def form(self, qapp)" }, { "docstring": "Test the item being dragged over the load widget", "name": "testDragIsOK", "signature": "def testDragIsOK(self, form)" }, { "docstring": "Test what ...
3
null
Implement the Python class `DroppableDataLoadWidgetTest` described below. Class description: Test the DroppableDataLoadWidget GUI Method signatures and docstrings: - def form(self, qapp): Create/Destroy the DroppableDataLoadWidget - def testDragIsOK(self, form): Test the item being dragged over the load widget - def ...
Implement the Python class `DroppableDataLoadWidgetTest` described below. Class description: Test the DroppableDataLoadWidget GUI Method signatures and docstrings: - def form(self, qapp): Create/Destroy the DroppableDataLoadWidget - def testDragIsOK(self, form): Test the item being dragged over the load widget - def ...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class DroppableDataLoadWidgetTest: """Test the DroppableDataLoadWidget GUI""" def form(self, qapp): """Create/Destroy the DroppableDataLoadWidget""" <|body_0|> def testDragIsOK(self, form): """Test the item being dragged over the load widget""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DroppableDataLoadWidgetTest: """Test the DroppableDataLoadWidget GUI""" def form(self, qapp): """Create/Destroy the DroppableDataLoadWidget""" class dummy_manager(object): def communicator(self): return Communicate() def perspective(self): ...
the_stack_v2_python_sparse
src/sas/qtgui/MainWindow/UnitTesting/DroppableDataLoadWidgetTest.py
SasView/sasview
train
48
243b4a17e32fcf653187c6bc45f397e5bf1a89e6
[ "super(FlowData, self).__init__()\nself.filename_flow = 'trash can flow meter.xls'\nself.start_rowx = 2\nself.end_rowx = 17\nself.poly_order = 2\nself.trash_volume = 0.0776\nself.P = 100.0", "worksheet = xlrd.open_workbook(filename=self.filename_flow).sheet_by_index(0)\nself.corrected_reading = np.array(worksheet...
<|body_start_0|> super(FlowData, self).__init__() self.filename_flow = 'trash can flow meter.xls' self.start_rowx = 2 self.end_rowx = 17 self.poly_order = 2 self.trash_volume = 0.0776 self.P = 100.0 <|end_body_0|> <|body_start_1|> worksheet = xlrd.open_wo...
Class for handling flow rate and pressure drop data.
FlowData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowData: """Class for handling flow rate and pressure drop data.""" def __init__(self): """Sets default file name, start row, and end row.""" <|body_0|> def import_flow_data(self): """Imports data and stores it in numpy arrays.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_026163
7,912
no_license
[ { "docstring": "Sets default file name, start row, and end row.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Imports data and stores it in numpy arrays.", "name": "import_flow_data", "signature": "def import_flow_data(self)" } ]
2
stack_v2_sparse_classes_30k_train_005780
Implement the Python class `FlowData` described below. Class description: Class for handling flow rate and pressure drop data. Method signatures and docstrings: - def __init__(self): Sets default file name, start row, and end row. - def import_flow_data(self): Imports data and stores it in numpy arrays.
Implement the Python class `FlowData` described below. Class description: Class for handling flow rate and pressure drop data. Method signatures and docstrings: - def __init__(self): Sets default file name, start row, and end row. - def import_flow_data(self): Imports data and stores it in numpy arrays. <|skeleton|>...
d619b66b1f16557e06c94eee1c16d4ee2a9e896a
<|skeleton|> class FlowData: """Class for handling flow rate and pressure drop data.""" def __init__(self): """Sets default file name, start row, and end row.""" <|body_0|> def import_flow_data(self): """Imports data and stores it in numpy arrays.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlowData: """Class for handling flow rate and pressure drop data.""" def __init__(self): """Sets default file name, start row, and end row.""" super(FlowData, self).__init__() self.filename_flow = 'trash can flow meter.xls' self.start_rowx = 2 self.end_rowx = 17 ...
the_stack_v2_python_sparse
exp_data.py
hfateh/TE_Model-1
train
0
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_36k_train_026164
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
stack_v2_sparse_classes_30k_train_005591
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_36k
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
e944924f06776adce205340fdb95884385004029
[ "template = PartParameterTemplate.objects.create(name='My Template', description='A template with choices', choices='red, blue, green')\npass_values = ['red', 'blue', 'green']\nfail_values = ['rod', 'bleu', 'grene']\npart = Part.objects.all().first()\nfor value in pass_values:\n param = PartParameter(part=part, ...
<|body_start_0|> template = PartParameterTemplate.objects.create(name='My Template', description='A template with choices', choices='red, blue, green') pass_values = ['red', 'blue', 'green'] fail_values = ['rod', 'bleu', 'grene'] part = Part.objects.all().first() for value in pas...
Unit tests for parameter validation
ParameterTests
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterTests: """Unit tests for parameter validation""" def test_choice_validation(self): """Test that parameter choices are correctly validated""" <|body_0|> def test_unit_validation(self): """Test validation of 'units' field for PartParameterTemplate""" ...
stack_v2_sparse_classes_36k_train_026165
12,864
permissive
[ { "docstring": "Test that parameter choices are correctly validated", "name": "test_choice_validation", "signature": "def test_choice_validation(self)" }, { "docstring": "Test validation of 'units' field for PartParameterTemplate", "name": "test_unit_validation", "signature": "def test_u...
4
stack_v2_sparse_classes_30k_train_014121
Implement the Python class `ParameterTests` described below. Class description: Unit tests for parameter validation Method signatures and docstrings: - def test_choice_validation(self): Test that parameter choices are correctly validated - def test_unit_validation(self): Test validation of 'units' field for PartParam...
Implement the Python class `ParameterTests` described below. Class description: Unit tests for parameter validation Method signatures and docstrings: - def test_choice_validation(self): Test that parameter choices are correctly validated - def test_unit_validation(self): Test validation of 'units' field for PartParam...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class ParameterTests: """Unit tests for parameter validation""" def test_choice_validation(self): """Test that parameter choices are correctly validated""" <|body_0|> def test_unit_validation(self): """Test validation of 'units' field for PartParameterTemplate""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParameterTests: """Unit tests for parameter validation""" def test_choice_validation(self): """Test that parameter choices are correctly validated""" template = PartParameterTemplate.objects.create(name='My Template', description='A template with choices', choices='red, blue, green') ...
the_stack_v2_python_sparse
InvenTree/part/test_param.py
inventree/InvenTree
train
3,077
6bc0ec8fb7f4a4d42c05529196d55f207d4ccf23
[ "path = os.path.dirname(os.path.abspath(__file__))\nuv_symmetry_transforms_path = tf.resource_loader.get_path_to_datafile(os.path.join(path, '..', 'dataset_tools', 'densepose', 'UV_symmetry_transforms.mat'))\ntf.logging.info('Loading DensePose symmetry transforms file from {}'.format(uv_symmetry_transforms_path))\n...
<|body_start_0|> path = os.path.dirname(os.path.abspath(__file__)) uv_symmetry_transforms_path = tf.resource_loader.get_path_to_datafile(os.path.join(path, '..', 'dataset_tools', 'densepose', 'UV_symmetry_transforms.mat')) tf.logging.info('Loading DensePose symmetry transforms file from {}'.form...
Class responsible for horizontal flipping of parts and surface coords.
DensePoseHorizontalFlip
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DensePoseHorizontalFlip: """Class responsible for horizontal flipping of parts and surface coords.""" def __init__(self): """Constructor.""" <|body_0|> def flip_parts_and_coords(self, part_ids, vu): """Flips part ids and coordinates. Args: part_ids: a [num_instan...
stack_v2_sparse_classes_36k_train_026166
16,315
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Flips part ids and coordinates. Args: part_ids: a [num_instances, num_points] int32 tensor with pre-flipped part ids. These part_ids are 0-indexed, where the first non-background part has inde...
2
stack_v2_sparse_classes_30k_test_001126
Implement the Python class `DensePoseHorizontalFlip` described below. Class description: Class responsible for horizontal flipping of parts and surface coords. Method signatures and docstrings: - def __init__(self): Constructor. - def flip_parts_and_coords(self, part_ids, vu): Flips part ids and coordinates. Args: pa...
Implement the Python class `DensePoseHorizontalFlip` described below. Class description: Class responsible for horizontal flipping of parts and surface coords. Method signatures and docstrings: - def __init__(self): Constructor. - def flip_parts_and_coords(self, part_ids, vu): Flips part ids and coordinates. Args: pa...
06531dae14365986c86baf735fd149317f4bb67a
<|skeleton|> class DensePoseHorizontalFlip: """Class responsible for horizontal flipping of parts and surface coords.""" def __init__(self): """Constructor.""" <|body_0|> def flip_parts_and_coords(self, part_ids, vu): """Flips part ids and coordinates. Args: part_ids: a [num_instan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DensePoseHorizontalFlip: """Class responsible for horizontal flipping of parts and surface coords.""" def __init__(self): """Constructor.""" path = os.path.dirname(os.path.abspath(__file__)) uv_symmetry_transforms_path = tf.resource_loader.get_path_to_datafile(os.path.join(path, '...
the_stack_v2_python_sparse
inference_api/src/main/object_detection/core/densepose_ops.py
BMW-InnovationLab/BMW-TensorFlow-Training-GUI
train
1,030
f17007e4c40668705dee89d3b8a301a95f8e9a82
[ "set_map, result = (list(), list())\nfor str in strs:\n ss = list(str)\n ss.sort()\n flag = False\n for i, value in enumerate(set_map):\n if value == ss:\n result[i].append(str)\n flag = True\n break\n if not flag:\n set_map.append(ss)\n result.ap...
<|body_start_0|> set_map, result = (list(), list()) for str in strs: ss = list(str) ss.sort() flag = False for i, value in enumerate(set_map): if value == ss: result[i].append(str) flag = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]] 时间击败8.57%,内存击败8.57%""" <|body_0|> def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]] 排序 由于互为变位词的两个字符串包含的字母相同,因此对两个字符串分别进行排序之后得到的字符串一定是相同的,故可以将排序之后的...
stack_v2_sparse_classes_36k_train_026167
2,910
no_license
[ { "docstring": ":type strs: List[str] :rtype: List[List[str]] 时间击败8.57%,内存击败8.57%", "name": "groupAnagrams", "signature": "def groupAnagrams(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: List[List[str]] 排序 由于互为变位词的两个字符串包含的字母相同,因此对两个字符串分别进行排序之后得到的字符串一定是相同的,故可以将排序之后的字符串作为哈希表的键。 时间击...
3
stack_v2_sparse_classes_30k_train_009448
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] 时间击败8.57%,内存击败8.57% - def groupAnagrams1(self, strs): :type strs: List[str] :rtype: List[List[str]] 排...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] 时间击败8.57%,内存击败8.57% - def groupAnagrams1(self, strs): :type strs: List[str] :rtype: List[List[str]] 排...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]] 时间击败8.57%,内存击败8.57%""" <|body_0|> def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]] 排序 由于互为变位词的两个字符串包含的字母相同,因此对两个字符串分别进行排序之后得到的字符串一定是相同的,故可以将排序之后的...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]] 时间击败8.57%,内存击败8.57%""" set_map, result = (list(), list()) for str in strs: ss = list(str) ss.sort() flag = False for i, value in enumerate(set_map):...
the_stack_v2_python_sparse
10.02.group-anagrams-lcci.py
95275059/Algorithm
train
0
b06471ea69e977aab902665a64e7f390d9545e29
[ "self._x = x\nself._y = y\nself._r = r\nself._visible = False\nself._color = color", "t.pencolor(color)\nt.up()\nt.setpos(self._x, self._y - self._r)\nt.down()\nt.circle(self._r)\nt.up()", "if not self._visible:\n self._visible = True\n self._draw(self._color)", "if self._visible:\n self._visible = F...
<|body_start_0|> self._x = x self._y = y self._r = r self._visible = False self._color = color <|end_body_0|> <|body_start_1|> t.pencolor(color) t.up() t.setpos(self._x, self._y - self._r) t.down() t.circle(self._r) t.up() <|end_bo...
Клас Коло
Circle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Circle: """Клас Коло""" def __init__(self, x, y, r, color): """Конструктор Ініціалізує положення кола, його радіус і колір :param x: координата x центру кола :param y: координата y центру кола :param r: радіус кола :param color: колір кола""" <|body_0|> def _draw(self, c...
stack_v2_sparse_classes_36k_train_026168
2,288
no_license
[ { "docstring": "Конструктор Ініціалізує положення кола, його радіус і колір :param x: координата x центру кола :param y: координата y центру кола :param r: радіус кола :param color: колір кола", "name": "__init__", "signature": "def __init__(self, x, y, r, color)" }, { "docstring": "Допоміжний м...
5
stack_v2_sparse_classes_30k_train_021447
Implement the Python class `Circle` described below. Class description: Клас Коло Method signatures and docstrings: - def __init__(self, x, y, r, color): Конструктор Ініціалізує положення кола, його радіус і колір :param x: координата x центру кола :param y: координата y центру кола :param r: радіус кола :param color...
Implement the Python class `Circle` described below. Class description: Клас Коло Method signatures and docstrings: - def __init__(self, x, y, r, color): Конструктор Ініціалізує положення кола, його радіус і колір :param x: координата x центру кола :param y: координата y центру кола :param r: радіус кола :param color...
cb3acb5547659cc52e7e5d99dded7dee2992a56c
<|skeleton|> class Circle: """Клас Коло""" def __init__(self, x, y, r, color): """Конструктор Ініціалізує положення кола, його радіус і колір :param x: координата x центру кола :param y: координата y центру кола :param r: радіус кола :param color: колір кола""" <|body_0|> def _draw(self, c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Circle: """Клас Коло""" def __init__(self, x, y, r, color): """Конструктор Ініціалізує положення кола, його радіус і колір :param x: координата x центру кола :param y: координата y центру кола :param r: радіус кола :param color: колір кола""" self._x = x self._y = y self._...
the_stack_v2_python_sparse
source/P_01/L14_turtle_Сircle .py
krenevych/oop
train
4
c2819ce3fed42b7ac39af9b2f25cd5695d5b7a39
[ "l, r = (0, 0)\nmax_len = 0\nlen_s = len(s)\nfor i in range(len_s):\n if s[i] == '(':\n l += 1\n else:\n r += 1\n if l == r:\n max_len = max(max_len, 2 * r)\n elif r > l:\n l = r = 0\nl = r = 0\nfor i in range(len_s - 1, -1, -1):\n if s[i] == '(':\n l += 1\n else...
<|body_start_0|> l, r = (0, 0) max_len = 0 len_s = len(s) for i in range(len_s): if s[i] == '(': l += 1 else: r += 1 if l == r: max_len = max(max_len, 2 * r) elif r > l: l = r ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses1(self, s: str) -> int: """执行用时: 68 ms , 在所有 Python3 提交中击败了 15.72% 的用户 内存消耗: 15 MB , 在所有 Python3 提交中击败了 81.39% 的用户""" <|body_0|> def longestValidParentheses(self, s: str) -> int: """执行用时: 76 ms , 在所有 Python3 提交中击败了 7.61% 的用户 内存消耗:...
stack_v2_sparse_classes_36k_train_026169
3,080
no_license
[ { "docstring": "执行用时: 68 ms , 在所有 Python3 提交中击败了 15.72% 的用户 内存消耗: 15 MB , 在所有 Python3 提交中击败了 81.39% 的用户", "name": "longestValidParentheses1", "signature": "def longestValidParentheses1(self, s: str) -> int" }, { "docstring": "执行用时: 76 ms , 在所有 Python3 提交中击败了 7.61% 的用户 内存消耗: 15.4 MB , 在所有 Python3...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses1(self, s: str) -> int: 执行用时: 68 ms , 在所有 Python3 提交中击败了 15.72% 的用户 内存消耗: 15 MB , 在所有 Python3 提交中击败了 81.39% 的用户 - def longestValidParentheses(self, s: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses1(self, s: str) -> int: 执行用时: 68 ms , 在所有 Python3 提交中击败了 15.72% 的用户 内存消耗: 15 MB , 在所有 Python3 提交中击败了 81.39% 的用户 - def longestValidParentheses(self, s: ...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def longestValidParentheses1(self, s: str) -> int: """执行用时: 68 ms , 在所有 Python3 提交中击败了 15.72% 的用户 内存消耗: 15 MB , 在所有 Python3 提交中击败了 81.39% 的用户""" <|body_0|> def longestValidParentheses(self, s: str) -> int: """执行用时: 76 ms , 在所有 Python3 提交中击败了 7.61% 的用户 内存消耗:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses1(self, s: str) -> int: """执行用时: 68 ms , 在所有 Python3 提交中击败了 15.72% 的用户 内存消耗: 15 MB , 在所有 Python3 提交中击败了 81.39% 的用户""" l, r = (0, 0) max_len = 0 len_s = len(s) for i in range(len_s): if s[i] == '(': l += 1 ...
the_stack_v2_python_sparse
最长有效括号.py
nomboy/leetcode
train
0
041d858ee08c418eb48215abc95cf8e83e8c30cb
[ "try:\n log.info('%s %r' % (request.remote_addr, request))\n users = ModelOperations.user_list()\n if not users:\n response = jsonify(users=[])\n response.status_code = 404\n return response\n response = [{'id': user[0], 'username': user[1], 'created': user[2]} for user in users]\n ...
<|body_start_0|> try: log.info('%s %r' % (request.remote_addr, request)) users = ModelOperations.user_list() if not users: response = jsonify(users=[]) response.status_code = 404 return response response = [{'id': us...
Handles API users
ApiUserList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiUserList: """Handles API users""" def get(self): """Get List of users. :return:""" <|body_0|> def post(self): """Creates a new user. New user requires a valid username and password. Password is clear text. API uses HTTPS hence password should be unreadable if ...
stack_v2_sparse_classes_36k_train_026170
23,973
permissive
[ { "docstring": "Get List of users. :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Creates a new user. New user requires a valid username and password. Password is clear text. API uses HTTPS hence password should be unreadable if intercepted. :return:", "name": "pos...
2
stack_v2_sparse_classes_30k_train_017201
Implement the Python class `ApiUserList` described below. Class description: Handles API users Method signatures and docstrings: - def get(self): Get List of users. :return: - def post(self): Creates a new user. New user requires a valid username and password. Password is clear text. API uses HTTPS hence password sho...
Implement the Python class `ApiUserList` described below. Class description: Handles API users Method signatures and docstrings: - def get(self): Get List of users. :return: - def post(self): Creates a new user. New user requires a valid username and password. Password is clear text. API uses HTTPS hence password sho...
c27812e6b846eb1e28ec0c6e8508e18886e37617
<|skeleton|> class ApiUserList: """Handles API users""" def get(self): """Get List of users. :return:""" <|body_0|> def post(self): """Creates a new user. New user requires a valid username and password. Password is clear text. API uses HTTPS hence password should be unreadable if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiUserList: """Handles API users""" def get(self): """Get List of users. :return:""" try: log.info('%s %r' % (request.remote_addr, request)) users = ModelOperations.user_list() if not users: response = jsonify(users=[]) ...
the_stack_v2_python_sparse
api/version1_0/application/api_main.py
gogasca/news_ml
train
4
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_36k_train_026171
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_013691
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_36k
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
cd79eb3b9adb66ee678f9d9a265e40d9de3a57ea
[ "nums = first_line(filename)\nfor _ in range(40):\n nums = expand(nums)\nreturn len(nums)", "nums = first_line(filename)\nfor _ in range(50):\n nums = expand(nums)\nreturn len(nums)" ]
<|body_start_0|> nums = first_line(filename) for _ in range(40): nums = expand(nums) return len(nums) <|end_body_0|> <|body_start_1|> nums = first_line(filename) for _ in range(50): nums = expand(nums) return len(nums) <|end_body_1|>
AoC 2015 Day 10
Day10
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day10: """AoC 2015 Day 10""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 10 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2015 day 10 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_026172
947
no_license
[ { "docstring": "Given a filename, solve 2015 day 10 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2015 day 10 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
null
Implement the Python class `Day10` described below. Class description: AoC 2015 Day 10 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2015 day 10 part 1 - def part2(filename: str) -> int: Given a filename, solve 2015 day 10 part 2
Implement the Python class `Day10` described below. Class description: AoC 2015 Day 10 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2015 day 10 part 1 - def part2(filename: str) -> int: Given a filename, solve 2015 day 10 part 2 <|skeleton|> class Day10: """AoC 201...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day10: """AoC 2015 Day 10""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 10 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2015 day 10 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day10: """AoC 2015 Day 10""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 10 part 1""" nums = first_line(filename) for _ in range(40): nums = expand(nums) return len(nums) def part2(filename: str) -> int: """Given a filename...
the_stack_v2_python_sparse
2015/python2015/aoc/day10.py
mreishus/aoc
train
16
92f51d1ff3cb023652acb0fd95747702c23e4970
[ "super().__init__()\nself.nlp = load_spacy_lexeme_prob(nlp)\nself.perturb_opts: Union[Dict, None] = perturb_opts\nself.words: List = []\nself.punctuation: List = []\nself.positions: List = []", "processed = self.nlp(text)\nself.words = [x.text for x in processed]\nself.positions = [x.idx for x in processed]\nself...
<|body_start_0|> super().__init__() self.nlp = load_spacy_lexeme_prob(nlp) self.perturb_opts: Union[Dict, None] = perturb_opts self.words: List = [] self.punctuation: List = [] self.positions: List = [] <|end_body_0|> <|body_start_1|> processed = self.nlp(text) ...
UnknownSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnknownSampler: def __init__(self, nlp: 'spacy.language.Language', perturb_opts: Dict): """Initialize unknown sampler. This sampler replaces word with the `UNK` token. Parameters ---------- nlp `spaCy` object. perturb_opts Perturbation options.""" <|body_0|> def set_text(sel...
stack_v2_sparse_classes_36k_train_026173
16,961
permissive
[ { "docstring": "Initialize unknown sampler. This sampler replaces word with the `UNK` token. Parameters ---------- nlp `spaCy` object. perturb_opts Perturbation options.", "name": "__init__", "signature": "def __init__(self, nlp: 'spacy.language.Language', perturb_opts: Dict)" }, { "docstring": ...
4
null
Implement the Python class `UnknownSampler` described below. Class description: Implement the UnknownSampler class. Method signatures and docstrings: - def __init__(self, nlp: 'spacy.language.Language', perturb_opts: Dict): Initialize unknown sampler. This sampler replaces word with the `UNK` token. Parameters ------...
Implement the Python class `UnknownSampler` described below. Class description: Implement the UnknownSampler class. Method signatures and docstrings: - def __init__(self, nlp: 'spacy.language.Language', perturb_opts: Dict): Initialize unknown sampler. This sampler replaces word with the `UNK` token. Parameters ------...
54d0c957fb01c7ebba4e2a0d28fcbde52d9c6718
<|skeleton|> class UnknownSampler: def __init__(self, nlp: 'spacy.language.Language', perturb_opts: Dict): """Initialize unknown sampler. This sampler replaces word with the `UNK` token. Parameters ---------- nlp `spaCy` object. perturb_opts Perturbation options.""" <|body_0|> def set_text(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnknownSampler: def __init__(self, nlp: 'spacy.language.Language', perturb_opts: Dict): """Initialize unknown sampler. This sampler replaces word with the `UNK` token. Parameters ---------- nlp `spaCy` object. perturb_opts Perturbation options.""" super().__init__() self.nlp = load_spa...
the_stack_v2_python_sparse
alibi/explainers/anchors/text_samplers.py
SeldonIO/alibi
train
2,143
c34a9956a5c34457a5a84eb44044219751221ea4
[ "graph_def = sess.graph_def\ntoco_flags = toco_flags_pb2.TocoFlags()\ntoco_flags.input_format = toco_flags_pb2.TENSORFLOW_GRAPHDEF\ntoco_flags.output_format = toco_flags_pb2.TFLITE\ntoco_flags.inference_input_type = types_pb2.FLOAT\ntoco_flags.inference_type = types_pb2.FLOAT\ntoco_flags.allow_custom_ops = True\nmo...
<|body_start_0|> graph_def = sess.graph_def toco_flags = toco_flags_pb2.TocoFlags() toco_flags.input_format = toco_flags_pb2.TENSORFLOW_GRAPHDEF toco_flags.output_format = toco_flags_pb2.TFLITE toco_flags.inference_input_type = types_pb2.FLOAT toco_flags.inference_type = ...
TocoFromProtosTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TocoFromProtosTest: def _run(self, sess, in_tensor, out_tensor, should_succeed): """Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as o...
stack_v2_sparse_classes_36k_train_026174
3,767
permissive
[ { "docstring": "Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as output. should_succeed: Whether this is a valid conversion.", "name": "_run", "signat...
2
stack_v2_sparse_classes_30k_train_002288
Implement the Python class `TocoFromProtosTest` described below. Class description: Implement the TocoFromProtosTest class. Method signatures and docstrings: - def _run(self, sess, in_tensor, out_tensor, should_succeed): Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow sessio...
Implement the Python class `TocoFromProtosTest` described below. Class description: Implement the TocoFromProtosTest class. Method signatures and docstrings: - def _run(self, sess, in_tensor, out_tensor, should_succeed): Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow sessio...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class TocoFromProtosTest: def _run(self, sess, in_tensor, out_tensor, should_succeed): """Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TocoFromProtosTest: def _run(self, sess, in_tensor, out_tensor, should_succeed): """Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as output. should_...
the_stack_v2_python_sparse
tensorflow/lite/toco/python/toco_from_protos_test.py
tensorflow/tensorflow
train
208,740
1db500821af8f97a36c71e60c3941f935c34e839
[ "resource = Monitor_Resource()\nresource.ip = ip\nresource.process_isalive = process_isalive\nresource.process_cpu_use = process_cpu_use\nresource.process_mem_use = process_mem_use\nresource.cpu_total_use = cpu_total_use\nresource.mem_free = mem_free\nresource.disk_read = disk_read\nresource.disk_write = disk_write...
<|body_start_0|> resource = Monitor_Resource() resource.ip = ip resource.process_isalive = process_isalive resource.process_cpu_use = process_cpu_use resource.process_mem_use = process_mem_use resource.cpu_total_use = cpu_total_use resource.mem_free = mem_free ...
Monitor_Resource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Monitor_Resource: def create_or_replace(cls, ip, process_isalive, process_cpu_use, process_mem_use, cpu_total_use, mem_free, disk_read, disk_write, network_upload, network_download, volume): """发现一台新主机的监控资源 :param ip: ip地址 :param process_isalive: 进程是否存在 :param process_cpu_use: 进程的cpu使用情况...
stack_v2_sparse_classes_36k_train_026175
13,402
no_license
[ { "docstring": "发现一台新主机的监控资源 :param ip: ip地址 :param process_isalive: 进程是否存在 :param process_cpu_use: 进程的cpu使用情况 :param process_mem_use: 进程的内存使用情况 :param cpu_total_use: 总cpu使用率 :param mem_free: 内存可用量 :param disk_read: 磁盘读 :param disk_write: 磁盘写 :param network_upload: 网络上传 :param network_download: 网络下载 :param volu...
2
stack_v2_sparse_classes_30k_train_003174
Implement the Python class `Monitor_Resource` described below. Class description: Implement the Monitor_Resource class. Method signatures and docstrings: - def create_or_replace(cls, ip, process_isalive, process_cpu_use, process_mem_use, cpu_total_use, mem_free, disk_read, disk_write, network_upload, network_download...
Implement the Python class `Monitor_Resource` described below. Class description: Implement the Monitor_Resource class. Method signatures and docstrings: - def create_or_replace(cls, ip, process_isalive, process_cpu_use, process_mem_use, cpu_total_use, mem_free, disk_read, disk_write, network_upload, network_download...
4febccac57bfa5f7ef46f5f57e52206c8b0a57ac
<|skeleton|> class Monitor_Resource: def create_or_replace(cls, ip, process_isalive, process_cpu_use, process_mem_use, cpu_total_use, mem_free, disk_read, disk_write, network_upload, network_download, volume): """发现一台新主机的监控资源 :param ip: ip地址 :param process_isalive: 进程是否存在 :param process_cpu_use: 进程的cpu使用情况...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Monitor_Resource: def create_or_replace(cls, ip, process_isalive, process_cpu_use, process_mem_use, cpu_total_use, mem_free, disk_read, disk_write, network_upload, network_download, volume): """发现一台新主机的监控资源 :param ip: ip地址 :param process_isalive: 进程是否存在 :param process_cpu_use: 进程的cpu使用情况 :param proces...
the_stack_v2_python_sparse
item/dev/cmdb/asset/models.py
soulorman/Python
train
0
4481388672ccf9ad4b8b0fa70b1840565dbc2bb5
[ "if not nums:\n return 0\nn = len(nums)\nif n < 3:\n return 0\nret = {}\nnums.sort()\nfor i in range(n):\n left, right = (i + 1, n - 1)\n while left < right:\n sums = nums[i] + nums[left] + nums[right]\n dist = abs(target - sums)\n ret[sums] = dist\n if sums == target:\n ...
<|body_start_0|> if not nums: return 0 n = len(nums) if n < 3: return 0 ret = {} nums.sort() for i in range(n): left, right = (i + 1, n - 1) while left < right: sums = nums[i] + nums[left] + nums[right] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums: list, target: int) -> int: """类似三数之和的解法 用字典保存每次的三数之和以及和target的距离(绝对值) 再将字典排序,得到结果""" <|body_0|> def threeSumClosest_2(self, nums: list, target: int) -> int: """1. 若nums的长度 n < 3,则直接返回 2. 将nums排序,并定义res为无穷大,表示最小距离的和 3. 定义left,...
stack_v2_sparse_classes_36k_train_026176
2,755
no_license
[ { "docstring": "类似三数之和的解法 用字典保存每次的三数之和以及和target的距离(绝对值) 再将字典排序,得到结果", "name": "threeSumClosest", "signature": "def threeSumClosest(self, nums: list, target: int) -> int" }, { "docstring": "1. 若nums的长度 n < 3,则直接返回 2. 将nums排序,并定义res为无穷大,表示最小距离的和 3. 定义left,right分别表示三数中的第二个数和第三个数,其中left = i + 1, rig...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums: list, target: int) -> int: 类似三数之和的解法 用字典保存每次的三数之和以及和target的距离(绝对值) 再将字典排序,得到结果 - def threeSumClosest_2(self, nums: list, target: int) -> int: 1. 若...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums: list, target: int) -> int: 类似三数之和的解法 用字典保存每次的三数之和以及和target的距离(绝对值) 再将字典排序,得到结果 - def threeSumClosest_2(self, nums: list, target: int) -> int: 1. 若...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def threeSumClosest(self, nums: list, target: int) -> int: """类似三数之和的解法 用字典保存每次的三数之和以及和target的距离(绝对值) 再将字典排序,得到结果""" <|body_0|> def threeSumClosest_2(self, nums: list, target: int) -> int: """1. 若nums的长度 n < 3,则直接返回 2. 将nums排序,并定义res为无穷大,表示最小距离的和 3. 定义left,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums: list, target: int) -> int: """类似三数之和的解法 用字典保存每次的三数之和以及和target的距离(绝对值) 再将字典排序,得到结果""" if not nums: return 0 n = len(nums) if n < 3: return 0 ret = {} nums.sort() for i in range(n): ...
the_stack_v2_python_sparse
algorithm/leetcode/list/12-最接近的三数之和.py
lxconfig/UbuntuCode_bak
train
0
fe9d6b3c6340af4d67c5e5e7e1c01e05b1d52a01
[ "if len(nums) <= 0:\n return nums\nres = []\nfor i in range(len(nums) - k + 1):\n window = nums[i:i + k]\n window = sorted(window)\n if k % 2 == 1:\n res.append(window[k / 2])\n else:\n res.append((window[(k - 1) / 2] + window[k / 2]) / 2)\nreturn res", "res = []\nimport bisect\nif le...
<|body_start_0|> if len(nums) <= 0: return nums res = [] for i in range(len(nums) - k + 1): window = nums[i:i + k] window = sorted(window) if k % 2 == 1: res.append(window[k / 2]) else: res.append((window...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def medianSlidingWindow_fore_brute(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[float]""" <|body_0|> def medianSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[float]""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_026177
1,322
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[float]", "name": "medianSlidingWindow_fore_brute", "signature": "def medianSlidingWindow_fore_brute(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[float]", "name": "medianSlidingWindow", "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def medianSlidingWindow_fore_brute(self, nums, k): :type nums: List[int] :type k: int :rtype: List[float] - def medianSlidingWindow(self, nums, k): :type nums: List[int] :type k:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def medianSlidingWindow_fore_brute(self, nums, k): :type nums: List[int] :type k: int :rtype: List[float] - def medianSlidingWindow(self, nums, k): :type nums: List[int] :type k:...
176cc1db3291843fb068f06d0180766dd8c3122c
<|skeleton|> class Solution: def medianSlidingWindow_fore_brute(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[float]""" <|body_0|> def medianSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[float]""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def medianSlidingWindow_fore_brute(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[float]""" if len(nums) <= 0: return nums res = [] for i in range(len(nums) - k + 1): window = nums[i:i + k] window = sorted(window...
the_stack_v2_python_sparse
2019/sliding_window/sliding_window_median_480.py
yehongyu/acode
train
0
1c4e2fd34033973c51d13e82d5ea3f5609ce3716
[ "category = EnvironmentType.objects.all()\nserializer = EnvironmentTypeSerializer(category, many=True)\nreturn Response(serializer.data)", "serializer = EnvironmentTypeSerializer(data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(serializer.data, status=status.HTTP_201_CREAT...
<|body_start_0|> category = EnvironmentType.objects.all() serializer = EnvironmentTypeSerializer(category, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> serializer = EnvironmentTypeSerializer(data=request.data) if serializer.is_valid(): ...
List all EnvironmentType, or create a new EnvironmentType.
EnvironmentTypeList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentTypeList: """List all EnvironmentType, or create a new EnvironmentType.""" def get(self, request, format=None): """The default get method, i.e on page load""" <|body_0|> def post(self, request, format=None): """The default post method.""" <|bod...
stack_v2_sparse_classes_36k_train_026178
15,222
permissive
[ { "docstring": "The default get method, i.e on page load", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "The default post method.", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_005518
Implement the Python class `EnvironmentTypeList` described below. Class description: List all EnvironmentType, or create a new EnvironmentType. Method signatures and docstrings: - def get(self, request, format=None): The default get method, i.e on page load - def post(self, request, format=None): The default post met...
Implement the Python class `EnvironmentTypeList` described below. Class description: List all EnvironmentType, or create a new EnvironmentType. Method signatures and docstrings: - def get(self, request, format=None): The default get method, i.e on page load - def post(self, request, format=None): The default post met...
b0635e72338e14dad24f1ee0329212cd60a3e83a
<|skeleton|> class EnvironmentTypeList: """List all EnvironmentType, or create a new EnvironmentType.""" def get(self, request, format=None): """The default get method, i.e on page load""" <|body_0|> def post(self, request, format=None): """The default post method.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvironmentTypeList: """List all EnvironmentType, or create a new EnvironmentType.""" def get(self, request, format=None): """The default get method, i.e on page load""" category = EnvironmentType.objects.all() serializer = EnvironmentTypeSerializer(category, many=True) re...
the_stack_v2_python_sparse
environment/views.py
faisaltheparttimecoder/carelogBackend
train
1
f5b546f2a15477fab799579cc7dd514f283b001d
[ "if component_config:\n return False\nreturn isinstance(component_executor_spec, executor_spec.ExecutorClassSpec)", "executor_class_spec = cast(executor_spec.ExecutorClassSpec, self._component_executor_spec)\nif issubclass(executor_class_spec.executor_class, base_beam_executor.BaseBeamExecutor):\n executor_...
<|body_start_0|> if component_config: return False return isinstance(component_executor_spec, executor_spec.ExecutorClassSpec) <|end_body_0|> <|body_start_1|> executor_class_spec = cast(executor_spec.ExecutorClassSpec, self._component_executor_spec) if issubclass(executor_cl...
Responsible for launching a python executor. The executor will be launched in the same process of the rest of the component, i.e. its driver and publisher.
InProcessComponentLauncher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InProcessComponentLauncher: """Responsible for launching a python executor. The executor will be launched in the same process of the rest of the component, i.e. its driver and publisher.""" def can_launch(cls, component_executor_spec: executor_spec.ExecutorSpec, component_config: base_compon...
stack_v2_sparse_classes_36k_train_026179
3,187
permissive
[ { "docstring": "Checks if the launcher can launch the executor spec.", "name": "can_launch", "signature": "def can_launch(cls, component_executor_spec: executor_spec.ExecutorSpec, component_config: base_component_config.BaseComponentConfig) -> bool" }, { "docstring": "Execute underlying componen...
2
stack_v2_sparse_classes_30k_train_000210
Implement the Python class `InProcessComponentLauncher` described below. Class description: Responsible for launching a python executor. The executor will be launched in the same process of the rest of the component, i.e. its driver and publisher. Method signatures and docstrings: - def can_launch(cls, component_exec...
Implement the Python class `InProcessComponentLauncher` described below. Class description: Responsible for launching a python executor. The executor will be launched in the same process of the rest of the component, i.e. its driver and publisher. Method signatures and docstrings: - def can_launch(cls, component_exec...
1b328504fa08a70388691e4072df76f143631325
<|skeleton|> class InProcessComponentLauncher: """Responsible for launching a python executor. The executor will be launched in the same process of the rest of the component, i.e. its driver and publisher.""" def can_launch(cls, component_executor_spec: executor_spec.ExecutorSpec, component_config: base_compon...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InProcessComponentLauncher: """Responsible for launching a python executor. The executor will be launched in the same process of the rest of the component, i.e. its driver and publisher.""" def can_launch(cls, component_executor_spec: executor_spec.ExecutorSpec, component_config: base_component_config.Ba...
the_stack_v2_python_sparse
tfx/orchestration/launcher/in_process_component_launcher.py
tensorflow/tfx
train
2,116
90b61c67022ddea582804ac8952d825dac68f539
[ "items = []\nfilter_shared = request.GET.get('filter_shared', False)\nif request.GET.get('all_projects') == 'true':\n result = api.neutron.network_list(request, **request.GET)\n rest_utils.ensure_tenant_name(request, result)\n for item in result:\n item_dict = item.to_dict()\n if hasattr(item...
<|body_start_0|> items = [] filter_shared = request.GET.get('filter_shared', False) if request.GET.get('all_projects') == 'true': result = api.neutron.network_list(request, **request.GET) rest_utils.ensure_tenant_name(request, result) for item in result: ...
API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html
Networks
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Networks: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of networks for a project The listing result is an object with property "items". Each item is a network.""" <|body_0|> def post(self, ...
stack_v2_sparse_classes_36k_train_026180
30,067
permissive
[ { "docstring": "Get a list of networks for a project The listing result is an object with property \"items\". Each item is a network.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create a network :param admin_state_up (optional): The administrative state of the netwo...
2
null
Implement the Python class `Networks` described below. Class description: API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html Method signatures and docstrings: - def get(self, request): Get a list of networks for a project The listing result is an object with property "items". Each item...
Implement the Python class `Networks` described below. Class description: API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html Method signatures and docstrings: - def get(self, request): Get a list of networks for a project The listing result is an object with property "items". Each item...
9524f1952461c83db485d5d1702c350b158d7ce0
<|skeleton|> class Networks: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of networks for a project The listing result is an object with property "items". Each item is a network.""" <|body_0|> def post(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Networks: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of networks for a project The listing result is an object with property "items". Each item is a network.""" items = [] filter_shared = request.G...
the_stack_v2_python_sparse
easystack_dashboard/api/rest/neutron.py
oksbsb/horizon-acc
train
0
cd09f000df2d924d535ca44d285ec780068ab9a2
[ "self.domain_name = domain_name\nself.encrypted_password = encrypted_password\nself.kdc = kdc\nself.password = password\nself.protocol = protocol\nself.username = username", "if dictionary is None:\n return None\ndomain_name = dictionary.get('domainName')\nencrypted_password = dictionary.get('encryptedPassword...
<|body_start_0|> self.domain_name = domain_name self.encrypted_password = encrypted_password self.kdc = kdc self.password = password self.protocol = protocol self.username = username <|end_body_0|> <|body_start_1|> if dictionary is None: return None ...
Implementation of the 'NasMountCredentials' model. TODO: type description here. Attributes: domain_name (string): The name of the domain which the NAS mount credentials belong to. encrypted_password (list of long|int): AES256 encrypted password. The key for encryption should be obtained from KMS. kdc (string): KDC host...
NasMountCredentials
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NasMountCredentials: """Implementation of the 'NasMountCredentials' model. TODO: type description here. Attributes: domain_name (string): The name of the domain which the NAS mount credentials belong to. encrypted_password (list of long|int): AES256 encrypted password. The key for encryption shou...
stack_v2_sparse_classes_36k_train_026181
2,953
permissive
[ { "docstring": "Constructor for the NasMountCredentials class", "name": "__init__", "signature": "def __init__(self, domain_name=None, encrypted_password=None, kdc=None, password=None, protocol=None, username=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dic...
2
stack_v2_sparse_classes_30k_test_000011
Implement the Python class `NasMountCredentials` described below. Class description: Implementation of the 'NasMountCredentials' model. TODO: type description here. Attributes: domain_name (string): The name of the domain which the NAS mount credentials belong to. encrypted_password (list of long|int): AES256 encrypte...
Implement the Python class `NasMountCredentials` described below. Class description: Implementation of the 'NasMountCredentials' model. TODO: type description here. Attributes: domain_name (string): The name of the domain which the NAS mount credentials belong to. encrypted_password (list of long|int): AES256 encrypte...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NasMountCredentials: """Implementation of the 'NasMountCredentials' model. TODO: type description here. Attributes: domain_name (string): The name of the domain which the NAS mount credentials belong to. encrypted_password (list of long|int): AES256 encrypted password. The key for encryption shou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NasMountCredentials: """Implementation of the 'NasMountCredentials' model. TODO: type description here. Attributes: domain_name (string): The name of the domain which the NAS mount credentials belong to. encrypted_password (list of long|int): AES256 encrypted password. The key for encryption should be obtaine...
the_stack_v2_python_sparse
cohesity_management_sdk/models/nas_mount_credentials.py
cohesity/management-sdk-python
train
24
161f2a74ca7be6d3a43c2102b9499cdcc129fc8c
[ "super().__init__()\nself.num_atoms = num_atoms\ntau_min = 1 / (2 * self.num_atoms)\ntau_max = 1 - tau_min\nself.tau = torch.linspace(start=tau_min, end=tau_max, steps=self.num_atoms)\nself.criterion = HuberLossV0(clip_delta=clip_delta)", "atoms_diff = targets[:, None, :] - outputs[:, :, None]\ndelta_atoms_diff =...
<|body_start_0|> super().__init__() self.num_atoms = num_atoms tau_min = 1 / (2 * self.num_atoms) tau_max = 1 - tau_min self.tau = torch.linspace(start=tau_min, end=tau_max, steps=self.num_atoms) self.criterion = HuberLossV0(clip_delta=clip_delta) <|end_body_0|> <|body_s...
QuantileRegressionLoss
QuantileRegressionLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantileRegressionLoss: """QuantileRegressionLoss""" def __init__(self, num_atoms: int=51, clip_delta: float=1.0): """Init.""" <|body_0|> def forward(self, outputs: torch.Tensor, targets: torch.Tensor) -> torch.Tensor: """Compute the loss. Args: outputs (torch.Te...
stack_v2_sparse_classes_36k_train_026182
4,457
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, num_atoms: int=51, clip_delta: float=1.0)" }, { "docstring": "Compute the loss. Args: outputs (torch.Tensor): predicted atoms, shape: [bs; num_atoms] targets (torch.Tensor): target atoms, shape: [bs; num_atoms] Returns:...
2
stack_v2_sparse_classes_30k_train_013040
Implement the Python class `QuantileRegressionLoss` described below. Class description: QuantileRegressionLoss Method signatures and docstrings: - def __init__(self, num_atoms: int=51, clip_delta: float=1.0): Init. - def forward(self, outputs: torch.Tensor, targets: torch.Tensor) -> torch.Tensor: Compute the loss. Ar...
Implement the Python class `QuantileRegressionLoss` described below. Class description: QuantileRegressionLoss Method signatures and docstrings: - def __init__(self, num_atoms: int=51, clip_delta: float=1.0): Init. - def forward(self, outputs: torch.Tensor, targets: torch.Tensor) -> torch.Tensor: Compute the loss. Ar...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class QuantileRegressionLoss: """QuantileRegressionLoss""" def __init__(self, num_atoms: int=51, clip_delta: float=1.0): """Init.""" <|body_0|> def forward(self, outputs: torch.Tensor, targets: torch.Tensor) -> torch.Tensor: """Compute the loss. Args: outputs (torch.Te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuantileRegressionLoss: """QuantileRegressionLoss""" def __init__(self, num_atoms: int=51, clip_delta: float=1.0): """Init.""" super().__init__() self.num_atoms = num_atoms tau_min = 1 / (2 * self.num_atoms) tau_max = 1 - tau_min self.tau = torch.linspace(s...
the_stack_v2_python_sparse
catalyst/contrib/losses/regression.py
catalyst-team/catalyst
train
3,038
b67a4d96730a71119af965f6afbb0e684fe02e4a
[ "self.subcmd = 'agent'\nself.subcmd_args = []\nself.kwargs = {'color': 'false'}\nself.args = []\npuppet_config = __salt__['cmd.run']('puppet config print --render-as yaml vardir rundir confdir')\nconf = salt.utils.yaml.safe_load(puppet_config)\nself.vardir = conf['vardir']\nself.rundir = conf['rundir']\nself.confdi...
<|body_start_0|> self.subcmd = 'agent' self.subcmd_args = [] self.kwargs = {'color': 'false'} self.args = [] puppet_config = __salt__['cmd.run']('puppet config print --render-as yaml vardir rundir confdir') conf = salt.utils.yaml.safe_load(puppet_config) self.vard...
Puppet helper class. Used to format command for execution.
_Puppet
[ "Apache-2.0", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Puppet: """Puppet helper class. Used to format command for execution.""" def __init__(self): """Setup a puppet instance, based on the premis that default usage is to run 'puppet agent --test'. Configuration and run states are stored in the default locations.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_026183
11,161
permissive
[ { "docstring": "Setup a puppet instance, based on the premis that default usage is to run 'puppet agent --test'. Configuration and run states are stored in the default locations.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Format the command string to executed usin...
3
null
Implement the Python class `_Puppet` described below. Class description: Puppet helper class. Used to format command for execution. Method signatures and docstrings: - def __init__(self): Setup a puppet instance, based on the premis that default usage is to run 'puppet agent --test'. Configuration and run states are ...
Implement the Python class `_Puppet` described below. Class description: Puppet helper class. Used to format command for execution. Method signatures and docstrings: - def __init__(self): Setup a puppet instance, based on the premis that default usage is to run 'puppet agent --test'. Configuration and run states are ...
1ef90cbdc7203f97775edb7666db86a41eb9fc15
<|skeleton|> class _Puppet: """Puppet helper class. Used to format command for execution.""" def __init__(self): """Setup a puppet instance, based on the premis that default usage is to run 'puppet agent --test'. Configuration and run states are stored in the default locations.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Puppet: """Puppet helper class. Used to format command for execution.""" def __init__(self): """Setup a puppet instance, based on the premis that default usage is to run 'puppet agent --test'. Configuration and run states are stored in the default locations.""" self.subcmd = 'agent' ...
the_stack_v2_python_sparse
salt/modules/puppet.py
saltstack/salt
train
11,026
00715fd902c00a250461844d54fd9f4cf925c054
[ "super(File, self).__init__(name, **kwargs)\nself.modulename = modulename\nself.content = content", "if inline:\n if 'source' in self:\n raise ValueError(\"source tarballs can't be dumped as strings.\")\n if getattr(self, 'content', None) is not None:\n self['content'] = self.content\n ...
<|body_start_0|> super(File, self).__init__(name, **kwargs) self.modulename = modulename self.content = content <|end_body_0|> <|body_start_1|> if inline: if 'source' in self: raise ValueError("source tarballs can't be dumped as strings.") if geta...
Puppet file resource.
File
[ "BSD-2-Clause-Views", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class File: """Puppet file resource.""" def __init__(self, name, modulename=None, content=None, **kwargs): """File resources handle their content explicitly because in some cases it is not written as a normal parameter.""" <|body_0|> def dumps(self, inline=False, tab=''): ...
stack_v2_sparse_classes_36k_train_026184
20,994
permissive
[ { "docstring": "File resources handle their content explicitly because in some cases it is not written as a normal parameter.", "name": "__init__", "signature": "def __init__(self, name, modulename=None, content=None, **kwargs)" }, { "docstring": "Treat the content as a normal parameter if and o...
2
stack_v2_sparse_classes_30k_train_006865
Implement the Python class `File` described below. Class description: Puppet file resource. Method signatures and docstrings: - def __init__(self, name, modulename=None, content=None, **kwargs): File resources handle their content explicitly because in some cases it is not written as a normal parameter. - def dumps(s...
Implement the Python class `File` described below. Class description: Puppet file resource. Method signatures and docstrings: - def __init__(self, name, modulename=None, content=None, **kwargs): File resources handle their content explicitly because in some cases it is not written as a normal parameter. - def dumps(s...
dffdcd0792a9c66ec218f0a2baf416292e59afcd
<|skeleton|> class File: """Puppet file resource.""" def __init__(self, name, modulename=None, content=None, **kwargs): """File resources handle their content explicitly because in some cases it is not written as a normal parameter.""" <|body_0|> def dumps(self, inline=False, tab=''): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class File: """Puppet file resource.""" def __init__(self, name, modulename=None, content=None, **kwargs): """File resources handle their content explicitly because in some cases it is not written as a normal parameter.""" super(File, self).__init__(name, **kwargs) self.modulename = mod...
the_stack_v2_python_sparse
blueprint/frontend/puppet.py
sarguru/blueprint
train
1
648de80ed7d9efe6f88acab191d01b9e7164cad3
[ "self.acropolis_params = acropolis_params\nself.app_entity_id_vec = app_entity_id_vec\nself.aws_native_params = aws_native_params\nself.aws_snapshot_manager_params = aws_snapshot_manager_params\nself.gcp_native_params = gcp_native_params\nself.hyperv_params = hyperv_params\nself.oracle_params = oracle_params\nself....
<|body_start_0|> self.acropolis_params = acropolis_params self.app_entity_id_vec = app_entity_id_vec self.aws_native_params = aws_native_params self.aws_snapshot_manager_params = aws_snapshot_manager_params self.gcp_native_params = gcp_native_params self.hyperv_params = h...
Implementation of the 'BackupSourceParams' model. Message to capture any additional backup params at the source level. Attributes: acropolis_params (AcropolisBackupSourceParams): This is applicable to sources of type kVirtualMachine (kAcropolis environment). app_entity_id_vec (list of long|int): If we are backing up an...
BackupSourceParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupSourceParams: """Implementation of the 'BackupSourceParams' model. Message to capture any additional backup params at the source level. Attributes: acropolis_params (AcropolisBackupSourceParams): This is applicable to sources of type kVirtualMachine (kAcropolis environment). app_entity_id_v...
stack_v2_sparse_classes_36k_train_026185
8,847
permissive
[ { "docstring": "Constructor for the BackupSourceParams class", "name": "__init__", "signature": "def __init__(self, acropolis_params=None, app_entity_id_vec=None, aws_native_params=None, aws_snapshot_manager_params=None, gcp_native_params=None, hyperv_params=None, oracle_params=None, physical_params=Non...
2
null
Implement the Python class `BackupSourceParams` described below. Class description: Implementation of the 'BackupSourceParams' model. Message to capture any additional backup params at the source level. Attributes: acropolis_params (AcropolisBackupSourceParams): This is applicable to sources of type kVirtualMachine (k...
Implement the Python class `BackupSourceParams` described below. Class description: Implementation of the 'BackupSourceParams' model. Message to capture any additional backup params at the source level. Attributes: acropolis_params (AcropolisBackupSourceParams): This is applicable to sources of type kVirtualMachine (k...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class BackupSourceParams: """Implementation of the 'BackupSourceParams' model. Message to capture any additional backup params at the source level. Attributes: acropolis_params (AcropolisBackupSourceParams): This is applicable to sources of type kVirtualMachine (kAcropolis environment). app_entity_id_v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackupSourceParams: """Implementation of the 'BackupSourceParams' model. Message to capture any additional backup params at the source level. Attributes: acropolis_params (AcropolisBackupSourceParams): This is applicable to sources of type kVirtualMachine (kAcropolis environment). app_entity_id_vec (list of l...
the_stack_v2_python_sparse
cohesity_management_sdk/models/backup_source_params.py
cohesity/management-sdk-python
train
24
9337c48b67d1d779f77eb40ccd3be8df5b9f06b8
[ "super(FileSystemWinRegistryFileReader, self).__init__()\nself._file_system = file_system\nself._path_resolver = windows_path_resolver.WindowsPathResolver(file_system, mount_point)\nif path_attributes:\n for attribute_name, attribute_value in iter(path_attributes.items()):\n if attribute_name == u'systemr...
<|body_start_0|> super(FileSystemWinRegistryFileReader, self).__init__() self._file_system = file_system self._path_resolver = windows_path_resolver.WindowsPathResolver(file_system, mount_point) if path_attributes: for attribute_name, attribute_value in iter(path_attributes.i...
A file system-based Windows Registry file reader.
FileSystemWinRegistryFileReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSystemWinRegistryFileReader: """A file system-based Windows Registry file reader.""" def __init__(self, file_system, mount_point, path_attributes=None): """Initializes a Windows Registry file reader object. Args: file_system (dfvfs.FileSytem): file system. mount_point (dfvfs.Path...
stack_v2_sparse_classes_36k_train_026186
9,000
permissive
[ { "docstring": "Initializes a Windows Registry file reader object. Args: file_system (dfvfs.FileSytem): file system. mount_point (dfvfs.PathSpec): mount point path specification. path_attributes (Optional[dict[str, str]]): path attributes e.g. {'SystemRoot': '\\\\Windows'}", "name": "__init__", "signatu...
3
stack_v2_sparse_classes_30k_train_008815
Implement the Python class `FileSystemWinRegistryFileReader` described below. Class description: A file system-based Windows Registry file reader. Method signatures and docstrings: - def __init__(self, file_system, mount_point, path_attributes=None): Initializes a Windows Registry file reader object. Args: file_syste...
Implement the Python class `FileSystemWinRegistryFileReader` described below. Class description: A file system-based Windows Registry file reader. Method signatures and docstrings: - def __init__(self, file_system, mount_point, path_attributes=None): Initializes a Windows Registry file reader object. Args: file_syste...
0ee446ebf03d17c515f76a666bd3795e91a2dd17
<|skeleton|> class FileSystemWinRegistryFileReader: """A file system-based Windows Registry file reader.""" def __init__(self, file_system, mount_point, path_attributes=None): """Initializes a Windows Registry file reader object. Args: file_system (dfvfs.FileSytem): file system. mount_point (dfvfs.Path...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSystemWinRegistryFileReader: """A file system-based Windows Registry file reader.""" def __init__(self, file_system, mount_point, path_attributes=None): """Initializes a Windows Registry file reader object. Args: file_system (dfvfs.FileSytem): file system. mount_point (dfvfs.PathSpec): mount ...
the_stack_v2_python_sparse
plaso/preprocessors/manager.py
aarontp/plaso
train
1
80389afa393eb20ebc3429fcae5962fffb1f7523
[ "self.name = name\nself.kernel_regularizer = kernel_regularizer\nself.bias_regularizer = bias_regularizer", "func_name = 'get_critic_logits'\nnetwork = X\nprint_obj('\\n' + func_name, 'network', network)\nwith tf.variable_scope('critic', reuse=tf.AUTO_REUSE):\n for i in range(len(params['critic_num_filters']))...
<|body_start_0|> self.name = name self.kernel_regularizer = kernel_regularizer self.bias_regularizer = bias_regularizer <|end_body_0|> <|body_start_1|> func_name = 'get_critic_logits' network = X print_obj('\n' + func_name, 'network', network) with tf.variable_sc...
Critic that takes image input and outputs logits. Fields: name: str, name of `Critic`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables.
Critic
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Critic: """Critic that takes image input and outputs logits. Fields: name: str, name of `Critic`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables.""" def __init__(self, kernel_regul...
stack_v2_sparse_classes_36k_train_026187
6,232
permissive
[ { "docstring": "Instantiates and builds critic network. Args: kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables. name: str, name of critic.", "name": "__init__", "signature": "def __init__(self, ...
3
stack_v2_sparse_classes_30k_train_004676
Implement the Python class `Critic` described below. Class description: Critic that takes image input and outputs logits. Fields: name: str, name of `Critic`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables. ...
Implement the Python class `Critic` described below. Class description: Critic that takes image input and outputs logits. Fields: name: str, name of `Critic`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables. ...
f7c21af221f366b075d351deeeb00a1b266ac3e3
<|skeleton|> class Critic: """Critic that takes image input and outputs logits. Fields: name: str, name of `Critic`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables.""" def __init__(self, kernel_regul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Critic: """Critic that takes image input and outputs logits. Fields: name: str, name of `Critic`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables.""" def __init__(self, kernel_regularizer, bias_...
the_stack_v2_python_sparse
machine_learning/gan/wgan/tf_wgan/wgan_module/trainer/critic.py
ryangillard/artificial_intelligence
train
4
3b2de93dde6067a53a07372b751a86c7c2211d08
[ "n = len(matrix)\nfor i in range(n // 2):\n for j in range(n):\n matrix[i][j], matrix[n - 1 - i][j] = (matrix[n - 1 - i][j], matrix[i][j])\nfor i in range(n):\n for j in range(i):\n matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j])", "n = len(matrix)\nfor i in range(n // 2):\n for j...
<|body_start_0|> n = len(matrix) for i in range(n // 2): for j in range(n): matrix[i][j], matrix[n - 1 - i][j] = (matrix[n - 1 - i][j], matrix[i][j]) for i in range(n): for j in range(i): matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """两次翻转:水平 + 主对角线""" <|body_0|> def rotateonce(self, matrix: List[List[int]]) -> None: """一次旋转""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(matrix) for i in range(n // 2...
stack_v2_sparse_classes_36k_train_026188
1,239
no_license
[ { "docstring": "两次翻转:水平 + 主对角线", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "一次旋转", "name": "rotateonce", "signature": "def rotateonce(self, matrix: List[List[int]]) -> None" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: 两次翻转:水平 + 主对角线 - def rotateonce(self, matrix: List[List[int]]) -> None: 一次旋转
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: 两次翻转:水平 + 主对角线 - def rotateonce(self, matrix: List[List[int]]) -> None: 一次旋转 <|skeleton|> class Solution: def rotate(self...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """两次翻转:水平 + 主对角线""" <|body_0|> def rotateonce(self, matrix: List[List[int]]) -> None: """一次旋转""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """两次翻转:水平 + 主对角线""" n = len(matrix) for i in range(n // 2): for j in range(n): matrix[i][j], matrix[n - 1 - i][j] = (matrix[n - 1 - i][j], matrix[i][j]) for i in range(n): for ...
the_stack_v2_python_sparse
48.旋转图像/solution.py
QtTao/daily_leetcode
train
0
ea571de280fb5e1b4fab16906006c6b490442841
[ "first = self.findFirst(nums, target)\nlast = self.findLast(nums, target)\nif first <= last:\n return [first, last]\nelse:\n return [-1, -1]", "left, mid, right = (0, 0, len(nums) - 1)\nwhile left <= right:\n mid = (left + right) // 2\n if nums[mid] < target:\n left = mid + 1\n else:\n ...
<|body_start_0|> first = self.findFirst(nums, target) last = self.findLast(nums, target) if first <= last: return [first, last] else: return [-1, -1] <|end_body_0|> <|body_start_1|> left, mid, right = (0, 0, len(nums) - 1) while left <= right: ...
Time Complexity: O(logn). Space Complexity: O(1).
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Time Complexity: O(logn). Space Complexity: O(1).""" def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def findFirst(self, nums, target): """:type nums: List[int] :type target: int :rtype:...
stack_v2_sparse_classes_36k_train_026189
3,937
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "searchRange", "signature": "def searchRange(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "findFirst", "signature": "def findFirst(self, nums, targ...
3
null
Implement the Python class `Solution` described below. Class description: Time Complexity: O(logn). Space Complexity: O(1). Method signatures and docstrings: - def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def findFirst(self, nums, target): :type nums: List[int] :typ...
Implement the Python class `Solution` described below. Class description: Time Complexity: O(logn). Space Complexity: O(1). Method signatures and docstrings: - def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def findFirst(self, nums, target): :type nums: List[int] :typ...
551cd3b4616c16a6562eb7c577ce671b419f0616
<|skeleton|> class Solution: """Time Complexity: O(logn). Space Complexity: O(1).""" def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def findFirst(self, nums, target): """:type nums: List[int] :type target: int :rtype:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Time Complexity: O(logn). Space Complexity: O(1).""" def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" first = self.findFirst(nums, target) last = self.findLast(nums, target) if first <= last: retu...
the_stack_v2_python_sparse
python/array/0034_Find_First_and_Last_Position_of_Element_in_Sorted_Array.py
lizzzcai/leetcode
train
1
c20b5dcfd91a3d4ff20fe320b6c62a56e6fb5d53
[ "try:\n init_connection = await ConnRecord.retrieve_by_id(session, init_connection_id)\nexcept StorageNotFoundError:\n raise IntroductionError(f'Initiator connection {init_connection_id} not found')\nif ConnRecord.State.get(init_connection.state) is not ConnRecord.State.COMPLETED:\n raise IntroductionError...
<|body_start_0|> try: init_connection = await ConnRecord.retrieve_by_id(session, init_connection_id) except StorageNotFoundError: raise IntroductionError(f'Initiator connection {init_connection_id} not found') if ConnRecord.State.get(init_connection.state) is not ConnReco...
Service handler for allowing connections to exchange invitations.
DemoIntroductionService
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DemoIntroductionService: """Service handler for allowing connections to exchange invitations.""" async def start_introduction(self, init_connection_id: str, target_connection_id: str, message: str, session: ProfileSession, outbound_handler): """Start the introduction process between ...
stack_v2_sparse_classes_36k_train_026190
4,951
permissive
[ { "docstring": "Start the introduction process between two connections. Args: init_connection_id: The connection initiating the request target_connection_id: The connection which is asked for an invitation outbound_handler: The outbound handler coroutine for sending a message session: Profile session to use for...
2
null
Implement the Python class `DemoIntroductionService` described below. Class description: Service handler for allowing connections to exchange invitations. Method signatures and docstrings: - async def start_introduction(self, init_connection_id: str, target_connection_id: str, message: str, session: ProfileSession, o...
Implement the Python class `DemoIntroductionService` described below. Class description: Service handler for allowing connections to exchange invitations. Method signatures and docstrings: - async def start_introduction(self, init_connection_id: str, target_connection_id: str, message: str, session: ProfileSession, o...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class DemoIntroductionService: """Service handler for allowing connections to exchange invitations.""" async def start_introduction(self, init_connection_id: str, target_connection_id: str, message: str, session: ProfileSession, outbound_handler): """Start the introduction process between ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DemoIntroductionService: """Service handler for allowing connections to exchange invitations.""" async def start_introduction(self, init_connection_id: str, target_connection_id: str, message: str, session: ProfileSession, outbound_handler): """Start the introduction process between two connectio...
the_stack_v2_python_sparse
aries_cloudagent/protocols/introduction/v0_1/demo_service.py
hyperledger/aries-cloudagent-python
train
370
0724bdf4d66098c72e149758b00fb7edfe51d810
[ "self.id = id\nself.gallery_type = gallery_type\nself.title = title\nself.alt = alt\nself.description = description\nself.is_active = is_active\nself.is_main = is_main\nself.is_attach_file = is_attach_file\nself.sort_priority = sort_priority\nself.create_on_persian_date = create_on_persian_date\nself.meta_media_fil...
<|body_start_0|> self.id = id self.gallery_type = gallery_type self.title = title self.alt = alt self.description = description self.is_active = is_active self.is_main = is_main self.is_attach_file = is_attach_file self.sort_priority = sort_priorit...
Implementation of the 'VideoGallery' model. TODO: type model description here. Attributes: id (int): TODO: type description here. gallery_type (int): TODO: type description here. title (string): TODO: type description here. alt (string): TODO: type description here. description (string): TODO: type description here. is...
VideoGallery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoGallery: """Implementation of the 'VideoGallery' model. TODO: type model description here. Attributes: id (int): TODO: type description here. gallery_type (int): TODO: type description here. title (string): TODO: type description here. alt (string): TODO: type description here. description (...
stack_v2_sparse_classes_36k_train_026191
5,356
permissive
[ { "docstring": "Constructor for the VideoGallery class", "name": "__init__", "signature": "def __init__(self, id=None, gallery_type=None, title=None, is_active=None, is_main=None, is_attach_file=None, create_on_persian_date=None, meta_media_file_id=None, meta_media_file_url=None, popup_image_galleryies=...
2
stack_v2_sparse_classes_30k_train_018763
Implement the Python class `VideoGallery` described below. Class description: Implementation of the 'VideoGallery' model. TODO: type model description here. Attributes: id (int): TODO: type description here. gallery_type (int): TODO: type description here. title (string): TODO: type description here. alt (string): TOD...
Implement the Python class `VideoGallery` described below. Class description: Implementation of the 'VideoGallery' model. TODO: type model description here. Attributes: id (int): TODO: type description here. gallery_type (int): TODO: type description here. title (string): TODO: type description here. alt (string): TOD...
b574a76a8805b306a423229b572c36dae0159def
<|skeleton|> class VideoGallery: """Implementation of the 'VideoGallery' model. TODO: type model description here. Attributes: id (int): TODO: type description here. gallery_type (int): TODO: type description here. title (string): TODO: type description here. alt (string): TODO: type description here. description (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoGallery: """Implementation of the 'VideoGallery' model. TODO: type model description here. Attributes: id (int): TODO: type description here. gallery_type (int): TODO: type description here. title (string): TODO: type description here. alt (string): TODO: type description here. description (string): TODO...
the_stack_v2_python_sparse
easybimehlanding/models/video_gallery.py
kmelodi/EasyBimehLanding_Python
train
0
4cfec4c036af9ea970a3ca8fe8b5d4ba0cb55353
[ "self.mod_df = mod_df\noptions = [opts_dd(column, column) for column in self.mod_df.columns]\nif self.show_filter:\n filter_elements = dbc.Row([dbc.Col([dbc.Form([dcc.Input(id=ids[self.get(self.id_filter_input)], placeholder='Enter filter query', style={'width': '100%'}), dbc.Button('Apply', color='secondary', i...
<|body_start_0|> self.mod_df = mod_df options = [opts_dd(column, column) for column in self.mod_df.columns] if self.show_filter: filter_elements = dbc.Row([dbc.Col([dbc.Form([dcc.Input(id=ids[self.get(self.id_filter_input)], placeholder='Enter filter query', style={'width': '100%'}),...
Modular Dash data table with column selection and filter.
ModuleFilteredTable
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleFilteredTable: """Modular Dash data table with column selection and filter.""" def return_layout(self, ids, mod_df): """Return Dash application layout. Args: ids: `self._il` from base application mod_df: dataframe for Returns: dict: Dash HTML object""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_026192
10,244
permissive
[ { "docstring": "Return Dash application layout. Args: ids: `self._il` from base application mod_df: dataframe for Returns: dict: Dash HTML object", "name": "return_layout", "signature": "def return_layout(self, ids, mod_df)" }, { "docstring": "Register callbacks to handle user interaction. Args:...
5
stack_v2_sparse_classes_30k_train_020846
Implement the Python class `ModuleFilteredTable` described below. Class description: Modular Dash data table with column selection and filter. Method signatures and docstrings: - def return_layout(self, ids, mod_df): Return Dash application layout. Args: ids: `self._il` from base application mod_df: dataframe for Ret...
Implement the Python class `ModuleFilteredTable` described below. Class description: Modular Dash data table with column selection and filter. Method signatures and docstrings: - def return_layout(self, ids, mod_df): Return Dash application layout. Args: ids: `self._il` from base application mod_df: dataframe for Ret...
fe784f4224136e6854d9ce67628976f17a2d9433
<|skeleton|> class ModuleFilteredTable: """Modular Dash data table with column selection and filter.""" def return_layout(self, ids, mod_df): """Return Dash application layout. Args: ids: `self._il` from base application mod_df: dataframe for Returns: dict: Dash HTML object""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModuleFilteredTable: """Modular Dash data table with column selection and filter.""" def return_layout(self, ids, mod_df): """Return Dash application layout. Args: ids: `self._il` from base application mod_df: dataframe for Returns: dict: Dash HTML object""" self.mod_df = mod_df o...
the_stack_v2_python_sparse
dash_charts/modules_datatable.py
KyleKing/dash_charts
train
20
b9d676a34e4a83f592580247ecde07aa85750585
[ "queryset = kwargs.get('queryset')\nfilters = None\nfilter_map = kwargs.get('filter_map', {})\nfg = FilterGenerator(queryset.model, filter_map=filter_map)\nif len(request.data):\n fg = FilterGenerator(queryset.model)\n filters = fg.create_from_request_body(request.data)\nelse:\n filters = Q(**fg.create_fro...
<|body_start_0|> queryset = kwargs.get('queryset') filters = None filter_map = kwargs.get('filter_map', {}) fg = FilterGenerator(queryset.model, filter_map=filter_map) if len(request.data): fg = FilterGenerator(queryset.model) filters = fg.create_from_requ...
Handles queryset filtering.
FilterQuerysetMixin
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterQuerysetMixin: """Handles queryset filtering.""" def filter_records(self, request, *args, **kwargs): """Filter a queryset based on request parameters""" <|body_0|> def order_records(self, request, *args, **kwargs): """Order a queryset based on request param...
stack_v2_sparse_classes_36k_train_026193
10,956
permissive
[ { "docstring": "Filter a queryset based on request parameters", "name": "filter_records", "signature": "def filter_records(self, request, *args, **kwargs)" }, { "docstring": "Order a queryset based on request parameters.", "name": "order_records", "signature": "def order_records(self, re...
3
stack_v2_sparse_classes_30k_train_003580
Implement the Python class `FilterQuerysetMixin` described below. Class description: Handles queryset filtering. Method signatures and docstrings: - def filter_records(self, request, *args, **kwargs): Filter a queryset based on request parameters - def order_records(self, request, *args, **kwargs): Order a queryset b...
Implement the Python class `FilterQuerysetMixin` described below. Class description: Handles queryset filtering. Method signatures and docstrings: - def filter_records(self, request, *args, **kwargs): Filter a queryset based on request parameters - def order_records(self, request, *args, **kwargs): Order a queryset b...
38f920438697930ae3ac57bbcaae9034877d8fb7
<|skeleton|> class FilterQuerysetMixin: """Handles queryset filtering.""" def filter_records(self, request, *args, **kwargs): """Filter a queryset based on request parameters""" <|body_0|> def order_records(self, request, *args, **kwargs): """Order a queryset based on request param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterQuerysetMixin: """Handles queryset filtering.""" def filter_records(self, request, *args, **kwargs): """Filter a queryset based on request parameters""" queryset = kwargs.get('queryset') filters = None filter_map = kwargs.get('filter_map', {}) fg = FilterGene...
the_stack_v2_python_sparse
usaspending_api/common/mixins.py
fedspendingtransparency/usaspending-api
train
276
d97de1797a8f6fd2c8d495aa144edbf2e8c1a33a
[ "is_existed = validated_data['is_existed']\ncode = validated_data['code']\nnew_phone = validated_data['phone']\nif is_existed:\n old_phone = validated_data['old_phone']\n is_success = cache.check_code(old_phone, code)\nelse:\n is_success = cache.check_code(new_phone, code)\nif is_success:\n instance.pho...
<|body_start_0|> is_existed = validated_data['is_existed'] code = validated_data['code'] new_phone = validated_data['phone'] if is_existed: old_phone = validated_data['old_phone'] is_success = cache.check_code(old_phone, code) else: is_success ...
绑定(改绑)用户邮箱或者手机号 需发送验证码验证
BindEmailOrPhone
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BindEmailOrPhone: """绑定(改绑)用户邮箱或者手机号 需发送验证码验证""" def bind_phone(cache, instance, validated_data): """改绑手机号""" <|body_0|> def bind_email(cache, instance, validated_data): """改绑邮箱""" <|body_1|> def factory(self, way, validated_data, instance): ...
stack_v2_sparse_classes_36k_train_026194
28,563
permissive
[ { "docstring": "改绑手机号", "name": "bind_phone", "signature": "def bind_phone(cache, instance, validated_data)" }, { "docstring": "改绑邮箱", "name": "bind_email", "signature": "def bind_email(cache, instance, validated_data)" }, { "docstring": "简单工厂管理手机号和邮箱的改绑", "name": "factory", ...
4
stack_v2_sparse_classes_30k_train_002912
Implement the Python class `BindEmailOrPhone` described below. Class description: 绑定(改绑)用户邮箱或者手机号 需发送验证码验证 Method signatures and docstrings: - def bind_phone(cache, instance, validated_data): 改绑手机号 - def bind_email(cache, instance, validated_data): 改绑邮箱 - def factory(self, way, validated_data, instance): 简单工厂管理手机号和邮箱...
Implement the Python class `BindEmailOrPhone` described below. Class description: 绑定(改绑)用户邮箱或者手机号 需发送验证码验证 Method signatures and docstrings: - def bind_phone(cache, instance, validated_data): 改绑手机号 - def bind_email(cache, instance, validated_data): 改绑邮箱 - def factory(self, way, validated_data, instance): 简单工厂管理手机号和邮箱...
13cb59130d15e782f78bc5148409bef0f1c516e0
<|skeleton|> class BindEmailOrPhone: """绑定(改绑)用户邮箱或者手机号 需发送验证码验证""" def bind_phone(cache, instance, validated_data): """改绑手机号""" <|body_0|> def bind_email(cache, instance, validated_data): """改绑邮箱""" <|body_1|> def factory(self, way, validated_data, instance): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BindEmailOrPhone: """绑定(改绑)用户邮箱或者手机号 需发送验证码验证""" def bind_phone(cache, instance, validated_data): """改绑手机号""" is_existed = validated_data['is_existed'] code = validated_data['code'] new_phone = validated_data['phone'] if is_existed: old_phone = validate...
the_stack_v2_python_sparse
user_app/views/personal_api.py
lmyfzx/Django-Mall
train
0
b331ca12b914add65c8be2a4846964f335c4ccbc
[ "bands = {'U': 0, 'B': 1, 'V': 2, 'K': 3, 'g': 4, 'r': 5, 'i': 6, 'z': 7}\nnband = bands[band]\npos = self.snapshot_set.get_data(4, 'Position', segment=fn).astype(np.float32)\nhh = hhmult * np.ones(np.shape(pos)[0], dtype=np.float32)\nind = self.particles_near_lines(pos, hh, self.axis, self.cofm)\nif np.size(ind) =...
<|body_start_0|> bands = {'U': 0, 'B': 1, 'V': 2, 'K': 3, 'g': 4, 'r': 5, 'i': 6, 'z': 7} nband = bands[band] pos = self.snapshot_set.get_data(4, 'Position', segment=fn).astype(np.float32) hh = hhmult * np.ones(np.shape(pos)[0], dtype=np.float32) ind = self.particles_near_lines(p...
Class to compute the emission from stars in B band around the DLA spectrum
EmissionSpectra
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmissionSpectra: """Class to compute the emission from stars in B band around the DLA spectrum""" def _read_stellar_data(self, fn, band, hhmult=10.0): """Read the particle data for a single interpolation""" <|body_0|> def get_emflux(self, band, pixelsz=1): """Get...
stack_v2_sparse_classes_36k_train_026195
6,065
permissive
[ { "docstring": "Read the particle data for a single interpolation", "name": "_read_stellar_data", "signature": "def _read_stellar_data(self, fn, band, hhmult=10.0)" }, { "docstring": "Get the density weighted flux in each pixel for a given species. band: rest-frame optical band observed in pixel...
3
stack_v2_sparse_classes_30k_test_000949
Implement the Python class `EmissionSpectra` described below. Class description: Class to compute the emission from stars in B band around the DLA spectrum Method signatures and docstrings: - def _read_stellar_data(self, fn, band, hhmult=10.0): Read the particle data for a single interpolation - def get_emflux(self, ...
Implement the Python class `EmissionSpectra` described below. Class description: Class to compute the emission from stars in B band around the DLA spectrum Method signatures and docstrings: - def _read_stellar_data(self, fn, band, hhmult=10.0): Read the particle data for a single interpolation - def get_emflux(self, ...
be5b9d6e7b25dc5e978e3f926f0882889417c4a8
<|skeleton|> class EmissionSpectra: """Class to compute the emission from stars in B band around the DLA spectrum""" def _read_stellar_data(self, fn, band, hhmult=10.0): """Read the particle data for a single interpolation""" <|body_0|> def get_emflux(self, band, pixelsz=1): """Get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmissionSpectra: """Class to compute the emission from stars in B band around the DLA spectrum""" def _read_stellar_data(self, fn, band, hhmult=10.0): """Read the particle data for a single interpolation""" bands = {'U': 0, 'B': 1, 'V': 2, 'K': 3, 'g': 4, 'r': 5, 'i': 6, 'z': 7} n...
the_stack_v2_python_sparse
fake_spectra/emission.py
sbird/fake_spectra
train
10
ab4d7520b260dd4c19a6fa0abab01fcbd97b0a88
[ "super().__init__()\nself.p = p\nif p_mode != 'per_batch':\n raise ValueError(f'p_mode = \"{p_mode}\" is not supported')\nself.p_mode = p_mode\nself.shuffle = shuffle\nself.are_parameters_frozen = False\nif output_type is None:\n warnings.warn(f\"Transforms now expect an `output_type` argument that currently ...
<|body_start_0|> super().__init__() self.p = p if p_mode != 'per_batch': raise ValueError(f'p_mode = "{p_mode}" is not supported') self.p_mode = p_mode self.shuffle = shuffle self.are_parameters_frozen = False if output_type is None: warnin...
This class can apply a sequence of transforms to waveforms.
BaseCompose
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseCompose: """This class can apply a sequence of transforms to waveforms.""" def __init__(self, transforms: List[torch.nn.Module], shuffle: bool=False, p: float=1.0, p_mode='per_batch', output_type: Optional[str]=None): """:param transforms: List of waveform transform instances :pa...
stack_v2_sparse_classes_36k_train_026196
31,221
no_license
[ { "docstring": ":param transforms: List of waveform transform instances :param shuffle: Should the order of transforms be shuffled? :param p: The probability of applying the Compose to the given batch. :param p_mode: Only \"per_batch\" is supported at the moment. :param output_type: This optional argument can b...
4
null
Implement the Python class `BaseCompose` described below. Class description: This class can apply a sequence of transforms to waveforms. Method signatures and docstrings: - def __init__(self, transforms: List[torch.nn.Module], shuffle: bool=False, p: float=1.0, p_mode='per_batch', output_type: Optional[str]=None): :p...
Implement the Python class `BaseCompose` described below. Class description: This class can apply a sequence of transforms to waveforms. Method signatures and docstrings: - def __init__(self, transforms: List[torch.nn.Module], shuffle: bool=False, p: float=1.0, p_mode='per_batch', output_type: Optional[str]=None): :p...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class BaseCompose: """This class can apply a sequence of transforms to waveforms.""" def __init__(self, transforms: List[torch.nn.Module], shuffle: bool=False, p: float=1.0, p_mode='per_batch', output_type: Optional[str]=None): """:param transforms: List of waveform transform instances :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseCompose: """This class can apply a sequence of transforms to waveforms.""" def __init__(self, transforms: List[torch.nn.Module], shuffle: bool=False, p: float=1.0, p_mode='per_batch', output_type: Optional[str]=None): """:param transforms: List of waveform transform instances :param shuffle: ...
the_stack_v2_python_sparse
generated/test_asteroid_team_torch_audiomentations.py
jansel/pytorch-jit-paritybench
train
35
1497f7442f6063be560803022fa58bda48ed1b2f
[ "def binary_search(nums, target, comparator):\n left, right = (0, len(nums) - 1)\n while left <= right:\n mid = left + (right - left) // 2\n if comparator(nums[mid], target):\n left = mid + 1\n else:\n right = mid - 1\n return left\nleft = binary_search(nums, targ...
<|body_start_0|> def binary_search(nums, target, comparator): left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if comparator(nums[mid], target): left = mid + 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def searchRange_v2(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def searchRange_l...
stack_v2_sparse_classes_36k_train_026197
2,883
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "searchRange", "signature": "def searchRange(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "searchRange_v2", "signature": "def searchRange_v2(...
3
stack_v2_sparse_classes_30k_train_013487
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def searchRange_v2(self, nums, target): :type nums: List[int] :type target: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def searchRange_v2(self, nums, target): :type nums: List[int] :type target: int :...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def searchRange_v2(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def searchRange_l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" def binary_search(nums, target, comparator): left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 ...
the_stack_v2_python_sparse
src/lt_34.py
oxhead/CodingYourWay
train
0
fe26f067060659ce6fe991b23286025bff38467f
[ "self._embeddings_index = {}\nself.embedding_dimension = embedding_dimension\nself.embedding_matrix = np.zeros((len(word_idx) + 1, self.embedding_dimension))\nself.__read_vectors__()\nself.__populate_embedding__(word_idx)", "path = get_file(self.__GLOVE_FILE__, origin=self.__URL__, cache_subdir=self.__EMBEDDING_C...
<|body_start_0|> self._embeddings_index = {} self.embedding_dimension = embedding_dimension self.embedding_matrix = np.zeros((len(word_idx) + 1, self.embedding_dimension)) self.__read_vectors__() self.__populate_embedding__(word_idx) <|end_body_0|> <|body_start_1|> path ...
GloveLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GloveLoader: def __init__(self, word_idx, embedding_dimension=100): """Read glove vectors from file. It creates a cache on home folder using Keras function :param embedding_dimension: (dimensions of glove 50,100,)""" <|body_0|> def __read_vectors__(self): """Read vec...
stack_v2_sparse_classes_36k_train_026198
1,919
permissive
[ { "docstring": "Read glove vectors from file. It creates a cache on home folder using Keras function :param embedding_dimension: (dimensions of glove 50,100,)", "name": "__init__", "signature": "def __init__(self, word_idx, embedding_dimension=100)" }, { "docstring": "Read vectors from glove", ...
3
stack_v2_sparse_classes_30k_test_001155
Implement the Python class `GloveLoader` described below. Class description: Implement the GloveLoader class. Method signatures and docstrings: - def __init__(self, word_idx, embedding_dimension=100): Read glove vectors from file. It creates a cache on home folder using Keras function :param embedding_dimension: (dim...
Implement the Python class `GloveLoader` described below. Class description: Implement the GloveLoader class. Method signatures and docstrings: - def __init__(self, word_idx, embedding_dimension=100): Read glove vectors from file. It creates a cache on home folder using Keras function :param embedding_dimension: (dim...
01214cf44f9e69b64c341c4b6676db73e5ca7966
<|skeleton|> class GloveLoader: def __init__(self, word_idx, embedding_dimension=100): """Read glove vectors from file. It creates a cache on home folder using Keras function :param embedding_dimension: (dimensions of glove 50,100,)""" <|body_0|> def __read_vectors__(self): """Read vec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GloveLoader: def __init__(self, word_idx, embedding_dimension=100): """Read glove vectors from file. It creates a cache on home folder using Keras function :param embedding_dimension: (dimensions of glove 50,100,)""" self._embeddings_index = {} self.embedding_dimension = embedding_dime...
the_stack_v2_python_sparse
pypagai/util/glove.py
gcouti/pypagAI
train
1
e3876a5cd38e7fac9a759dccb6292b624bba5118
[ "first_name = self.cleaned_data['first_name']\nif first_name.strip(letters):\n raise forms.ValidationError('First Name is invalid')\nreturn first_name", "last_name = self.cleaned_data['last_name']\nif last_name.strip(letters):\n raise forms.ValidationError('Last Name is invalid')\nreturn last_name", "user...
<|body_start_0|> first_name = self.cleaned_data['first_name'] if first_name.strip(letters): raise forms.ValidationError('First Name is invalid') return first_name <|end_body_0|> <|body_start_1|> last_name = self.cleaned_data['last_name'] if last_name.strip(letters): ...
User Registration form
UserRegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRegisterForm: """User Registration form""" def clean_first_name(self): """Validation""" <|body_0|> def clean_last_name(self): """Validation""" <|body_1|> def clean_email(self): """Validation""" <|body_2|> def save(self): ...
stack_v2_sparse_classes_36k_train_026199
8,285
no_license
[ { "docstring": "Validation", "name": "clean_first_name", "signature": "def clean_first_name(self)" }, { "docstring": "Validation", "name": "clean_last_name", "signature": "def clean_last_name(self)" }, { "docstring": "Validation", "name": "clean_email", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_010091
Implement the Python class `UserRegisterForm` described below. Class description: User Registration form Method signatures and docstrings: - def clean_first_name(self): Validation - def clean_last_name(self): Validation - def clean_email(self): Validation - def save(self): Validation
Implement the Python class `UserRegisterForm` described below. Class description: User Registration form Method signatures and docstrings: - def clean_first_name(self): Validation - def clean_last_name(self): Validation - def clean_email(self): Validation - def save(self): Validation <|skeleton|> class UserRegisterF...
65d9aa549a0d76f58cb89cac5da4a3085a2efd97
<|skeleton|> class UserRegisterForm: """User Registration form""" def clean_first_name(self): """Validation""" <|body_0|> def clean_last_name(self): """Validation""" <|body_1|> def clean_email(self): """Validation""" <|body_2|> def save(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserRegisterForm: """User Registration form""" def clean_first_name(self): """Validation""" first_name = self.cleaned_data['first_name'] if first_name.strip(letters): raise forms.ValidationError('First Name is invalid') return first_name def clean_last_nam...
the_stack_v2_python_sparse
nitortest/forms.py
ManishSinghFartyal/InternalGit
train
0