blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72e3a3626fa77518d430fcbd040e212681b45a49 | [
"super().__init__(*args, **kwargs)\nself.search_area_factor = search_area_factor\nself.output_sz = output_sz\nself.center_jitter_factor = center_jitter_factor\nself.scale_jitter_factor = scale_jitter_factor\nself.proposal_params = proposal_params\nself.mode = mode",
"jittered_size = box[2:4] * torch.exp(torch.ran... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.search_area_factor = search_area_factor
self.output_sz = output_sz
self.center_jitter_factor = center_jitter_factor
self.scale_jitter_factor = scale_jitter_factor
self.proposal_params = proposal_params
self.m... | The processing class used for training ATOM. The images are processed in the following way. First, the target bounding box is jittered by adding some noise. Next, a square region (called search region ) centered at the jittered target center, and of area search_area_factor^2 times the area of the jittered box is croppe... | ATOMProcessing | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ATOMProcessing:
"""The processing class used for training ATOM. The images are processed in the following way. First, the target bounding box is jittered by adding some noise. Next, a square region (called search region ) centered at the jittered target center, and of area search_area_factor^2 ti... | stack_v2_sparse_classes_10k_train_007000 | 13,090 | permissive | [
{
"docstring": "args: search_area_factor - The size of the search region relative to the target size. output_sz - An integer, denoting the size to which the search region is resized. The search region is always square. center_jitter_factor - A dict containing the amount of jittering to be applied to the target ... | 4 | stack_v2_sparse_classes_30k_train_005487 | Implement the Python class `ATOMProcessing` described below.
Class description:
The processing class used for training ATOM. The images are processed in the following way. First, the target bounding box is jittered by adding some noise. Next, a square region (called search region ) centered at the jittered target cent... | Implement the Python class `ATOMProcessing` described below.
Class description:
The processing class used for training ATOM. The images are processed in the following way. First, the target bounding box is jittered by adding some noise. Next, a square region (called search region ) centered at the jittered target cent... | f96bf9a810f77885b3faa219f06a82c6e22cb824 | <|skeleton|>
class ATOMProcessing:
"""The processing class used for training ATOM. The images are processed in the following way. First, the target bounding box is jittered by adding some noise. Next, a square region (called search region ) centered at the jittered target center, and of area search_area_factor^2 ti... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ATOMProcessing:
"""The processing class used for training ATOM. The images are processed in the following way. First, the target bounding box is jittered by adding some noise. Next, a square region (called search region ) centered at the jittered target center, and of area search_area_factor^2 times the area ... | the_stack_v2_python_sparse | mfDiMP/ltr/data/processing.py | zhanglichao/end2end_rgbt_tracking | train | 67 |
5ecc442826717d82c7d6b02bbad9ced2c15562f3 | [
"scope = parent.create_child_scope()\nif self.action_pattern is not None:\n self.action_pattern.declare_in(scope)\nreturn scope",
"scope = automaton.scope\nself.location.validate(automaton)\nif self.location not in automaton.locations:\n raise errors.ModelingError(f'source location of edge {self} is not a l... | <|body_start_0|>
scope = parent.create_child_scope()
if self.action_pattern is not None:
self.action_pattern.declare_in(scope)
return scope
<|end_body_0|>
<|body_start_1|>
scope = automaton.scope
self.location.validate(automaton)
if self.location not in autom... | Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation: An optional annotation of the ... | Edge | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Edge:
"""Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation... | stack_v2_sparse_classes_10k_train_007001 | 17,705 | permissive | [
{
"docstring": "Creates an *edge scope* with the given parent scope. .. warning:: Used for *value passing* an experimental Momba feature. Value passing is not part of the official JANI specification.",
"name": "create_edge_scope",
"signature": "def create_edge_scope(self, parent: context.Scope) -> conte... | 2 | stack_v2_sparse_classes_30k_train_001834 | Implement the Python class `Edge` described below.
Class description:
Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: Th... | Implement the Python class `Edge` described below.
Class description:
Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: Th... | 3f49b83b0107fab13406f9e5ecc3c597c8b85ab9 | <|skeleton|>
class Edge:
"""Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Edge:
"""Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation: An optional... | the_stack_v2_python_sparse | momba/model/automata.py | koehlma/momba | train | 23 |
3a8d93b88dd5712dd86d7208bf715837ca543cb7 | [
"parser.add_argument('--service', '-s', help='Limit to specific service.')\nparser.add_argument('--version', '-v', help='Limit to specific version.')\nparser.add_argument('--limit', required=False, type=int, default=200, help='Number of log entries to show.')\nparser.add_argument('--level', required=False, default=... | <|body_start_0|>
parser.add_argument('--service', '-s', help='Limit to specific service.')
parser.add_argument('--version', '-v', help='Limit to specific version.')
parser.add_argument('--limit', required=False, type=int, default=200, help='Number of log entries to show.')
parser.add_arg... | Reads log entries for the current App Engine app. | Read | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Read:
"""Reads log entries for the current App Engine app."""
def Args(parser):
"""Register flags for this command."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs this command. Args: args: an argparse namespace. All the argument... | stack_v2_sparse_classes_10k_train_007002 | 4,274 | permissive | [
{
"docstring": "Register flags for this command.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: The list of... | 2 | stack_v2_sparse_classes_30k_train_004628 | Implement the Python class `Read` described below.
Class description:
Reads log entries for the current App Engine app.
Method signatures and docstrings:
- def Args(parser): Register flags for this command.
- def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namesp... | Implement the Python class `Read` described below.
Class description:
Reads log entries for the current App Engine app.
Method signatures and docstrings:
- def Args(parser): Register flags for this command.
- def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namesp... | c97dd7b906e5ef3ec157581fd0bcadd3e3fc220e | <|skeleton|>
class Read:
"""Reads log entries for the current App Engine app."""
def Args(parser):
"""Register flags for this command."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs this command. Args: args: an argparse namespace. All the argument... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Read:
"""Reads log entries for the current App Engine app."""
def Args(parser):
"""Register flags for this command."""
parser.add_argument('--service', '-s', help='Limit to specific service.')
parser.add_argument('--version', '-v', help='Limit to specific version.')
parser... | the_stack_v2_python_sparse | files/home/gcloud/google-cloud-sdk/lib/surface/app/logs/read.py | vo0doO/com.termux | train | 2 |
06cf7d943386aae8856e2ed875a8becd2816a943 | [
"if len(prices) < 2:\n return 0\ndp = [[0 for _ in range(2)] for _ in range(len(prices))]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\nfor i in range(1, len(prices)):\n dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0])\n dp[i][1] = max(dp[i - 1][1], -prices[i])\nreturn dp[-1][0]",
"if len(prices) < 2:\n ... | <|body_start_0|>
if len(prices) < 2:
return 0
dp = [[0 for _ in range(2)] for _ in range(len(prices))]
dp[0][0] = 0
dp[0][1] = -prices[0]
for i in range(1, len(prices)):
dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0])
dp[i][1] = max(dp[i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:"""
<|body_0|>
def maxProfit1(self, prices: List[int]) -> int:
"""空间优化 :param pri... | stack_v2_sparse_classes_10k_train_007003 | 1,849 | no_license | [
{
"docstring": "最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:",
"name": "maxProfit",
"signature": "def maxProfit(self, prices: List[int]) -> int"
},
{
"docstring": "空间优化 :param prices: :return:",
"name": "maxPro... | 2 | stack_v2_sparse_classes_30k_train_005929 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: 最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:
- de... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: 最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:
- de... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:"""
<|body_0|>
def maxProfit1(self, prices: List[int]) -> int:
"""空间优化 :param pri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:"""
if len(prices) < 2:
return 0
dp = [[0 for _ in range(2)] for _ in range(len(prices))... | the_stack_v2_python_sparse | datastructure/dp_exercise/MaxProfit.py | yinhuax/leet_code | train | 0 | |
5e4198dcc9da98e7c4922d426edff324a07f9969 | [
"@self.router.get('/info', response_model=Dict[str, Info], response_model_exclude={'minzoom', 'maxzoom', 'center'}, response_model_exclude_none=True, responses={200: {'description': \"Return dataset's basic info or the list of available assets.\"}})\ndef info(src_path=Depends(self.path_dependency), asset_params=Dep... | <|body_start_0|>
@self.router.get('/info', response_model=Dict[str, Info], response_model_exclude={'minzoom', 'maxzoom', 'center'}, response_model_exclude_none=True, responses={200: {'description': "Return dataset's basic info or the list of available assets."}})
def info(src_path=Depends(self.path_depe... | Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() and the .part() methods will receive assets,... | MultiBaseTilerFactory | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiBaseTilerFactory:
"""Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .previ... | stack_v2_sparse_classes_10k_train_007004 | 48,399 | permissive | [
{
"docstring": "Register /info endpoint.",
"name": "info",
"signature": "def info(self)"
},
{
"docstring": "Register /metadata endpoint.",
"name": "metadata",
"signature": "def metadata(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004723 | Implement the Python class `MultiBaseTilerFactory` described below.
Class description:
Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dep... | Implement the Python class `MultiBaseTilerFactory` described below.
Class description:
Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dep... | 2168c9284b39a46c4d1a095542c77addc690a738 | <|skeleton|>
class MultiBaseTilerFactory:
"""Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .previ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiBaseTilerFactory:
"""Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() and the ... | the_stack_v2_python_sparse | src/titiler/core/titiler/core/factory.py | kylebarron/titiler | train | 0 |
f17a3d0979ff42510bd543dc08890c82b9ab80a0 | [
"mru = self._GetValueFromStructure(structure, 'mru')\nif not mru:\n return\nevent_data = PopularityContestEventData()\nevent_data.mru = mru\nevent_data.package = self._GetValueFromStructure(structure, 'package')\nevent_data.record_tag = self._GetValueFromStructure(structure, 'tag')\naccess_time = self._GetValueF... | <|body_start_0|>
mru = self._GetValueFromStructure(structure, 'mru')
if not mru:
return
event_data = PopularityContestEventData()
event_data.mru = mru
event_data.package = self._GetValueFromStructure(structure, 'package')
event_data.record_tag = self._GetValue... | Parse popularity contest log files. | PopularityContestParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PopularityContestParser:
"""Parse popularity contest log files."""
def _ParseLogLine(self, parser_mediator, structure):
"""Extracts events from a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. s... | stack_v2_sparse_classes_10k_train_007005 | 11,054 | permissive | [
{
"docstring": "Extracts events from a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. structure (pyparsing.ParseResults): structure parsed from the log file.",
"name": "_ParseLogLine",
"signature": "def _ParseLogLi... | 3 | stack_v2_sparse_classes_30k_train_006091 | Implement the Python class `PopularityContestParser` described below.
Class description:
Parse popularity contest log files.
Method signatures and docstrings:
- def _ParseLogLine(self, parser_mediator, structure): Extracts events from a log line. Args: parser_mediator (ParserMediator): mediates interactions between p... | Implement the Python class `PopularityContestParser` described below.
Class description:
Parse popularity contest log files.
Method signatures and docstrings:
- def _ParseLogLine(self, parser_mediator, structure): Extracts events from a log line. Args: parser_mediator (ParserMediator): mediates interactions between p... | c69b2952b608cfce47ff8fd0d1409d856be35cb1 | <|skeleton|>
class PopularityContestParser:
"""Parse popularity contest log files."""
def _ParseLogLine(self, parser_mediator, structure):
"""Extracts events from a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PopularityContestParser:
"""Parse popularity contest log files."""
def _ParseLogLine(self, parser_mediator, structure):
"""Extracts events from a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. structure (pyp... | the_stack_v2_python_sparse | plaso/parsers/popcontest.py | cyb3rfox/plaso | train | 3 |
61e555092a5fbd7720819b61a81a895a1a4dbe7f | [
"super().pre_craft(**kwargs)\ncrafter = self.crafter\nfor skill_name, min_value in self.skill_requirements:\n skill_value = crafter.attributes.get(skill_name)\n if skill_value is None or skill_value < min_value:\n self.msg(self.error_too_low_skill_level.format(skill_name=skill_name, spell=self.name))\n... | <|body_start_0|>
super().pre_craft(**kwargs)
crafter = self.crafter
for skill_name, min_value in self.skill_requirements:
skill_value = crafter.attributes.get(skill_name)
if skill_value is None or skill_value < min_value:
self.msg(self.error_too_low_skill_... | A base 'recipe' to represent magical spells. We *could* treat this just like the sword above - by combining the wand and spellbook to make a fireball object that the user can then throw with another command. For this example we instead generate 'magical effects' as strings+values that we would then supposedly inject in... | _MagicRecipe | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _MagicRecipe:
"""A base 'recipe' to represent magical spells. We *could* treat this just like the sword above - by combining the wand and spellbook to make a fireball object that the user can then throw with another command. For this example we instead generate 'magical effects' as strings+values... | stack_v2_sparse_classes_10k_train_007006 | 17,892 | permissive | [
{
"docstring": "This is where we do input validation. We want to do the normal validation of the tools, but also check for a skill on the crafter. This must set the result on `self.validated_inputs`. We also set the crafter's relevant skill value on `self.skill_roll_value`. Args: **kwargs: Any optional extra kw... | 3 | null | Implement the Python class `_MagicRecipe` described below.
Class description:
A base 'recipe' to represent magical spells. We *could* treat this just like the sword above - by combining the wand and spellbook to make a fireball object that the user can then throw with another command. For this example we instead gener... | Implement the Python class `_MagicRecipe` described below.
Class description:
A base 'recipe' to represent magical spells. We *could* treat this just like the sword above - by combining the wand and spellbook to make a fireball object that the user can then throw with another command. For this example we instead gener... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class _MagicRecipe:
"""A base 'recipe' to represent magical spells. We *could* treat this just like the sword above - by combining the wand and spellbook to make a fireball object that the user can then throw with another command. For this example we instead generate 'magical effects' as strings+values... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _MagicRecipe:
"""A base 'recipe' to represent magical spells. We *could* treat this just like the sword above - by combining the wand and spellbook to make a fireball object that the user can then throw with another command. For this example we instead generate 'magical effects' as strings+values that we woul... | the_stack_v2_python_sparse | evennia/contrib/game_systems/crafting/example_recipes.py | evennia/evennia | train | 1,781 |
08e2adc41ef8482c92f6fe2c2c6e43e591e0754a | [
"while len(Solution.F) <= n:\n i = len(Solution.F)\n Solution.F.append(sys.maxint)\n j = 1\n while i - j * j >= 0:\n Solution.F[i] = min(Solution.F[i], Solution.F[i - j * j] + 1)\n j += 1\nreturn Solution.F[n]",
"q = [0]\nvisited = [False for _ in xrange(n + 1)]\nlevel = 0\nwhile q:\n ... | <|body_start_0|>
while len(Solution.F) <= n:
i = len(Solution.F)
Solution.F.append(sys.maxint)
j = 1
while i - j * j >= 0:
Solution.F[i] = min(Solution.F[i], Solution.F[i - j * j] + 1)
j += 1
return Solution.F[n]
<|end_body_... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares(self, n):
"""static dp F_i = min(F_{i - j^2}+1, orall j) O(n), think it as a tree, cache tree O(m+n) = O(2n); rather than O(n sqrt(n)) backward"""
<|body_0|>
def numSquares_bfs(self, n):
"""bfs the q stores the intermediate result of sum of s... | stack_v2_sparse_classes_10k_train_007007 | 2,074 | permissive | [
{
"docstring": "static dp F_i = min(F_{i - j^2}+1, orall j) O(n), think it as a tree, cache tree O(m+n) = O(2n); rather than O(n sqrt(n)) backward",
"name": "numSquares",
"signature": "def numSquares(self, n)"
},
{
"docstring": "bfs the q stores the intermediate result of sum of squares :type n:... | 3 | stack_v2_sparse_classes_30k_train_004299 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n): static dp F_i = min(F_{i - j^2}+1, orall j) O(n), think it as a tree, cache tree O(m+n) = O(2n); rather than O(n sqrt(n)) backward
- def numSquares_bfs(s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n): static dp F_i = min(F_{i - j^2}+1, orall j) O(n), think it as a tree, cache tree O(m+n) = O(2n); rather than O(n sqrt(n)) backward
- def numSquares_bfs(s... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Solution:
def numSquares(self, n):
"""static dp F_i = min(F_{i - j^2}+1, orall j) O(n), think it as a tree, cache tree O(m+n) = O(2n); rather than O(n sqrt(n)) backward"""
<|body_0|>
def numSquares_bfs(self, n):
"""bfs the q stores the intermediate result of sum of s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numSquares(self, n):
"""static dp F_i = min(F_{i - j^2}+1, orall j) O(n), think it as a tree, cache tree O(m+n) = O(2n); rather than O(n sqrt(n)) backward"""
while len(Solution.F) <= n:
i = len(Solution.F)
Solution.F.append(sys.maxint)
j = 1
... | the_stack_v2_python_sparse | 279 Perfect Squares.py | Aminaba123/LeetCode | train | 1 | |
b7bfff15aca54c782a99c93dae68127b372c056c | [
"if section is None and option is not None:\n raise ValueError('--section not specified')\npath = self.CONFIG_BASEURL\nif section is not None and option is None:\n path += '/' + section\nelif section is not None and option is not None:\n path += '/'.join(['', section, option])\nurl = build_url(choice(self.... | <|body_start_0|>
if section is None and option is not None:
raise ValueError('--section not specified')
path = self.CONFIG_BASEURL
if section is not None and option is None:
path += '/' + section
elif section is not None and option is not None:
path +=... | Client class for working with the configuration | ConfigClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigClient:
"""Client class for working with the configuration"""
def get_config(self, section=None, option=None):
"""Sends the request to get the matching configuration. :param section: the optional name of the section. :param option: the optional option within the section. :retur... | stack_v2_sparse_classes_10k_train_007008 | 4,460 | permissive | [
{
"docstring": "Sends the request to get the matching configuration. :param section: the optional name of the section. :param option: the optional option within the section. :return: dictionary containing the configuration.",
"name": "get_config",
"signature": "def get_config(self, section=None, option=... | 3 | null | Implement the Python class `ConfigClient` described below.
Class description:
Client class for working with the configuration
Method signatures and docstrings:
- def get_config(self, section=None, option=None): Sends the request to get the matching configuration. :param section: the optional name of the section. :par... | Implement the Python class `ConfigClient` described below.
Class description:
Client class for working with the configuration
Method signatures and docstrings:
- def get_config(self, section=None, option=None): Sends the request to get the matching configuration. :param section: the optional name of the section. :par... | 7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b | <|skeleton|>
class ConfigClient:
"""Client class for working with the configuration"""
def get_config(self, section=None, option=None):
"""Sends the request to get the matching configuration. :param section: the optional name of the section. :param option: the optional option within the section. :retur... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConfigClient:
"""Client class for working with the configuration"""
def get_config(self, section=None, option=None):
"""Sends the request to get the matching configuration. :param section: the optional name of the section. :param option: the optional option within the section. :return: dictionary... | the_stack_v2_python_sparse | lib/rucio/client/configclient.py | rucio/rucio | train | 232 |
0245cd05a02d242871dace80def4f60f8c9c72d9 | [
"self.initial = initial\nself.ids = list()\nself.num_states = self._number_states(self.initial, 0, self.ids)",
"if state.number is None:\n state.number = next_number\n next_number += 1\n for diedge, target in state._all_transitions():\n if diedge is not None:\n if diedge.srcID not in id... | <|body_start_0|>
self.initial = initial
self.ids = list()
self.num_states = self._number_states(self.initial, 0, self.ids)
<|end_body_0|>
<|body_start_1|>
if state.number is None:
state.number = next_number
next_number += 1
for diedge, target in state... | A finite automaton. Attributes: initial -- The initial state of the automaton ids -- The list of node IDs of the motif in the automaton num_states -- The number of states in this automaton | Automaton | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Automaton:
"""A finite automaton. Attributes: initial -- The initial state of the automaton ids -- The list of node IDs of the motif in the automaton num_states -- The number of states in this automaton"""
def __init__(self, initial):
"""Create a new automaton with the given initial ... | stack_v2_sparse_classes_10k_train_007009 | 5,139 | no_license | [
{
"docstring": "Create a new automaton with the given initial state. Arguments: initial -- The initial automaton state",
"name": "__init__",
"signature": "def __init__(self, initial)"
},
{
"docstring": "Number the given @state and all states reachable from it. At the same time, collect diedge's ... | 3 | stack_v2_sparse_classes_30k_test_000054 | Implement the Python class `Automaton` described below.
Class description:
A finite automaton. Attributes: initial -- The initial state of the automaton ids -- The list of node IDs of the motif in the automaton num_states -- The number of states in this automaton
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `Automaton` described below.
Class description:
A finite automaton. Attributes: initial -- The initial state of the automaton ids -- The list of node IDs of the motif in the automaton num_states -- The number of states in this automaton
Method signatures and docstrings:
- def __init__(self,... | f3366d6871678faa37cd78e83fba9cae4976b94c | <|skeleton|>
class Automaton:
"""A finite automaton. Attributes: initial -- The initial state of the automaton ids -- The list of node IDs of the motif in the automaton num_states -- The number of states in this automaton"""
def __init__(self, initial):
"""Create a new automaton with the given initial ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Automaton:
"""A finite automaton. Attributes: initial -- The initial state of the automaton ids -- The list of node IDs of the motif in the automaton num_states -- The number of states in this automaton"""
def __init__(self, initial):
"""Create a new automaton with the given initial state. Argume... | the_stack_v2_python_sparse | scripts/gregex/automaton.py | TinkerBellSystem/graph-matching | train | 0 |
756f84c1ecba02880308aefecac968d15c7adec0 | [
"super(PolicyConsentFormMixin, self).__init__(*args, **kwargs)\nsiteconfig = SiteConfiguration.objects.get_current()\nprivacy_policy_url = siteconfig.get('privacy_policy_url')\nterms_of_service_url = siteconfig.get('terms_of_service_url')\nself.policies_enabled = bool(siteconfig.get('privacy_enable_user_consent') a... | <|body_start_0|>
super(PolicyConsentFormMixin, self).__init__(*args, **kwargs)
siteconfig = SiteConfiguration.objects.get_current()
privacy_policy_url = siteconfig.get('privacy_policy_url')
terms_of_service_url = siteconfig.get('terms_of_service_url')
self.policies_enabled = bool... | Form mixin to add consent to privacy policy and terms of service. | PolicyConsentFormMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PolicyConsentFormMixin:
"""Form mixin to add consent to privacy policy and terms of service."""
def __init__(self, *args, **kwargs):
"""Initialize the mixin. Args: *args (tuple): Additional positional arguments to pass to the superclass constructor. **kwargs (dict): Additional keywor... | stack_v2_sparse_classes_10k_train_007010 | 5,777 | permissive | [
{
"docstring": "Initialize the mixin. Args: *args (tuple): Additional positional arguments to pass to the superclass constructor. **kwargs (dict): Additional keyword arguments to pass to the superclass constructor.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"do... | 2 | stack_v2_sparse_classes_30k_val_000293 | Implement the Python class `PolicyConsentFormMixin` described below.
Class description:
Form mixin to add consent to privacy policy and terms of service.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize the mixin. Args: *args (tuple): Additional positional arguments to pass to the s... | Implement the Python class `PolicyConsentFormMixin` described below.
Class description:
Form mixin to add consent to privacy policy and terms of service.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize the mixin. Args: *args (tuple): Additional positional arguments to pass to the s... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class PolicyConsentFormMixin:
"""Form mixin to add consent to privacy policy and terms of service."""
def __init__(self, *args, **kwargs):
"""Initialize the mixin. Args: *args (tuple): Additional positional arguments to pass to the superclass constructor. **kwargs (dict): Additional keywor... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PolicyConsentFormMixin:
"""Form mixin to add consent to privacy policy and terms of service."""
def __init__(self, *args, **kwargs):
"""Initialize the mixin. Args: *args (tuple): Additional positional arguments to pass to the superclass constructor. **kwargs (dict): Additional keyword arguments t... | the_stack_v2_python_sparse | reviewboard/accounts/mixins.py | reviewboard/reviewboard | train | 1,141 |
27b208530fe66ec69778041938d149358e55ea0e | [
"TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)\nself.data = []\nself.parse_data()",
"inserts = 0\nfor sect in self.data:\n for ts in sect['data']:\n if not sect['data'][ts]:\n continue\n fst = f\"INSERT into t{sect['initts'].year} (station, model, runtime, ftim... | <|body_start_0|>
TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)
self.data = []
self.parse_data()
<|end_body_0|>
<|body_start_1|>
inserts = 0
for sect in self.data:
for ts in sect['data']:
if not sect['data'][ts]:
... | Represents a Model Output Statistics file | MOSProduct | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MOSProduct:
"""Represents a Model Output Statistics file"""
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None):
"""constructor"""
<|body_0|>
def sql(self, txn):
"""Persist our data to the database Args: txn: Database cursor Returns: int... | stack_v2_sparse_classes_10k_train_007011 | 6,041 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None)"
},
{
"docstring": "Persist our data to the database Args: txn: Database cursor Returns: int number of inserts made to the database",
"name": "sql",
... | 3 | stack_v2_sparse_classes_30k_train_002574 | Implement the Python class `MOSProduct` described below.
Class description:
Represents a Model Output Statistics file
Method signatures and docstrings:
- def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): constructor
- def sql(self, txn): Persist our data to the database Args: txn: Databas... | Implement the Python class `MOSProduct` described below.
Class description:
Represents a Model Output Statistics file
Method signatures and docstrings:
- def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): constructor
- def sql(self, txn): Persist our data to the database Args: txn: Databas... | 460f44394be05e1b655111595a3d7de3f7e47757 | <|skeleton|>
class MOSProduct:
"""Represents a Model Output Statistics file"""
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None):
"""constructor"""
<|body_0|>
def sql(self, txn):
"""Persist our data to the database Args: txn: Database cursor Returns: int... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MOSProduct:
"""Represents a Model Output Statistics file"""
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None):
"""constructor"""
TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)
self.data = []
self.parse_data()
def sql... | the_stack_v2_python_sparse | src/pyiem/nws/products/mos.py | akrherz/pyIEM | train | 38 |
50f8d7442322b239010632cd6c34d6a7a11f4d31 | [
"mocker.patch.object(client, 'get_detections', return_value=detections)\ncmd_res = get_detections_cmd(client, first_timestamp='')\nif detections:\n assert len(cmd_res.outputs) == len(detections.get('results'))\nelse:\n assert 'No detections found' in cmd_res.readable_output",
"mocker.patch.object(client, 'g... | <|body_start_0|>
mocker.patch.object(client, 'get_detections', return_value=detections)
cmd_res = get_detections_cmd(client, first_timestamp='')
if detections:
assert len(cmd_res.outputs) == len(detections.get('results'))
else:
assert 'No detections found' in cmd_... | TestCommands | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCommands:
def test_get_detections_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audits: Dict[str, Any]):
"""Test `vectra-get-events` method detections part."""
<|body_0|>
def test_get_audits_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audi... | stack_v2_sparse_classes_10k_train_007012 | 12,115 | permissive | [
{
"docstring": "Test `vectra-get-events` method detections part.",
"name": "test_get_detections_cmd",
"signature": "def test_get_detections_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audits: Dict[str, Any])"
},
{
"docstring": "Test `vectra-get-events` method audits part.",
... | 5 | stack_v2_sparse_classes_30k_train_005365 | Implement the Python class `TestCommands` described below.
Class description:
Implement the TestCommands class.
Method signatures and docstrings:
- def test_get_detections_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audits: Dict[str, Any]): Test `vectra-get-events` method detections part.
- def test_... | Implement the Python class `TestCommands` described below.
Class description:
Implement the TestCommands class.
Method signatures and docstrings:
- def test_get_detections_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audits: Dict[str, Any]): Test `vectra-get-events` method detections part.
- def test_... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestCommands:
def test_get_detections_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audits: Dict[str, Any]):
"""Test `vectra-get-events` method detections part."""
<|body_0|>
def test_get_audits_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestCommands:
def test_get_detections_cmd(self, mocker: MockerFixture, detections: Dict[str, Any], audits: Dict[str, Any]):
"""Test `vectra-get-events` method detections part."""
mocker.patch.object(client, 'get_detections', return_value=detections)
cmd_res = get_detections_cmd(client,... | the_stack_v2_python_sparse | Packs/Vectra_AI/Integrations/VectraAIEventCollector/VectraAIEventCollector_test.py | demisto/content | train | 1,023 | |
3c5070507aac4c54dc51a619dced20d44993a80b | [
"prev = -1\nres = float('-inf')\nif seats[0] == 1:\n prev = 0\nfor i, seat in enumerate(seats):\n if i == 1:\n if prev == -1:\n res = max(res, i)\n else:\n res = max(res, (i - prev) // 2)\n prev = i\nif seat[-1] == 0:\n res = max(res, len(seats) - 1 - prev)\nretur... | <|body_start_0|>
prev = -1
res = float('-inf')
if seats[0] == 1:
prev = 0
for i, seat in enumerate(seats):
if i == 1:
if prev == -1:
res = max(res, i)
else:
res = max(res, (i - prev) // 2)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDistToClosest2(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_0|>
def maxDistToClosest(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
prev = -1
res = float(... | stack_v2_sparse_classes_10k_train_007013 | 1,617 | no_license | [
{
"docstring": ":type seats: List[int] :rtype: int",
"name": "maxDistToClosest2",
"signature": "def maxDistToClosest2(self, seats)"
},
{
"docstring": ":type seats: List[int] :rtype: int",
"name": "maxDistToClosest",
"signature": "def maxDistToClosest(self, seats)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistToClosest2(self, seats): :type seats: List[int] :rtype: int
- def maxDistToClosest(self, seats): :type seats: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistToClosest2(self, seats): :type seats: List[int] :rtype: int
- def maxDistToClosest(self, seats): :type seats: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 1a3c1f4d6e9d3444039f087763b93241f4ba7892 | <|skeleton|>
class Solution:
def maxDistToClosest2(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_0|>
def maxDistToClosest(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDistToClosest2(self, seats):
""":type seats: List[int] :rtype: int"""
prev = -1
res = float('-inf')
if seats[0] == 1:
prev = 0
for i, seat in enumerate(seats):
if i == 1:
if prev == -1:
res = m... | the_stack_v2_python_sparse | Algorithm/849_Max_Distance_To_Closest_People.py | Gi1ia/TechNoteBook | train | 7 | |
04bfd76893f6614a9426446a522c34e66c922464 | [
"self.availableOptions.update({'undelete': False})\nsuper(DeletionRobot, self).__init__(generator=generator, **kwargs)\nself.summary = summary",
"self.current_page = page\nif self.getOption('undelete'):\n page.undelete(self.summary)\nelif page.exists():\n page.delete(self.summary, not self.getOption('always... | <|body_start_0|>
self.availableOptions.update({'undelete': False})
super(DeletionRobot, self).__init__(generator=generator, **kwargs)
self.summary = summary
<|end_body_0|>
<|body_start_1|>
self.current_page = page
if self.getOption('undelete'):
page.undelete(self.sum... | This robot allows deletion of pages en masse. | DeletionRobot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeletionRobot:
"""This robot allows deletion of pages en masse."""
def __init__(self, generator, summary, **kwargs):
"""Constructor. @param generator: the pages to work on @type generator: iterable @param summary: the reason for the (un)deletion @type summary: unicode"""
<|bo... | stack_v2_sparse_classes_10k_train_007014 | 4,824 | permissive | [
{
"docstring": "Constructor. @param generator: the pages to work on @type generator: iterable @param summary: the reason for the (un)deletion @type summary: unicode",
"name": "__init__",
"signature": "def __init__(self, generator, summary, **kwargs)"
},
{
"docstring": "Delete one page from the g... | 2 | stack_v2_sparse_classes_30k_train_000518 | Implement the Python class `DeletionRobot` described below.
Class description:
This robot allows deletion of pages en masse.
Method signatures and docstrings:
- def __init__(self, generator, summary, **kwargs): Constructor. @param generator: the pages to work on @type generator: iterable @param summary: the reason fo... | Implement the Python class `DeletionRobot` described below.
Class description:
This robot allows deletion of pages en masse.
Method signatures and docstrings:
- def __init__(self, generator, summary, **kwargs): Constructor. @param generator: the pages to work on @type generator: iterable @param summary: the reason fo... | 2461ccc6d24153790a1b1c0378348f99997c4eca | <|skeleton|>
class DeletionRobot:
"""This robot allows deletion of pages en masse."""
def __init__(self, generator, summary, **kwargs):
"""Constructor. @param generator: the pages to work on @type generator: iterable @param summary: the reason for the (un)deletion @type summary: unicode"""
<|bo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeletionRobot:
"""This robot allows deletion of pages en masse."""
def __init__(self, generator, summary, **kwargs):
"""Constructor. @param generator: the pages to work on @type generator: iterable @param summary: the reason for the (un)deletion @type summary: unicode"""
self.availableOpt... | the_stack_v2_python_sparse | scripts/delete.py | speedydeletion/pywikibot | train | 1 |
6ef8bf7ca4fdff01b6181dc08bfc497a0f2c7164 | [
"length = len(nums)\nif length == 0:\n self.record = [0]\nelse:\n self.record = [nums[0]]\n for i in range(1, length):\n self.record.append(nums[i] + self.record[i - 1])",
"if i == 0 or j == 0:\n return self.record[max(i, j)]\nelse:\n return self.record[j] - self.record[i - 1] if i < j else ... | <|body_start_0|>
length = len(nums)
if length == 0:
self.record = [0]
else:
self.record = [nums[0]]
for i in range(1, length):
self.record.append(nums[i] + self.record[i - 1])
<|end_body_0|>
<|body_start_1|>
if i == 0 or j == 0:
... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = len(nums)
if length == 0:
self... | stack_v2_sparse_classes_10k_train_007015 | 31,532 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000376 | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(self, nums):
... | dbe8eb449e5b112a71bc1cd4eabfd138304de4a3 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
length = len(nums)
if length == 0:
self.record = [0]
else:
self.record = [nums[0]]
for i in range(1, length):
self.record.append(nums[i] + self.record[i - 1])
... | the_stack_v2_python_sparse | leetcode/leetcode.py | Rivarrl/leetcode_python | train | 3 | |
b92cfcd02a639f8d00ee8806c67415a63e09dccc | [
"username = getpass.getuser()\nself.root_directory = general.root_directory()\nself.infoset_user_exists = True\nself.infoset_user = None\nself.running_as_root = False\nif username == 'root':\n self.running_as_root = True\n try:\n self.infoset_user = input('Please enter the username under which infoset-... | <|body_start_0|>
username = getpass.getuser()
self.root_directory = general.root_directory()
self.infoset_user_exists = True
self.infoset_user = None
self.running_as_root = False
if username == 'root':
self.running_as_root = True
try:
... | Class to setup infoset-ng daemon. | _Daemon | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Daemon:
"""Class to setup infoset-ng daemon."""
def __init__(self):
"""Function for intializing the class. Args: None Returns: None"""
<|body_0|>
def setup(self):
"""Setup daemon scripts and file permissions. Args: None Returns: None"""
<|body_1|>
d... | stack_v2_sparse_classes_10k_train_007016 | 20,450 | permissive | [
{
"docstring": "Function for intializing the class. Args: None Returns: None",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Setup daemon scripts and file permissions. Args: None Returns: None",
"name": "setup",
"signature": "def setup(self)"
},
{
"docs... | 5 | stack_v2_sparse_classes_30k_train_003610 | Implement the Python class `_Daemon` described below.
Class description:
Class to setup infoset-ng daemon.
Method signatures and docstrings:
- def __init__(self): Function for intializing the class. Args: None Returns: None
- def setup(self): Setup daemon scripts and file permissions. Args: None Returns: None
- def _... | Implement the Python class `_Daemon` described below.
Class description:
Class to setup infoset-ng daemon.
Method signatures and docstrings:
- def __init__(self): Function for intializing the class. Args: None Returns: None
- def setup(self): Setup daemon scripts and file permissions. Args: None Returns: None
- def _... | bac6f7e2157bea76ce882e8dab320d24b66bb718 | <|skeleton|>
class _Daemon:
"""Class to setup infoset-ng daemon."""
def __init__(self):
"""Function for intializing the class. Args: None Returns: None"""
<|body_0|>
def setup(self):
"""Setup daemon scripts and file permissions. Args: None Returns: None"""
<|body_1|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _Daemon:
"""Class to setup infoset-ng daemon."""
def __init__(self):
"""Function for intializing the class. Args: None Returns: None"""
username = getpass.getuser()
self.root_directory = general.root_directory()
self.infoset_user_exists = True
self.infoset_user = N... | the_stack_v2_python_sparse | setup.py | Quantum99/infoset-ng | train | 1 |
7d712f2a91abb98b510b193c3769ea0264d18af7 | [
"db_obj = None\nif data.get('id') is not None:\n db_obj = cls.get(db=db, id=data['id'])\n identifier = data.get('id')\nelif data.get('key') is not None:\n db_obj = cls.get_by(db=db, field='key', value=data['key'])\n identifier = data.get('key')\nif db_obj:\n if db_obj.rule_id != data['rule_id']:\n ... | <|body_start_0|>
db_obj = None
if data.get('id') is not None:
db_obj = cls.get(db=db, id=data['id'])
identifier = data.get('id')
elif data.get('key') is not None:
db_obj = cls.get_by(db=db, field='key', value=data['key'])
identifier = data.get('key... | Which data categories to apply the referenced Rule to | RuleTarget | [
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RuleTarget:
"""Which data categories to apply the referenced Rule to"""
def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase:
"""An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be h... | stack_v2_sparse_classes_10k_train_007017 | 15,366 | permissive | [
{
"docstring": "An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be having its `rule_id` changed, potentially causing `RuleTarget`s to unexpectedly bounce between `Rule`s.",
"name": "create_or_update",
"signature": "def create_or... | 4 | stack_v2_sparse_classes_30k_train_003369 | Implement the Python class `RuleTarget` described below.
Class description:
Which data categories to apply the referenced Rule to
Method signatures and docstrings:
- def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: An override of `FidesopsBase.create_or_update` that handles the specifi... | Implement the Python class `RuleTarget` described below.
Class description:
Which data categories to apply the referenced Rule to
Method signatures and docstrings:
- def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: An override of `FidesopsBase.create_or_update` that handles the specifi... | 1ab840206a78e60673aebd5838ba567095512a58 | <|skeleton|>
class RuleTarget:
"""Which data categories to apply the referenced Rule to"""
def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase:
"""An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be h... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RuleTarget:
"""Which data categories to apply the referenced Rule to"""
def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase:
"""An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be having its `ru... | the_stack_v2_python_sparse | src/fidesops/models/policy.py | nathanawmk/fidesops | train | 0 |
53fc07946786b13849ac4b77ff5a580876c24102 | [
"self.request = requests.Session()\nself.headers = dict()\nif user_agent is None:\n self.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'\nelse:\n self.headers['User-Agent'] = user_agent\nself.query_string_param... | <|body_start_0|>
self.request = requests.Session()
self.headers = dict()
if user_agent is None:
self.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
else:
self.head... | Stock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stock:
def __init__(self, user_agent: str=None):
"""请求参数初始化 :type user_agent: str :param:浏览器"""
<|body_0|>
def get_real_time_a_stock(self, page: int, block: int=2, number: int=50) -> list:
"""获取泸深A股实时数据 :rtype: iterable[dict] :param page: 第几页,范围为1-43 :param block: 请求... | stack_v2_sparse_classes_10k_train_007018 | 5,700 | no_license | [
{
"docstring": "请求参数初始化 :type user_agent: str :param:浏览器",
"name": "__init__",
"signature": "def __init__(self, user_agent: str=None)"
},
{
"docstring": "获取泸深A股实时数据 :rtype: iterable[dict] :param page: 第几页,范围为1-43 :param block: 请求类型,默认2,暂且支持2 :param number: 一次请求返回多少条数据,建议默认值50 :return:iterable[{\... | 3 | stack_v2_sparse_classes_30k_train_000925 | Implement the Python class `Stock` described below.
Class description:
Implement the Stock class.
Method signatures and docstrings:
- def __init__(self, user_agent: str=None): 请求参数初始化 :type user_agent: str :param:浏览器
- def get_real_time_a_stock(self, page: int, block: int=2, number: int=50) -> list: 获取泸深A股实时数据 :rtype... | Implement the Python class `Stock` described below.
Class description:
Implement the Stock class.
Method signatures and docstrings:
- def __init__(self, user_agent: str=None): 请求参数初始化 :type user_agent: str :param:浏览器
- def get_real_time_a_stock(self, page: int, block: int=2, number: int=50) -> list: 获取泸深A股实时数据 :rtype... | 5e34873cd13950dd3b5dc6341aad144522af0eae | <|skeleton|>
class Stock:
def __init__(self, user_agent: str=None):
"""请求参数初始化 :type user_agent: str :param:浏览器"""
<|body_0|>
def get_real_time_a_stock(self, page: int, block: int=2, number: int=50) -> list:
"""获取泸深A股实时数据 :rtype: iterable[dict] :param page: 第几页,范围为1-43 :param block: 请求... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Stock:
def __init__(self, user_agent: str=None):
"""请求参数初始化 :type user_agent: str :param:浏览器"""
self.request = requests.Session()
self.headers = dict()
if user_agent is None:
self.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/5... | the_stack_v2_python_sparse | spyderpro/data_requests/financialmodel/stockmarket.py | LianZS/spyderpro | train | 8 | |
9bd37c6553575bcc390f57bdf54697f18e1c45e2 | [
"self.cam = camera_instance\nself.flow = None\nself._bw_image_array = np.zeros((self.cam.h, self.cam.w, 2), dtype=np.uint8)\nself._time_array = np.zeros(2, dtype=np.float32)\nself.initialised = False\nself.__flow_iterations = 0\nself.viewing_directions = None",
"if self.__flow_iterations < 2:\n self.__flow_ite... | <|body_start_0|>
self.cam = camera_instance
self.flow = None
self._bw_image_array = np.zeros((self.cam.h, self.cam.w, 2), dtype=np.uint8)
self._time_array = np.zeros(2, dtype=np.float32)
self.initialised = False
self.__flow_iterations = 0
self.viewing_directions =... | Class to generate optic flow | OpticFlow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OpticFlow:
"""Class to generate optic flow"""
def __init__(self, camera_instance):
"""Initialise the optic flow class Args: camera_instance (Camera): the camera object"""
<|body_0|>
def __initialised(self):
"""This property must be called twice before the flow is... | stack_v2_sparse_classes_10k_train_007019 | 3,312 | no_license | [
{
"docstring": "Initialise the optic flow class Args: camera_instance (Camera): the camera object",
"name": "__init__",
"signature": "def __init__(self, camera_instance)"
},
{
"docstring": "This property must be called twice before the flow is initialised (since we need at least 2 frames to comp... | 3 | stack_v2_sparse_classes_30k_train_003998 | Implement the Python class `OpticFlow` described below.
Class description:
Class to generate optic flow
Method signatures and docstrings:
- def __init__(self, camera_instance): Initialise the optic flow class Args: camera_instance (Camera): the camera object
- def __initialised(self): This property must be called twi... | Implement the Python class `OpticFlow` described below.
Class description:
Class to generate optic flow
Method signatures and docstrings:
- def __init__(self, camera_instance): Initialise the optic flow class Args: camera_instance (Camera): the camera object
- def __initialised(self): This property must be called twi... | b51b224cc19c252555b3e0e3a77e9ebd811c9293 | <|skeleton|>
class OpticFlow:
"""Class to generate optic flow"""
def __init__(self, camera_instance):
"""Initialise the optic flow class Args: camera_instance (Camera): the camera object"""
<|body_0|>
def __initialised(self):
"""This property must be called twice before the flow is... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OpticFlow:
"""Class to generate optic flow"""
def __init__(self, camera_instance):
"""Initialise the optic flow class Args: camera_instance (Camera): the camera object"""
self.cam = camera_instance
self.flow = None
self._bw_image_array = np.zeros((self.cam.h, self.cam.w, 2... | the_stack_v2_python_sparse | src/opticFlow.py | joanreyero/pyx4-avoidance | train | 0 |
d9b117f5dffc3f5f23455b27694753d795673c4f | [
"if 'length' not in net_params.additional_params:\n raise ValueError('length of circle not supplied')\nself.length = net_params.additional_params['length']\nif 'lanes' not in net_params.additional_params:\n raise ValueError('lanes of circle not supplied')\nself.lanes = net_params.additional_params['lanes']\ni... | <|body_start_0|>
if 'length' not in net_params.additional_params:
raise ValueError('length of circle not supplied')
self.length = net_params.additional_params['length']
if 'lanes' not in net_params.additional_params:
raise ValueError('lanes of circle not supplied')
... | LoopScenario | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoopScenario:
def __init__(self, name, generator_class, vehicles, net_params, initial_config=None):
"""Initializes a loop scenario. Required net_params: length, lanes, speed_limit, resolution. See Scenario.py for description of params."""
<|body_0|>
def specify_edge_starts(s... | stack_v2_sparse_classes_10k_train_007020 | 1,524 | permissive | [
{
"docstring": "Initializes a loop scenario. Required net_params: length, lanes, speed_limit, resolution. See Scenario.py for description of params.",
"name": "__init__",
"signature": "def __init__(self, name, generator_class, vehicles, net_params, initial_config=None)"
},
{
"docstring": "See pa... | 2 | stack_v2_sparse_classes_30k_train_003957 | Implement the Python class `LoopScenario` described below.
Class description:
Implement the LoopScenario class.
Method signatures and docstrings:
- def __init__(self, name, generator_class, vehicles, net_params, initial_config=None): Initializes a loop scenario. Required net_params: length, lanes, speed_limit, resolu... | Implement the Python class `LoopScenario` described below.
Class description:
Implement the LoopScenario class.
Method signatures and docstrings:
- def __init__(self, name, generator_class, vehicles, net_params, initial_config=None): Initializes a loop scenario. Required net_params: length, lanes, speed_limit, resolu... | f3f6d7e9c64f6b641a464a716c7f38ca00388805 | <|skeleton|>
class LoopScenario:
def __init__(self, name, generator_class, vehicles, net_params, initial_config=None):
"""Initializes a loop scenario. Required net_params: length, lanes, speed_limit, resolution. See Scenario.py for description of params."""
<|body_0|>
def specify_edge_starts(s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoopScenario:
def __init__(self, name, generator_class, vehicles, net_params, initial_config=None):
"""Initializes a loop scenario. Required net_params: length, lanes, speed_limit, resolution. See Scenario.py for description of params."""
if 'length' not in net_params.additional_params:
... | the_stack_v2_python_sparse | flow/scenarios/loop/loop_scenario.py | mark-koren/flow | train | 0 | |
8c6c7b820e394fb0f2ebbd4c3eb37090ca3d68a7 | [
"self._syntax_analyzer = syntax_analyzer\nself._semantic_analyzer = semantic_analyzer\nself._logger = logging.getLogger(__name__)",
"with io.open(input_file_path, 'r', encoding=encoding) as input_file:\n manifest_json = self.get_manifest_json(input_file)\n manifest = self._syntax_analyzer.analyze(manifest_j... | <|body_start_0|>
self._syntax_analyzer = syntax_analyzer
self._semantic_analyzer = semantic_analyzer
self._logger = logging.getLogger(__name__)
<|end_body_0|>
<|body_start_1|>
with io.open(input_file_path, 'r', encoding=encoding) as input_file:
manifest_json = self.get_manif... | Base class for RWPM-compatible parsers. | DocumentParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DocumentParser:
"""Base class for RWPM-compatible parsers."""
def __init__(self, syntax_analyzer, semantic_analyzer):
"""Initialize a new instance of Parser class. :param syntax_analyzer: Syntax analyzer :type syntax_analyzer: syntax.SyntaxAnalyzer :param semantic_analyzer: Semantic ... | stack_v2_sparse_classes_10k_train_007021 | 23,409 | permissive | [
{
"docstring": "Initialize a new instance of Parser class. :param syntax_analyzer: Syntax analyzer :type syntax_analyzer: syntax.SyntaxAnalyzer :param semantic_analyzer: Semantic analyser :type semantic_analyzer: semantic.SemanticAnalyzer",
"name": "__init__",
"signature": "def __init__(self, syntax_ana... | 6 | null | Implement the Python class `DocumentParser` described below.
Class description:
Base class for RWPM-compatible parsers.
Method signatures and docstrings:
- def __init__(self, syntax_analyzer, semantic_analyzer): Initialize a new instance of Parser class. :param syntax_analyzer: Syntax analyzer :type syntax_analyzer: ... | Implement the Python class `DocumentParser` described below.
Class description:
Base class for RWPM-compatible parsers.
Method signatures and docstrings:
- def __init__(self, syntax_analyzer, semantic_analyzer): Initialize a new instance of Parser class. :param syntax_analyzer: Syntax analyzer :type syntax_analyzer: ... | 662cc7e0721d0153857c8c17a37e2a6df86f8ce6 | <|skeleton|>
class DocumentParser:
"""Base class for RWPM-compatible parsers."""
def __init__(self, syntax_analyzer, semantic_analyzer):
"""Initialize a new instance of Parser class. :param syntax_analyzer: Syntax analyzer :type syntax_analyzer: syntax.SyntaxAnalyzer :param semantic_analyzer: Semantic ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DocumentParser:
"""Base class for RWPM-compatible parsers."""
def __init__(self, syntax_analyzer, semantic_analyzer):
"""Initialize a new instance of Parser class. :param syntax_analyzer: Syntax analyzer :type syntax_analyzer: syntax.SyntaxAnalyzer :param semantic_analyzer: Semantic analyser :typ... | the_stack_v2_python_sparse | core/util/webpub_manifest_parser/core/parsers.py | NYPL-Simplified/circulation | train | 20 |
2d1d7c49f1125fc47c1b6192eaaa7a29beb93adc | [
"self.df = df\nself.informative_columns = config.informative_column\nself.ignore_regexes = config.clusterer.tokenizer.preprocessor.ignore_line_regex_matcher\nself.search_regexes = config.clusterer.tokenizer.preprocessor.search_line_regex_matcher\nself.ignore_word_regexes = config.clusterer.tokenizer.preprocessor.ig... | <|body_start_0|>
self.df = df
self.informative_columns = config.informative_column
self.ignore_regexes = config.clusterer.tokenizer.preprocessor.ignore_line_regex_matcher
self.search_regexes = config.clusterer.tokenizer.preprocessor.search_line_regex_matcher
self.ignore_word_rege... | Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer. | Preprocessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Preprocessor:
"""Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer."""
def __init__(self, df, config, output_column_name):
"""Initializes necessary information for preprocessor. Preconditions: config contains a not None field cl... | stack_v2_sparse_classes_10k_train_007022 | 4,562 | no_license | [
{
"docstring": "Initializes necessary information for preprocessor. Preconditions: config contains a not None field clusterer, tokenizer and preprocessor Args: df: pandas dataframe consisting of the exception column, a name column, an errorMessage column and optionally a remoteException column config: config_pb... | 5 | stack_v2_sparse_classes_30k_train_005957 | Implement the Python class `Preprocessor` described below.
Class description:
Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer.
Method signatures and docstrings:
- def __init__(self, df, config, output_column_name): Initializes necessary information for preproc... | Implement the Python class `Preprocessor` described below.
Class description:
Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer.
Method signatures and docstrings:
- def __init__(self, df, config, output_column_name): Initializes necessary information for preproc... | 538bd1d109a8f53f2a756ebb65ba2f20703e5d32 | <|skeleton|>
class Preprocessor:
"""Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer."""
def __init__(self, df, config, output_column_name):
"""Initializes necessary information for preprocessor. Preconditions: config contains a not None field cl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Preprocessor:
"""Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer."""
def __init__(self, df, config, output_column_name):
"""Initializes necessary information for preprocessor. Preconditions: config contains a not None field clusterer, toke... | the_stack_v2_python_sparse | python/preprocessor.py | googleinterns/stack-trace-classifier | train | 0 |
c5840b6b6333b2b9b1e2de5721f60b86db05dec1 | [
"in_straight_section = not train.current_head_section.is_turnout()\nall_next_sections_blocked = all((dispatcher.is_section_occupied(section, train.is_reversed) for section in dispatcher.sections_mapper.get_next_sections(train.current_head_section, train.is_reversed)))\nreturn len(dispatcher.sections_mapper.get_next... | <|body_start_0|>
in_straight_section = not train.current_head_section.is_turnout()
all_next_sections_blocked = all((dispatcher.is_section_occupied(section, train.is_reversed) for section in dispatcher.sections_mapper.get_next_sections(train.current_head_section, train.is_reversed)))
return len(d... | ReverseAction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReverseAction:
def is_applicable(dispatcher, train):
"""Overrides the parent action to define the criteria for ReverseAction application"""
<|body_0|>
def execute(self, dispatcher, train):
"""Overrides the base action execution to perform the train action of wait for... | stack_v2_sparse_classes_10k_train_007023 | 2,712 | no_license | [
{
"docstring": "Overrides the parent action to define the criteria for ReverseAction application",
"name": "is_applicable",
"signature": "def is_applicable(dispatcher, train)"
},
{
"docstring": "Overrides the base action execution to perform the train action of wait for crossing",
"name": "e... | 2 | stack_v2_sparse_classes_30k_train_006869 | Implement the Python class `ReverseAction` described below.
Class description:
Implement the ReverseAction class.
Method signatures and docstrings:
- def is_applicable(dispatcher, train): Overrides the parent action to define the criteria for ReverseAction application
- def execute(self, dispatcher, train): Overrides... | Implement the Python class `ReverseAction` described below.
Class description:
Implement the ReverseAction class.
Method signatures and docstrings:
- def is_applicable(dispatcher, train): Overrides the parent action to define the criteria for ReverseAction application
- def execute(self, dispatcher, train): Overrides... | 4650433f7f860df3de1f7502cb052891c410618d | <|skeleton|>
class ReverseAction:
def is_applicable(dispatcher, train):
"""Overrides the parent action to define the criteria for ReverseAction application"""
<|body_0|>
def execute(self, dispatcher, train):
"""Overrides the base action execution to perform the train action of wait for... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReverseAction:
def is_applicable(dispatcher, train):
"""Overrides the parent action to define the criteria for ReverseAction application"""
in_straight_section = not train.current_head_section.is_turnout()
all_next_sections_blocked = all((dispatcher.is_section_occupied(section, train.i... | the_stack_v2_python_sparse | code/app/simulation/action/reverse.py | ferdn4ndo/the-train-app | train | 0 | |
0b772ae26adb72fcc8fa72cc959cb9e9a6826d8f | [
"post_body = {'service_id': service_id, 'region': region_id, 'publicurl': kwargs.get('publicurl'), 'adminurl': kwargs.get('adminurl'), 'internalurl': kwargs.get('internalurl')}\npost_body = json.dumps({'endpoint': post_body})\nresp, body = self.post('/endpoints', post_body)\nself.expected_success(200, resp.status)\... | <|body_start_0|>
post_body = {'service_id': service_id, 'region': region_id, 'publicurl': kwargs.get('publicurl'), 'adminurl': kwargs.get('adminurl'), 'internalurl': kwargs.get('internalurl')}
post_body = json.dumps({'endpoint': post_body})
resp, body = self.post('/endpoints', post_body)
... | EndpointsClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EndpointsClient:
def create_endpoint(self, service_id, region_id, **kwargs):
"""Create an endpoint for service."""
<|body_0|>
def list_endpoints(self):
"""List Endpoints - Returns Endpoints."""
<|body_1|>
def delete_endpoint(self, endpoint_id):
"... | stack_v2_sparse_classes_10k_train_007024 | 1,870 | permissive | [
{
"docstring": "Create an endpoint for service.",
"name": "create_endpoint",
"signature": "def create_endpoint(self, service_id, region_id, **kwargs)"
},
{
"docstring": "List Endpoints - Returns Endpoints.",
"name": "list_endpoints",
"signature": "def list_endpoints(self)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_005607 | Implement the Python class `EndpointsClient` described below.
Class description:
Implement the EndpointsClient class.
Method signatures and docstrings:
- def create_endpoint(self, service_id, region_id, **kwargs): Create an endpoint for service.
- def list_endpoints(self): List Endpoints - Returns Endpoints.
- def de... | Implement the Python class `EndpointsClient` described below.
Class description:
Implement the EndpointsClient class.
Method signatures and docstrings:
- def create_endpoint(self, service_id, region_id, **kwargs): Create an endpoint for service.
- def list_endpoints(self): List Endpoints - Returns Endpoints.
- def de... | 78c71b3bc74144ee5d2a77707d7f195b96ad09b4 | <|skeleton|>
class EndpointsClient:
def create_endpoint(self, service_id, region_id, **kwargs):
"""Create an endpoint for service."""
<|body_0|>
def list_endpoints(self):
"""List Endpoints - Returns Endpoints."""
<|body_1|>
def delete_endpoint(self, endpoint_id):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EndpointsClient:
def create_endpoint(self, service_id, region_id, **kwargs):
"""Create an endpoint for service."""
post_body = {'service_id': service_id, 'region': region_id, 'publicurl': kwargs.get('publicurl'), 'adminurl': kwargs.get('adminurl'), 'internalurl': kwargs.get('internalurl')}
... | the_stack_v2_python_sparse | tempest/services/identity/v2/json/endpoints_client.py | microsoft/LIS-Tempest | train | 1 | |
20a35bf2a4f2b34def1ad7af7c3936569f624dbd | [
"self.verbose = verbose\nif slot_nums is None:\n self.slot_nums = set()\nelse:\n self.slot_nums = {int(slot_num) for slot_num in slot_nums}\nself.cfg_dict = {}\nself.S_dict = {}\nself.logs_dict = {}\nfor slot_num in sorted(self.slot_nums):\n self.load_single_slot(slot_num=slot_num)",
"slot_num = int(slot... | <|body_start_0|>
self.verbose = verbose
if slot_nums is None:
self.slot_nums = set()
else:
self.slot_nums = {int(slot_num) for slot_num in slot_nums}
self.cfg_dict = {}
self.S_dict = {}
self.logs_dict = {}
for slot_num in sorted(self.slot_n... | For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg = load_s.S_dict[slot_num] S = load... | LoadS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadS:
"""For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg =... | stack_v2_sparse_classes_10k_train_007025 | 3,884 | no_license | [
{
"docstring": "Proved with a slot numbers, an instance of this class will automatically load and configure each SMuRF slot. The smurf slots are accessible through the instance variables self.cfg_dict, self.S_dict, and self.logs_dict. As the names of these variables suggest, each variable is a dictionary with t... | 3 | stack_v2_sparse_classes_30k_train_000236 | Implement the Python class `LoadS` described below.
Class description:
For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_... | Implement the Python class `LoadS` described below.
Class description:
For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_... | 0b002f1477efb6b5fcaddc4a282c35883165a42a | <|skeleton|>
class LoadS:
"""For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg =... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoadS:
"""For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg = load_s.S_dic... | the_stack_v2_python_sparse | chw3k5/ufm_optimize/operators/controler.py | simonsobs/readout-script-dev | train | 1 |
5f87a34a957465945b1fb0a41931b57ae316adea | [
"if data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n if p <= 0 or 1 <= p:\n raise ValueError('p must be greater than 0 and less than 1')\nelse:\n if type(data) is not list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise Value... | <|body_start_0|>
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
if p <= 0 or 1 <= p:
raise ValueError('p must be greater than 0 and less than 1')
else:
if type(data) is not list:
raise TypeErr... | represents a binomial distribution | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""represents a binomial distribution"""
def __init__(self, data=None, n=1, p=0.5):
"""Initialize Binomial Args: data: list of the data used to estimate the distribution n: number of Bernoulli trials p: probability of a “success”"""
<|body_0|>
def pmf(self, k):... | stack_v2_sparse_classes_10k_train_007026 | 2,297 | no_license | [
{
"docstring": "Initialize Binomial Args: data: list of the data used to estimate the distribution n: number of Bernoulli trials p: probability of a “success”",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "Calculates the value of the PMF (probab... | 3 | stack_v2_sparse_classes_30k_test_000146 | Implement the Python class `Binomial` described below.
Class description:
represents a binomial distribution
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Initialize Binomial Args: data: list of the data used to estimate the distribution n: number of Bernoulli trials p: probability of... | Implement the Python class `Binomial` described below.
Class description:
represents a binomial distribution
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Initialize Binomial Args: data: list of the data used to estimate the distribution n: number of Bernoulli trials p: probability of... | c20d4dc396f53f2adf73ab9b360977ecf8834af4 | <|skeleton|>
class Binomial:
"""represents a binomial distribution"""
def __init__(self, data=None, n=1, p=0.5):
"""Initialize Binomial Args: data: list of the data used to estimate the distribution n: number of Bernoulli trials p: probability of a “success”"""
<|body_0|>
def pmf(self, k):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Binomial:
"""represents a binomial distribution"""
def __init__(self, data=None, n=1, p=0.5):
"""Initialize Binomial Args: data: list of the data used to estimate the distribution n: number of Bernoulli trials p: probability of a “success”"""
if data is None:
if n <= 0:
... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | afarizap/holbertonschool-machine_learning | train | 0 |
0bb290f4b07d6ed5a00eabd0551cc0df5ca722cd | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookTableColumn()",
"from .entity import Entity\nfrom .json import Json\nfrom .workbook_filter import WorkbookFilter\nfrom .entity import Entity\nfrom .json import Json\nfrom .workbook_filter import WorkbookFilter\nfields: Dict[str... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkbookTableColumn()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .json import Json
from .workbook_filter import WorkbookFilter
from .entity import En... | WorkbookTableColumn | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkbookTableColumn:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn:
"""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 ob... | stack_v2_sparse_classes_10k_train_007027 | 3,081 | 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: WorkbookTableColumn",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | null | Implement the Python class `WorkbookTableColumn` described below.
Class description:
Implement the WorkbookTableColumn class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: Creates a new instance of the appropriate class based on d... | Implement the Python class `WorkbookTableColumn` described below.
Class description:
Implement the WorkbookTableColumn class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: Creates a new instance of the appropriate class based on d... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkbookTableColumn:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn:
"""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 ob... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkbookTableColumn:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn:
"""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: ... | the_stack_v2_python_sparse | msgraph/generated/models/workbook_table_column.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
3f111a7b3c92760252dfceeccf3dbb70e08d9ce5 | [
"if data:\n self.Parameters['-f'].on(super(RNAshapes, self)._input_as_lines(data))\nreturn ''",
"if data:\n self.Parameters['-f'].on(data)\nreturn ''"
] | <|body_start_0|>
if data:
self.Parameters['-f'].on(super(RNAshapes, self)._input_as_lines(data))
return ''
<|end_body_0|>
<|body_start_1|>
if data:
self.Parameters['-f'].on(data)
return ''
<|end_body_1|>
| Application controller for RNAshapes application Options: -h Display this information -H <option> Display detailed information on <option> -v Show version Sequence analysis modes: -a Shape folding (standard mode) -s Complete suboptimal folding -p Shape probabilities -q Shape probabilities (including shreps) -P <value> ... | RNAshapes | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNAshapes:
"""Application controller for RNAshapes application Options: -h Display this information -H <option> Display detailed information on <option> -v Show version Sequence analysis modes: -a Shape folding (standard mode) -s Complete suboptimal folding -p Shape probabilities -q Shape probabi... | stack_v2_sparse_classes_10k_train_007028 | 5,500 | permissive | [
{
"docstring": "Makes data the value of a specific parameter",
"name": "_input_as_lines",
"signature": "def _input_as_lines(self, data)"
},
{
"docstring": "Makes data the value of a specific parameter This method returns the empty string. The parameter will be printed automatically once set.",
... | 2 | stack_v2_sparse_classes_30k_train_006382 | Implement the Python class `RNAshapes` described below.
Class description:
Application controller for RNAshapes application Options: -h Display this information -H <option> Display detailed information on <option> -v Show version Sequence analysis modes: -a Shape folding (standard mode) -s Complete suboptimal folding ... | Implement the Python class `RNAshapes` described below.
Class description:
Application controller for RNAshapes application Options: -h Display this information -H <option> Display detailed information on <option> -v Show version Sequence analysis modes: -a Shape folding (standard mode) -s Complete suboptimal folding ... | fe6f8c8dfed86d39c80f2804a753c05bb2e485b4 | <|skeleton|>
class RNAshapes:
"""Application controller for RNAshapes application Options: -h Display this information -H <option> Display detailed information on <option> -v Show version Sequence analysis modes: -a Shape folding (standard mode) -s Complete suboptimal folding -p Shape probabilities -q Shape probabi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RNAshapes:
"""Application controller for RNAshapes application Options: -h Display this information -H <option> Display detailed information on <option> -v Show version Sequence analysis modes: -a Shape folding (standard mode) -s Complete suboptimal folding -p Shape probabilities -q Shape probabilities (inclu... | the_stack_v2_python_sparse | scripts/venv/lib/python2.7/site-packages/cogent/app/rnashapes.py | sauloal/cnidaria | train | 3 |
b4fda558822cc419a4d413835f130c796d1e9bbb | [
"fy_range = [str(i) for i in range(2001, FiscalDateTime.today().year + 1)]\nlast_fy = str(SubmissionAttributes.latest_available_fy()) or str(FiscalDateTime.today().year)\nrequest_settings = [{'key': 'sort', 'name': 'sort', 'type': 'object', 'optional': True, 'object_keys': {'field': {'type': 'enum', 'enum_values': ... | <|body_start_0|>
fy_range = [str(i) for i in range(2001, FiscalDateTime.today().year + 1)]
last_fy = str(SubmissionAttributes.latest_available_fy()) or str(FiscalDateTime.today().year)
request_settings = [{'key': 'sort', 'name': 'sort', 'type': 'object', 'optional': True, 'object_keys': {'field'... | This route sends a request to the backend to retrieve a list of federal accounts. | FederalAccountsViewSet | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FederalAccountsViewSet:
"""This route sends a request to the backend to retrieve a list of federal accounts."""
def _parse_and_validate_request(self, request_dict):
"""Validate the Request object includes the required fields"""
<|body_0|>
def post(self, request, format=N... | stack_v2_sparse_classes_10k_train_007029 | 32,271 | permissive | [
{
"docstring": "Validate the Request object includes the required fields",
"name": "_parse_and_validate_request",
"signature": "def _parse_and_validate_request(self, request_dict)"
},
{
"docstring": "Return all high-level Federal Account information",
"name": "post",
"signature": "def po... | 2 | null | Implement the Python class `FederalAccountsViewSet` described below.
Class description:
This route sends a request to the backend to retrieve a list of federal accounts.
Method signatures and docstrings:
- def _parse_and_validate_request(self, request_dict): Validate the Request object includes the required fields
- ... | Implement the Python class `FederalAccountsViewSet` described below.
Class description:
This route sends a request to the backend to retrieve a list of federal accounts.
Method signatures and docstrings:
- def _parse_and_validate_request(self, request_dict): Validate the Request object includes the required fields
- ... | 38f920438697930ae3ac57bbcaae9034877d8fb7 | <|skeleton|>
class FederalAccountsViewSet:
"""This route sends a request to the backend to retrieve a list of federal accounts."""
def _parse_and_validate_request(self, request_dict):
"""Validate the Request object includes the required fields"""
<|body_0|>
def post(self, request, format=N... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FederalAccountsViewSet:
"""This route sends a request to the backend to retrieve a list of federal accounts."""
def _parse_and_validate_request(self, request_dict):
"""Validate the Request object includes the required fields"""
fy_range = [str(i) for i in range(2001, FiscalDateTime.today(... | the_stack_v2_python_sparse | usaspending_api/accounts/views/federal_accounts_v2.py | fedspendingtransparency/usaspending-api | train | 276 |
7dc86f9a5c2776f95b88f881a3d9c87f21e5642e | [
"while p.ltag == 0:\n p = p.lchild\nreturn p",
"if p.rtag == 0:\n return self.findFirstNode(p.rchild)\nelse:\n return p.rchild",
"result = list()\np = self.findFirstNode(t)\nwhile p is not None:\n result.append(p.data)\n p = self.findNextNode(p)\nreturn result"
] | <|body_start_0|>
while p.ltag == 0:
p = p.lchild
return p
<|end_body_0|>
<|body_start_1|>
if p.rtag == 0:
return self.findFirstNode(p.rchild)
else:
return p.rchild
<|end_body_1|>
<|body_start_2|>
result = list()
p = self.findFirstNode... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findFirstNode(self, p: ThreadNode) -> ThreadNode:
"""中序线索二叉树中中序序列的第一个节点 :param p: :return:"""
<|body_0|>
def findNextNode(self, p: ThreadNode) -> ThreadNode:
"""中序线索二叉树中节点p在中序序列下的后继 :param p: :return:"""
<|body_1|>
def Inorder(self, t: Thre... | stack_v2_sparse_classes_10k_train_007030 | 1,190 | no_license | [
{
"docstring": "中序线索二叉树中中序序列的第一个节点 :param p: :return:",
"name": "findFirstNode",
"signature": "def findFirstNode(self, p: ThreadNode) -> ThreadNode"
},
{
"docstring": "中序线索二叉树中节点p在中序序列下的后继 :param p: :return:",
"name": "findNextNode",
"signature": "def findNextNode(self, p: ThreadNode) ->... | 3 | stack_v2_sparse_classes_30k_train_005007 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findFirstNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中中序序列的第一个节点 :param p: :return:
- def findNextNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中节点p在中序序列下的后继 :param p: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findFirstNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中中序序列的第一个节点 :param p: :return:
- def findNextNode(self, p: ThreadNode) -> ThreadNode: 中序线索二叉树中节点p在中序序列下的后继 :param p: ... | cded97a52c422f98b55f2b3527a054d23541d5a4 | <|skeleton|>
class Solution:
def findFirstNode(self, p: ThreadNode) -> ThreadNode:
"""中序线索二叉树中中序序列的第一个节点 :param p: :return:"""
<|body_0|>
def findNextNode(self, p: ThreadNode) -> ThreadNode:
"""中序线索二叉树中节点p在中序序列下的后继 :param p: :return:"""
<|body_1|>
def Inorder(self, t: Thre... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findFirstNode(self, p: ThreadNode) -> ThreadNode:
"""中序线索二叉树中中序序列的第一个节点 :param p: :return:"""
while p.ltag == 0:
p = p.lchild
return p
def findNextNode(self, p: ThreadNode) -> ThreadNode:
"""中序线索二叉树中节点p在中序序列下的后继 :param p: :return:"""
if p.... | the_stack_v2_python_sparse | chapter5/中序线索二叉树的遍历.py | AnJian2020/Leetcode | train | 1 | |
b4f0618400120c1c1b9315fdbb3f683ee10db5f5 | [
"def dfs(node, res):\n if node is None:\n return res + 'None,'\n res = res + str(node.val) + ','\n res = dfs(node.left, res)\n res = dfs(node.right, res)\n return res\nreturn dfs(root, '')",
"nodes = data.split(',')\nposi = 0\n\ndef dfs():\n nonlocal posi\n if posi == len(nodes):\n ... | <|body_start_0|>
def dfs(node, res):
if node is None:
return res + 'None,'
res = res + str(node.val) + ','
res = dfs(node.left, res)
res = dfs(node.right, res)
return res
return dfs(root, '')
<|end_body_0|>
<|body_start_1|>
... | Codec | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_007031 | 1,641 | permissive | [
{
"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_001484 | 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:... | 6f0e92fd6e225c9db5a038881fc193e4e4231c3e | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def dfs(node, res):
if node is None:
return res + 'None,'
res = res + str(node.val) + ','
res = dfs(node.left, res)
res = ... | the_stack_v2_python_sparse | py/297.二叉树的序列化与反序列化.py | guojiangwei/myLeetCode | train | 0 | |
39dfb3338d71ee5da837cfd2f2aacf3e63c43563 | [
"k_bits = k_max.bit_length()\ndub = [[0] * n for _ in range(k_bits)]\nfor j in range(n):\n dub[0][j] = f(j)\nfor i in range(1, k_bits):\n for j in range(n):\n dub[i][j] = dub[i - 1][dub[i - 1][j]]\nself.doubling_table = dub",
"now = x\nfor i in range(k.bit_length()):\n if k >> i & 1:\n now ... | <|body_start_0|>
k_bits = k_max.bit_length()
dub = [[0] * n for _ in range(k_bits)]
for j in range(n):
dub[0][j] = f(j)
for i in range(1, k_bits):
for j in range(n):
dub[i][j] = dub[i - 1][dub[i - 1][j]]
self.doubling_table = dub
<|end_body... | Doubling | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Doubling:
def __init__(self, n, k_max, f) -> None:
"""要素数nのダブリングテーブルを作成します。"""
<|body_0|>
def get(self, x, k):
"""xをk回操作した値を取得します。"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
k_bits = k_max.bit_length()
dub = [[0] * n for _ in range(k_bi... | stack_v2_sparse_classes_10k_train_007032 | 1,506 | no_license | [
{
"docstring": "要素数nのダブリングテーブルを作成します。",
"name": "__init__",
"signature": "def __init__(self, n, k_max, f) -> None"
},
{
"docstring": "xをk回操作した値を取得します。",
"name": "get",
"signature": "def get(self, x, k)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000129 | Implement the Python class `Doubling` described below.
Class description:
Implement the Doubling class.
Method signatures and docstrings:
- def __init__(self, n, k_max, f) -> None: 要素数nのダブリングテーブルを作成します。
- def get(self, x, k): xをk回操作した値を取得します。 | Implement the Python class `Doubling` described below.
Class description:
Implement the Doubling class.
Method signatures and docstrings:
- def __init__(self, n, k_max, f) -> None: 要素数nのダブリングテーブルを作成します。
- def get(self, x, k): xをk回操作した値を取得します。
<|skeleton|>
class Doubling:
def __init__(self, n, k_max, f) -> None:... | 1259be8d4214209b7c7d3783f33aa6de4ea04a01 | <|skeleton|>
class Doubling:
def __init__(self, n, k_max, f) -> None:
"""要素数nのダブリングテーブルを作成します。"""
<|body_0|>
def get(self, x, k):
"""xをk回操作した値を取得します。"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Doubling:
def __init__(self, n, k_max, f) -> None:
"""要素数nのダブリングテーブルを作成します。"""
k_bits = k_max.bit_length()
dub = [[0] * n for _ in range(k_bits)]
for j in range(n):
dub[0][j] = f(j)
for i in range(1, k_bits):
for j in range(n):
du... | the_stack_v2_python_sparse | solve_python/058.py | Nishin-0141/kyopro_educational_90_python | train | 0 | |
71a8b055abd65a0d53fb913f89b3efc45a7db7bc | [
"l = len(arr)\npos = bisect.bisect_left(arr, x)\nif pos > 0:\n start = pos - 1\nelse:\n start = 0\nend = start + 1\nwhile k > 0:\n print(start, end)\n if end == l or (start >= 0 and x - arr[start] <= arr[end] - x):\n start -= 1\n else:\n end += 1\n k -= 1\nresult = [arr[i] for i in r... | <|body_start_0|>
l = len(arr)
pos = bisect.bisect_left(arr, x)
if pos > 0:
start = pos - 1
else:
start = 0
end = start + 1
while k > 0:
print(start, end)
if end == l or (start >= 0 and x - arr[start] <= arr[end] - x):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findClosestElements(self, arr, k, x):
""":type arr: List[int] :type k: int :type x: int :rtype: List[int] 245ms"""
<|body_0|>
def findClosestElements(self, arr, k, x):
""":type arr: List[int] :type k: int :type x: int :rtype: List[int] 218ms"""
... | stack_v2_sparse_classes_10k_train_007033 | 2,702 | no_license | [
{
"docstring": ":type arr: List[int] :type k: int :type x: int :rtype: List[int] 245ms",
"name": "findClosestElements",
"signature": "def findClosestElements(self, arr, k, x)"
},
{
"docstring": ":type arr: List[int] :type k: int :type x: int :rtype: List[int] 218ms",
"name": "findClosestElem... | 3 | stack_v2_sparse_classes_30k_train_005557 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findClosestElements(self, arr, k, x): :type arr: List[int] :type k: int :type x: int :rtype: List[int] 245ms
- def findClosestElements(self, arr, k, x): :type arr: List[int] ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findClosestElements(self, arr, k, x): :type arr: List[int] :type k: int :type x: int :rtype: List[int] 245ms
- def findClosestElements(self, arr, k, x): :type arr: List[int] ... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def findClosestElements(self, arr, k, x):
""":type arr: List[int] :type k: int :type x: int :rtype: List[int] 245ms"""
<|body_0|>
def findClosestElements(self, arr, k, x):
""":type arr: List[int] :type k: int :type x: int :rtype: List[int] 218ms"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findClosestElements(self, arr, k, x):
""":type arr: List[int] :type k: int :type x: int :rtype: List[int] 245ms"""
l = len(arr)
pos = bisect.bisect_left(arr, x)
if pos > 0:
start = pos - 1
else:
start = 0
end = start + 1
... | the_stack_v2_python_sparse | FindKClosestElements_MID_658.py | 953250587/leetcode-python | train | 2 | |
7b5789d3208f144f041ca923f7ce08533546434c | [
"self.xLoc = (geneObj.start, geneObj.end)\nself.yLoc = self._get_y(1, 5, geneObj.transCnt)\nself.patches = []\ntsList = geneObj.transcript.keys()\nif geneObj.strand == '-':\n tsList.sort(key=lambda x: geneObj.transcript[x]['tsEnd'])\nelse:\n tsList.sort(key=lambda x: geneObj.transcript[x]['tsStart'])\nfor ind... | <|body_start_0|>
self.xLoc = (geneObj.start, geneObj.end)
self.yLoc = self._get_y(1, 5, geneObj.transCnt)
self.patches = []
tsList = geneObj.transcript.keys()
if geneObj.strand == '-':
tsList.sort(key=lambda x: geneObj.transcript[x]['tsEnd'])
else:
... | Class to construct a gene model | GeneModel | [
"MIT",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneModel:
"""Class to construct a gene model"""
def __init__(self, geneObj, height=2):
"""Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLo... | stack_v2_sparse_classes_10k_train_007034 | 7,451 | permissive | [
{
"docstring": "Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLoc (list) = List of y-coordinates for plotting each transcript on a different row patches (list) = List ... | 3 | stack_v2_sparse_classes_30k_train_004660 | Implement the Python class `GeneModel` described below.
Class description:
Class to construct a gene model
Method signatures and docstrings:
- def __init__(self, geneObj, height=2): Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attri... | Implement the Python class `GeneModel` described below.
Class description:
Class to construct a gene model
Method signatures and docstrings:
- def __init__(self, geneObj, height=2): Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attri... | edafc670880803433b7f2255058bf9696699b581 | <|skeleton|>
class GeneModel:
"""Class to construct a gene model"""
def __init__(self, geneObj, height=2):
"""Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GeneModel:
"""Class to construct a gene model"""
def __init__(self, geneObj, height=2):
"""Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLoc (list) = Li... | the_stack_v2_python_sparse | hpc/ase_scripts/mclib_Python/wiggle.py | jlboat/BayesASE | train | 0 |
87169dbebcb456678f87a682a1488d299cf21901 | [
"self.pool_size = pool_size\nif self.pool_size > 0:\n self.num_imgs = 0\n self.images = []",
"if isinstance(images, Tensor):\n images = images.asnumpy()\nif self.pool_size == 0:\n return Tensor(images)\nreturn_images = []\nfor image in images:\n if self.num_imgs < self.pool_size:\n self.num_... | <|body_start_0|>
self.pool_size = pool_size
if self.pool_size > 0:
self.num_imgs = 0
self.images = []
<|end_body_0|>
<|body_start_1|>
if isinstance(images, Tensor):
images = images.asnumpy()
if self.pool_size == 0:
return Tensor(images)
... | This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators. | ImagePool | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImagePool:
"""This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators."""
def __init__(self, pool_size):
"""Initialize the... | stack_v2_sparse_classes_10k_train_007035 | 5,554 | permissive | [
{
"docstring": "Initialize the ImagePool class Args: pool_size (int): the size of image buffer, if pool_size=0, no buffer will be created.",
"name": "__init__",
"signature": "def __init__(self, pool_size)"
},
{
"docstring": "Return an image from the pool. Args: images: the latest generated image... | 2 | null | Implement the Python class `ImagePool` described below.
Class description:
This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.
Method signatures and do... | Implement the Python class `ImagePool` described below.
Class description:
This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.
Method signatures and do... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class ImagePool:
"""This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators."""
def __init__(self, pool_size):
"""Initialize the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImagePool:
"""This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators."""
def __init__(self, pool_size):
"""Initialize the ImagePool cl... | the_stack_v2_python_sparse | official/cv/CycleGAN/src/utils/tools.py | mindspore-ai/models | train | 301 |
cc5d894753cfeaf387e145fa24773090082f6239 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | DropboxSecretServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DropboxSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getDropboxSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createDropboxSecret(self, request, context):
"... | stack_v2_sparse_classes_10k_train_007036 | 8,451 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "getDropboxSecret",
"signature": "def getDropboxSecret(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "createDropboxSecret",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_test_000055 | Implement the Python class `DropboxSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getDropboxSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createDropboxSecret(se... | Implement the Python class `DropboxSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getDropboxSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createDropboxSecret(se... | c69e14b409add099d151434b9add711e41f41b20 | <|skeleton|>
class DropboxSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getDropboxSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createDropboxSecret(self, request, context):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DropboxSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getDropboxSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not... | the_stack_v2_python_sparse | python-sdk/src/airavata_mft_sdk/dropbox/DropboxSecretService_pb2_grpc.py | apache/airavata-mft | train | 23 |
f58b0384f0b5e42c775e9a5d2c9dd6540939096b | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EducationStudent()",
"from .education_gender import EducationGender\nfrom .education_gender import EducationGender\nfields: Dict[str, Callable[[Any], None]] = {'birthDate': lambda n: setattr(self, 'birth_date', n.get_date_value()), 'ex... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return EducationStudent()
<|end_body_0|>
<|body_start_1|>
from .education_gender import EducationGender
from .education_gender import EducationGender
fields: Dict[str, Callable[[Any], N... | EducationStudent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EducationStudent:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationStudent:
"""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 R... | stack_v2_sparse_classes_10k_train_007037 | 3,847 | 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: EducationStudent",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_va... | 3 | null | Implement the Python class `EducationStudent` described below.
Class description:
Implement the EducationStudent class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationStudent: Creates a new instance of the appropriate class based on discrimina... | Implement the Python class `EducationStudent` described below.
Class description:
Implement the EducationStudent class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationStudent: Creates a new instance of the appropriate class based on discrimina... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class EducationStudent:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationStudent:
"""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 R... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EducationStudent:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationStudent:
"""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: Educat... | the_stack_v2_python_sparse | msgraph/generated/models/education_student.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
41fa99d6de5ae139cacd40bb2788d0d5a93a4391 | [
"self.root = TreeNode(1)\ninorderL = [3, 2, 5, 4]\npreorderL = [2, 3, 4, 5]\nleft_subtree = Tree.from_inorder_preorder(inorderL, preorderL)\ninorderR = [4, 5, 2, 3]\npreorderR = [2, 4, 5, 3]\nright_subtree = Tree.from_inorder_preorder(inorderR, preorderR)\nself.root.left = left_subtree.root\nself.root.right = right... | <|body_start_0|>
self.root = TreeNode(1)
inorderL = [3, 2, 5, 4]
preorderL = [2, 3, 4, 5]
left_subtree = Tree.from_inorder_preorder(inorderL, preorderL)
inorderR = [4, 5, 2, 3]
preorderR = [2, 4, 5, 3]
right_subtree = Tree.from_inorder_preorder(inorderR, preorderR... | Tests for Leetcode problem 101: Symmetric Tree. | ProblemTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProblemTest:
"""Tests for Leetcode problem 101: Symmetric Tree."""
def setUp(self):
"""Setup a test tree, using inorder-preorder."""
<|body_0|>
def test(self):
"""Modify the test tree and run tests accordingly."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_10k_train_007038 | 3,129 | no_license | [
{
"docstring": "Setup a test tree, using inorder-preorder.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Modify the test tree and run tests accordingly.",
"name": "test",
"signature": "def test(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003408 | Implement the Python class `ProblemTest` described below.
Class description:
Tests for Leetcode problem 101: Symmetric Tree.
Method signatures and docstrings:
- def setUp(self): Setup a test tree, using inorder-preorder.
- def test(self): Modify the test tree and run tests accordingly. | Implement the Python class `ProblemTest` described below.
Class description:
Tests for Leetcode problem 101: Symmetric Tree.
Method signatures and docstrings:
- def setUp(self): Setup a test tree, using inorder-preorder.
- def test(self): Modify the test tree and run tests accordingly.
<|skeleton|>
class ProblemTest... | e11bfc454789e716055b80873af0817ec8588aea | <|skeleton|>
class ProblemTest:
"""Tests for Leetcode problem 101: Symmetric Tree."""
def setUp(self):
"""Setup a test tree, using inorder-preorder."""
<|body_0|>
def test(self):
"""Modify the test tree and run tests accordingly."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProblemTest:
"""Tests for Leetcode problem 101: Symmetric Tree."""
def setUp(self):
"""Setup a test tree, using inorder-preorder."""
self.root = TreeNode(1)
inorderL = [3, 2, 5, 4]
preorderL = [2, 3, 4, 5]
left_subtree = Tree.from_inorder_preorder(inorderL, preorde... | the_stack_v2_python_sparse | p101/problem101.py | stanl3y/leetcode | train | 0 |
7f75d1b3bbc723b39b9583ca46207a30e61119d4 | [
"def traverse(root):\n if root:\n data.append(str(root.val))\n traverse(root.left)\n traverse(root.right)\n else:\n data.append('#')\ndata = []\ntraverse(root)\nreturn ' '.join(data)",
"def build():\n val = array.next()\n if val == '#':\n return None\n node = Tree... | <|body_start_0|>
def traverse(root):
if root:
data.append(str(root.val))
traverse(root.left)
traverse(root.right)
else:
data.append('#')
data = []
traverse(root)
return ' '.join(data)
<|end_body_0|>
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_007039 | 1,307 | 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_000849 | 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:... | 9dffc419af45709d95d2ab5dc163461d254140c4 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def traverse(root):
if root:
data.append(str(root.val))
traverse(root.left)
traverse(root.right)
else:
... | the_stack_v2_python_sparse | Trees/serialize_deserialize.py | TedWildenradt/CTCI-Python | train | 0 | |
99886541ee5d86ec350d9f5ec2426543c98cb185 | [
"self.csv_name = f'{self.csv_dir}/{os.path.basename(self.path)}.csv'\nself._convert_dump_to_csv(bgpscanner)\nutils.csv_to_db(MRT_Announcements_Table, self.csv_name)\nutils.delete_paths([self.path, self.csv_name])\nutils.incriment_bar(logging.root.level)",
"args = self._bgpscanner_args() if bgpscanner else self._b... | <|body_start_0|>
self.csv_name = f'{self.csv_dir}/{os.path.basename(self.path)}.csv'
self._convert_dump_to_csv(bgpscanner)
utils.csv_to_db(MRT_Announcements_Table, self.csv_name)
utils.delete_paths([self.path, self.csv_name])
utils.incriment_bar(logging.root.level)
<|end_body_0|>... | Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README. | MRT_File | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MRT_File:
"""Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README."""
def parse_file(self, bgpscanner=True):
"""Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which... | stack_v2_sparse_classes_10k_train_007040 | 8,323 | permissive | [
{
"docstring": "Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which is faster, but ignores malformed announcements. While these malformed announcements are few and far between, bgpdump does not ignore them and should be used for full d... | 4 | stack_v2_sparse_classes_30k_train_001305 | Implement the Python class `MRT_File` described below.
Class description:
Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README.
Method signatures and docstrings:
- def parse_file(self, bgpscanner=True): Parses a downloaded file and inserts it into the database if bgpscanner... | Implement the Python class `MRT_File` described below.
Class description:
Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README.
Method signatures and docstrings:
- def parse_file(self, bgpscanner=True): Parses a downloaded file and inserts it into the database if bgpscanner... | 91c92584b31bd128d818c7fee86c738367c0712e | <|skeleton|>
class MRT_File:
"""Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README."""
def parse_file(self, bgpscanner=True):
"""Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MRT_File:
"""Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README."""
def parse_file(self, bgpscanner=True):
"""Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which is faster, b... | the_stack_v2_python_sparse | lib_bgp_data/collectors/mrt/mrt_base/mrt_file.py | jfuruness/lib_bgp_data | train | 16 |
dea4f6ae35cc301bf4a0dd28cf94934a513af907 | [
"if not settings.PRODUCTION_ENVIRONMENT and (not settings.TESTING):\n self.get_response = get_response\nelse:\n raise MiddlewareNotUsed()",
"try:\n if RESEARCH_ACTIVE:\n self.process_request(request)\nexcept LoginRequired:\n messages.warning(request, 'You need to be logged in to access this pag... | <|body_start_0|>
if not settings.PRODUCTION_ENVIRONMENT and (not settings.TESTING):
self.get_response = get_response
else:
raise MiddlewareNotUsed()
<|end_body_0|>
<|body_start_1|>
try:
if RESEARCH_ACTIVE:
self.process_request(request)
... | Middleware used with research application. | ResearchMiddleware | [
"MIT",
"AGPL-3.0-only",
"ISC",
"LGPL-2.1-or-later",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
<|body_0|>
def __call__(self, reques... | stack_v2_sparse_classes_10k_train_007041 | 4,205 | permissive | [
{
"docstring": "One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing.",
"name": "__init__",
"signature": "def __init__(self, get_response)"
},
{
"docstring": "Logic for middleware.",
"name": "__call__",
"signature": ... | 3 | stack_v2_sparse_classes_30k_test_000225 | Implement the Python class `ResearchMiddleware` described below.
Class description:
Middleware used with research application.
Method signatures and docstrings:
- def __init__(self, get_response): One-time configuration and initialization. Only load research middleware if running in a staging environment and not test... | Implement the Python class `ResearchMiddleware` described below.
Class description:
Middleware used with research application.
Method signatures and docstrings:
- def __init__(self, get_response): One-time configuration and initialization. Only load research middleware if running in a staging environment and not test... | 5b668eb66449e2ebaeb2177237b9a55a14d69efb | <|skeleton|>
class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
<|body_0|>
def __call__(self, reques... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
if not settings.PRODUCTION_ENVIRONMENT and (not settin... | the_stack_v2_python_sparse | codewof/research/middleware/ResearchMiddleware.py | uccser/codewof | train | 7 |
f53e8d47c874f62e63b8b4e7a2f1b6c2e94f4df6 | [
"try:\n exploration = exp_fetchers.get_exploration_from_model(exp_model)\n exploration.validate(strict=exp_is_published)\n with datastore_services.get_ndb_context():\n if exp_services.get_story_id_linked_to_exploration(exp_model.id) is not None:\n exp_services.validate_exploration_for_sto... | <|body_start_0|>
try:
exploration = exp_fetchers.get_exploration_from_model(exp_model)
exploration.validate(strict=exp_is_published)
with datastore_services.get_ndb_context():
if exp_services.get_story_id_linked_to_exploration(exp_model.id) is not None:
... | Transform that gets all Exploration models, performs migration and filters any error results. | MigrateExplorationModels | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MigrateExplorationModels:
"""Transform that gets all Exploration models, performs migration and filters any error results."""
def _migrate_exploration(exp_model: exp_models.ExplorationModel, exp_is_published: bool) -> result.Result[Tuple[str, exp_domain.Exploration], Tuple[str, Exception]]:
... | stack_v2_sparse_classes_10k_train_007042 | 28,752 | permissive | [
{
"docstring": "Migrates exploration and transform exploration model into exploration object. Args: exp_model: ExplorationModel. The exploration model to migrate. exp_is_published: bool. Whether the exploration is published or not. Returns: Result((str, Exploration), (str, Exception)). Result containing tuple t... | 3 | null | Implement the Python class `MigrateExplorationModels` described below.
Class description:
Transform that gets all Exploration models, performs migration and filters any error results.
Method signatures and docstrings:
- def _migrate_exploration(exp_model: exp_models.ExplorationModel, exp_is_published: bool) -> result... | Implement the Python class `MigrateExplorationModels` described below.
Class description:
Transform that gets all Exploration models, performs migration and filters any error results.
Method signatures and docstrings:
- def _migrate_exploration(exp_model: exp_models.ExplorationModel, exp_is_published: bool) -> result... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class MigrateExplorationModels:
"""Transform that gets all Exploration models, performs migration and filters any error results."""
def _migrate_exploration(exp_model: exp_models.ExplorationModel, exp_is_published: bool) -> result.Result[Tuple[str, exp_domain.Exploration], Tuple[str, Exception]]:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MigrateExplorationModels:
"""Transform that gets all Exploration models, performs migration and filters any error results."""
def _migrate_exploration(exp_model: exp_models.ExplorationModel, exp_is_published: bool) -> result.Result[Tuple[str, exp_domain.Exploration], Tuple[str, Exception]]:
"""Mi... | the_stack_v2_python_sparse | core/jobs/batch_jobs/exp_migration_jobs.py | oppia/oppia | train | 6,172 |
9f1968c56ccf9c114a48493c46c291f45fed1323 | [
"path_segments = path.split('\\\\')\nif path_segments:\n first_path_segment = path_segments[0].lower()\n if len(first_path_segment) == 2 and first_path_segment[1:] == ':' or first_path_segment == '%systemdrive%':\n path_segments[0] = ''\nreturn '\\\\'.join(path_segments) or '\\\\'",
"if not first_eve... | <|body_start_0|>
path_segments = path.split('\\')
if path_segments:
first_path_segment = path_segments[0].lower()
if len(first_path_segment) == 2 and first_path_segment[1:] == ':' or first_path_segment == '%systemdrive%':
path_segments[0] = ''
return '\\'.... | Windows EventLog providers helper. | WindowsEventLogProvidersHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsEventLogProvidersHelper:
"""Windows EventLog providers helper."""
def _GetNormalizedPath(self, path):
"""Retrieves a normalized variant of a path. Args: path (str): path of a message file. Returns: str: normalized path of a message file."""
<|body_0|>
def Merge(se... | stack_v2_sparse_classes_10k_train_007043 | 3,276 | permissive | [
{
"docstring": "Retrieves a normalized variant of a path. Args: path (str): path of a message file. Returns: str: normalized path of a message file.",
"name": "_GetNormalizedPath",
"signature": "def _GetNormalizedPath(self, path)"
},
{
"docstring": "Merges the information of the second Event Log... | 3 | stack_v2_sparse_classes_30k_train_005950 | Implement the Python class `WindowsEventLogProvidersHelper` described below.
Class description:
Windows EventLog providers helper.
Method signatures and docstrings:
- def _GetNormalizedPath(self, path): Retrieves a normalized variant of a path. Args: path (str): path of a message file. Returns: str: normalized path o... | Implement the Python class `WindowsEventLogProvidersHelper` described below.
Class description:
Windows EventLog providers helper.
Method signatures and docstrings:
- def _GetNormalizedPath(self, path): Retrieves a normalized variant of a path. Args: path (str): path of a message file. Returns: str: normalized path o... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class WindowsEventLogProvidersHelper:
"""Windows EventLog providers helper."""
def _GetNormalizedPath(self, path):
"""Retrieves a normalized variant of a path. Args: path (str): path of a message file. Returns: str: normalized path of a message file."""
<|body_0|>
def Merge(se... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WindowsEventLogProvidersHelper:
"""Windows EventLog providers helper."""
def _GetNormalizedPath(self, path):
"""Retrieves a normalized variant of a path. Args: path (str): path of a message file. Returns: str: normalized path of a message file."""
path_segments = path.split('\\')
... | the_stack_v2_python_sparse | plaso/helpers/windows/eventlog_providers.py | log2timeline/plaso | train | 1,506 |
c15a66ff2bca285cb18224bba16de8b7533b1d4b | [
"self.loginpage.openLoginPage()\nself.log('PO-gjs:打开浏览器进入到项目首页')\nself.loginpage.login_gjs_pro(self.readusername(2), self.readpassword(2))\nself.log('PO-gjs:输入正确用户名和密码为空')\nself.assertEqual(self.loginpage.get_passwordNullText(), self.exceptText(2))\nself.log('PO-gjs:登录失败获取信息进行断言')\nSaveImage(self.dr, 'loginpasswdNu... | <|body_start_0|>
self.loginpage.openLoginPage()
self.log('PO-gjs:打开浏览器进入到项目首页')
self.loginpage.login_gjs_pro(self.readusername(2), self.readpassword(2))
self.log('PO-gjs:输入正确用户名和密码为空')
self.assertEqual(self.loginpage.get_passwordNullText(), self.exceptText(2))
self.log('P... | TestLogin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLogin:
def test_user_null(self):
"""测试密码为空"""
<|body_0|>
def test_username_null(self):
"""测试用户名为空"""
<|body_1|>
def test_user_passwd_null(self):
"""测试用户名/密码为空"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.loginpage.op... | stack_v2_sparse_classes_10k_train_007044 | 4,917 | no_license | [
{
"docstring": "测试密码为空",
"name": "test_user_null",
"signature": "def test_user_null(self)"
},
{
"docstring": "测试用户名为空",
"name": "test_username_null",
"signature": "def test_username_null(self)"
},
{
"docstring": "测试用户名/密码为空",
"name": "test_user_passwd_null",
"signature": ... | 3 | stack_v2_sparse_classes_30k_val_000222 | Implement the Python class `TestLogin` described below.
Class description:
Implement the TestLogin class.
Method signatures and docstrings:
- def test_user_null(self): 测试密码为空
- def test_username_null(self): 测试用户名为空
- def test_user_passwd_null(self): 测试用户名/密码为空 | Implement the Python class `TestLogin` described below.
Class description:
Implement the TestLogin class.
Method signatures and docstrings:
- def test_user_null(self): 测试密码为空
- def test_username_null(self): 测试用户名为空
- def test_user_passwd_null(self): 测试用户名/密码为空
<|skeleton|>
class TestLogin:
def test_user_null(se... | 910bcf91dacb8ef699c700709b42dec771b504d0 | <|skeleton|>
class TestLogin:
def test_user_null(self):
"""测试密码为空"""
<|body_0|>
def test_username_null(self):
"""测试用户名为空"""
<|body_1|>
def test_user_passwd_null(self):
"""测试用户名/密码为空"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestLogin:
def test_user_null(self):
"""测试密码为空"""
self.loginpage.openLoginPage()
self.log('PO-gjs:打开浏览器进入到项目首页')
self.loginpage.login_gjs_pro(self.readusername(2), self.readpassword(2))
self.log('PO-gjs:输入正确用户名和密码为空')
self.assertEqual(self.loginpage.get_password... | the_stack_v2_python_sparse | 2.15章节源码/page/test_Login.py | luruifeng/myBookCode | train | 3 | |
fd1cafbca35b3026054116724fe72df449990ba6 | [
"web.header('X-Frame-Options', 'SAMEORIGIN')\nweb.header('X-Content-Type-Options', 'nosniff')\nweb.header('X-XSS-Protection', '1')\nif not session.validate_session():\n raise web.seeother('/login')\nelse:\n input_data = model.validate_input(web.input(), ['code'])\n module_code = input_data.code.upper()\n ... | <|body_start_0|>
web.header('X-Frame-Options', 'SAMEORIGIN')
web.header('X-Content-Type-Options', 'nosniff')
web.header('X-XSS-Protection', '1')
if not session.validate_session():
raise web.seeother('/login')
else:
input_data = model.validate_input(web.inp... | This class handles the editing of a module's preclusions. | EditModulePreclusions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EditModulePreclusions:
"""This class handles the editing of a module's preclusions."""
def GET(self):
"""Handles the loading of the 'Edit Module Preclusions' page."""
<|body_0|>
def POST(self):
"""Handles the submission of updated module preclusions for a target ... | stack_v2_sparse_classes_10k_train_007045 | 1,749 | permissive | [
{
"docstring": "Handles the loading of the 'Edit Module Preclusions' page.",
"name": "GET",
"signature": "def GET(self)"
},
{
"docstring": "Handles the submission of updated module preclusions for a target module.",
"name": "POST",
"signature": "def POST(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001085 | Implement the Python class `EditModulePreclusions` described below.
Class description:
This class handles the editing of a module's preclusions.
Method signatures and docstrings:
- def GET(self): Handles the loading of the 'Edit Module Preclusions' page.
- def POST(self): Handles the submission of updated module prec... | Implement the Python class `EditModulePreclusions` described below.
Class description:
This class handles the editing of a module's preclusions.
Method signatures and docstrings:
- def GET(self): Handles the loading of the 'Edit Module Preclusions' page.
- def POST(self): Handles the submission of updated module prec... | 02b52871a34f580b779ede08750f2d4e887bcf65 | <|skeleton|>
class EditModulePreclusions:
"""This class handles the editing of a module's preclusions."""
def GET(self):
"""Handles the loading of the 'Edit Module Preclusions' page."""
<|body_0|>
def POST(self):
"""Handles the submission of updated module preclusions for a target ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EditModulePreclusions:
"""This class handles the editing of a module's preclusions."""
def GET(self):
"""Handles the loading of the 'Edit Module Preclusions' page."""
web.header('X-Frame-Options', 'SAMEORIGIN')
web.header('X-Content-Type-Options', 'nosniff')
web.header('X-... | the_stack_v2_python_sparse | components/handlers/module_edit_preclusions.py | nus-mtp/cs-modify | train | 1 |
8f67d59da3bc32ceb80cb28e394e6aca85cb7f3c | [
"if version:\n if version == 4:\n return Command.executeIp(logger, IpConstant.IPV4, IpOption.NEIGHBOUR, IpAction.SHOW)\n elif version == 6:\n return Command.executeIp(logger, IpConstant.IPV6, IpOption.NEIGHBOUR, IpAction.SHOW)\nrc = Command.executeIp(logger, IpOption.NEIGHBOUR, IpAction.SHOW)\nr... | <|body_start_0|>
if version:
if version == 4:
return Command.executeIp(logger, IpConstant.IPV4, IpOption.NEIGHBOUR, IpAction.SHOW)
elif version == 6:
return Command.executeIp(logger, IpConstant.IPV6, IpOption.NEIGHBOUR, IpAction.SHOW)
rc = Command.... | IpNeighbour | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IpNeighbour:
def showNeighbours(logger, version=None):
"""This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None"""
<|body_0|>
def showNeighboursByDevice(logger, device, version=None):
... | stack_v2_sparse_classes_10k_train_007046 | 10,343 | no_license | [
{
"docstring": "This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None",
"name": "showNeighbours",
"signature": "def showNeighbours(logger, version=None)"
},
{
"docstring": "This function list neighbour entrie... | 2 | stack_v2_sparse_classes_30k_train_000926 | Implement the Python class `IpNeighbour` described below.
Class description:
Implement the IpNeighbour class.
Method signatures and docstrings:
- def showNeighbours(logger, version=None): This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) ... | Implement the Python class `IpNeighbour` described below.
Class description:
Implement the IpNeighbour class.
Method signatures and docstrings:
- def showNeighbours(logger, version=None): This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) ... | 81bcc74fe7c0ca036ec483f634d7be0bab19a6d0 | <|skeleton|>
class IpNeighbour:
def showNeighbours(logger, version=None):
"""This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None"""
<|body_0|>
def showNeighboursByDevice(logger, device, version=None):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IpNeighbour:
def showNeighbours(logger, version=None):
"""This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None"""
if version:
if version == 4:
return Command.executeIp(logger, I... | the_stack_v2_python_sparse | oscar/a/sys/net/lnx/neighbour.py | afeset/miner2-tools | train | 0 | |
b118f558b174ec499dc5d820ac8aaffe6520cc55 | [
"self.exploration_vs_exploitation = exploration_vs_exploitation\nself.decomposition_funcs = decomposition_funcs\nself.preprocessors = preprocessors\nself.nbits = nbits\nself.seed = seed\nself.estimators = [MLPRegressor(hidden_layer_sizes=hidden_layer_sizes, alpha=alpha) for _ in range(n_estimators)]",
"coefs = [e... | <|body_start_0|>
self.exploration_vs_exploitation = exploration_vs_exploitation
self.decomposition_funcs = decomposition_funcs
self.preprocessors = preprocessors
self.nbits = nbits
self.seed = seed
self.estimators = [MLPRegressor(hidden_layer_sizes=hidden_layer_sizes, alp... | GraphNeuralNetworkScoreEstimator. | GraphNeuralNetworkScoreEstimator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphNeuralNetworkScoreEstimator:
"""GraphNeuralNetworkScoreEstimator."""
def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1):
"""init."""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_007047 | 21,013 | permissive | [
{
"docstring": "init.",
"name": "__init__",
"signature": "def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1)"
},
{
"docstring": "predict_gradient.",
"name": "predict_g... | 2 | stack_v2_sparse_classes_30k_train_001366 | Implement the Python class `GraphNeuralNetworkScoreEstimator` described below.
Class description:
GraphNeuralNetworkScoreEstimator.
Method signatures and docstrings:
- def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessor... | Implement the Python class `GraphNeuralNetworkScoreEstimator` described below.
Class description:
GraphNeuralNetworkScoreEstimator.
Method signatures and docstrings:
- def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessor... | d89e88183cce1ff24dca9333c09fa11597a45c7a | <|skeleton|>
class GraphNeuralNetworkScoreEstimator:
"""GraphNeuralNetworkScoreEstimator."""
def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1):
"""init."""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GraphNeuralNetworkScoreEstimator:
"""GraphNeuralNetworkScoreEstimator."""
def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1):
"""init."""
self.exploration_vs_exploi... | the_stack_v2_python_sparse | ego/optimization/score_estimator.py | smautner/EGO | train | 0 |
f96ce189551e8151de2b718711e8cdbff120b997 | [
"self.points = points\nxyz_min = numpy.min(points, axis=0) - 0.001\nxyz_max = numpy.max(points, axis=0) + 0.001\nif bb_cuboid:\n diff = max(xyz_max - xyz_min) - (xyz_max - xyz_min)\n xyz_min = xyz_min - diff / 2\n xyz_max = xyz_max + diff / 2\nself.xyz_min = xyz_min\nself.xyz_max = xyz_max\nsegments = []\n... | <|body_start_0|>
self.points = points
xyz_min = numpy.min(points, axis=0) - 0.001
xyz_max = numpy.max(points, axis=0) + 0.001
if bb_cuboid:
diff = max(xyz_max - xyz_min) - (xyz_max - xyz_min)
xyz_min = xyz_min - diff / 2
xyz_max = xyz_max + diff / 2
... | description | VoxelGrid | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VoxelGrid:
"""description"""
def __init__(self, points, x_y_z=(1, 1, 1), bb_cuboid=True, build=True):
"""Parameters ---------- points: (N,3) ndarray The point cloud from wich we want to construct the VoxelGrid. Where N is the number of points in the point cloud and the second dimensi... | stack_v2_sparse_classes_10k_train_007048 | 4,119 | permissive | [
{
"docstring": "Parameters ---------- points: (N,3) ndarray The point cloud from wich we want to construct the VoxelGrid. Where N is the number of points in the point cloud and the second dimension represents the x, y and z coordinates of each point. x_y_z: list The segments in wich each axis will be divided. x... | 3 | null | Implement the Python class `VoxelGrid` described below.
Class description:
description
Method signatures and docstrings:
- def __init__(self, points, x_y_z=(1, 1, 1), bb_cuboid=True, build=True): Parameters ---------- points: (N,3) ndarray The point cloud from wich we want to construct the VoxelGrid. Where N is the n... | Implement the Python class `VoxelGrid` described below.
Class description:
description
Method signatures and docstrings:
- def __init__(self, points, x_y_z=(1, 1, 1), bb_cuboid=True, build=True): Parameters ---------- points: (N,3) ndarray The point cloud from wich we want to construct the VoxelGrid. Where N is the n... | 06839b08d8e8f274c02a6bcd31bf1b32d3dc04e4 | <|skeleton|>
class VoxelGrid:
"""description"""
def __init__(self, points, x_y_z=(1, 1, 1), bb_cuboid=True, build=True):
"""Parameters ---------- points: (N,3) ndarray The point cloud from wich we want to construct the VoxelGrid. Where N is the number of points in the point cloud and the second dimensi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VoxelGrid:
"""description"""
def __init__(self, points, x_y_z=(1, 1, 1), bb_cuboid=True, build=True):
"""Parameters ---------- points: (N,3) ndarray The point cloud from wich we want to construct the VoxelGrid. Where N is the number of points in the point cloud and the second dimension represents... | the_stack_v2_python_sparse | neodroidvision/data/synthesis/conversion/mnist/threed/voxel_grid.py | aivclab/vision | train | 1 |
d204ec37394ca3d9c23e39ec01cb9c303a9927e1 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Admin()",
"from .edge import Edge\nfrom .service_announcement import ServiceAnnouncement\nfrom .sharepoint import Sharepoint\nfrom .edge import Edge\nfrom .service_announcement import ServiceAnnouncement\nfrom .sharepoint import Sharep... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Admin()
<|end_body_0|>
<|body_start_1|>
from .edge import Edge
from .service_announcement import ServiceAnnouncement
from .sharepoint import Sharepoint
from .edge import ... | Admin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Admin:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin:
"""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: Admin"""
... | stack_v2_sparse_classes_10k_train_007049 | 3,415 | 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: Admin",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(parse_n... | 3 | null | Implement the Python class `Admin` described below.
Class description:
Implement the Admin class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p... | Implement the Python class `Admin` described below.
Class description:
Implement the Admin class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Admin:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin:
"""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: Admin"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Admin:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Admin:
"""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: Admin"""
if not pars... | the_stack_v2_python_sparse | msgraph/generated/models/admin.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
d85591ecfb44339c6069d32396bda9e7ff54ef1a | [
"if 'formatter' not in overrides:\n overrides['formatter'] = TimeFormatter(rounding=ROUNDING.HALFUP)\nsuper().__init__(**overrides)",
"start, end = (self.start, self.end)\ndomain = abs(end - start)\nmajor_step = self.major_step\nif major_step is UNDEF:\n major_step = self._calc_step(domain, self.major_count... | <|body_start_0|>
if 'formatter' not in overrides:
overrides['formatter'] = TimeFormatter(rounding=ROUNDING.HALFUP)
super().__init__(**overrides)
<|end_body_0|>
<|body_start_1|>
start, end = (self.start, self.end)
domain = abs(end - start)
major_step = self.major_step... | This type of ticker generates nice looking ticks and labels for time data assuming all given data are in seconds. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set to pero.TimeFormatter, but can be cha... | TimeTicker | [
"LicenseRef-scancode-philippe-de-muyter",
"LicenseRef-scancode-commercial-license",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeTicker:
"""This type of ticker generates nice looking ticks and labels for time data assuming all given data are in seconds. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set... | stack_v2_sparse_classes_10k_train_007050 | 4,476 | permissive | [
{
"docstring": "Initializes a new instance of TimeTicker.",
"name": "__init__",
"signature": "def __init__(self, **overrides)"
},
{
"docstring": "Generates ticks according to current settings. Returns: (float,), (float,) Generated major and minor ticks.",
"name": "make_ticks",
"signature... | 4 | stack_v2_sparse_classes_30k_train_003454 | Implement the Python class `TimeTicker` described below.
Class description:
This type of ticker generates nice looking ticks and labels for time data assuming all given data are in seconds. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. ... | Implement the Python class `TimeTicker` described below.
Class description:
This type of ticker generates nice looking ticks and labels for time data assuming all given data are in seconds. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. ... | d59b1bc056f3037b7b7ab635b6deb41120612965 | <|skeleton|>
class TimeTicker:
"""This type of ticker generates nice looking ticks and labels for time data assuming all given data are in seconds. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TimeTicker:
"""This type of ticker generates nice looking ticks and labels for time data assuming all given data are in seconds. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set to pero.Time... | the_stack_v2_python_sparse | pero/tickers/timed.py | xxao/pero | train | 31 |
165d6667ee71e686634141882b2b806e4a22a047 | [
"self.phys = phys\nself.forces = forces\nn = self.phys.numAtoms()\nself.q = []\nfor i in range(0, n):\n self.q.append(self.phys.charge(i + 1))",
"n = self.phys.numAtoms()\nfor i in range(0, n):\n for j in range(i + 1, n):\n rij = self.phys.positions[j * 3:j * 3 + 3] - self.phys.positions[i * 3:i * 3 ... | <|body_start_0|>
self.phys = phys
self.forces = forces
n = self.phys.numAtoms()
self.q = []
for i in range(0, n):
self.q.append(self.phys.charge(i + 1))
<|end_body_0|>
<|body_start_1|>
n = self.phys.numAtoms()
for i in range(0, n):
for j i... | Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2 | ElectrostaticForce | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElectrostaticForce:
"""Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2"""
def __init__(self, phys, forces):
"""Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces obje... | stack_v2_sparse_classes_10k_train_007051 | 1,304 | no_license | [
{
"docstring": "Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces object",
"name": "__init__",
"signature": "def __init__(self, phys, forces)"
},
{
"docstring": "Modify energy and force vector to include thi... | 2 | stack_v2_sparse_classes_30k_train_006552 | Implement the Python class `ElectrostaticForce` described below.
Class description:
Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2
Method signatures and docstrings:
- def __init__(self, phys, forces): Initialize an object of type HDForce @type phys: Physical @param phys: The physical sy... | Implement the Python class `ElectrostaticForce` described below.
Class description:
Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2
Method signatures and docstrings:
- def __init__(self, phys, forces): Initialize an object of type HDForce @type phys: Physical @param phys: The physical sy... | 78c96b72204e301d36f8cbe03397f2a02377279f | <|skeleton|>
class ElectrostaticForce:
"""Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2"""
def __init__(self, phys, forces):
"""Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces obje... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ElectrostaticForce:
"""Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2"""
def __init__(self, phys, forces):
"""Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces object"""
... | the_stack_v2_python_sparse | mdl/src/forces/ElectrostaticForce.py | kuangchen/ProtoMolAddon | train | 1 |
963606a92e801f76468c6e9282a552232af97f85 | [
"self._model = model\nself._data = data\nself._scaled_data = scaled_data\n'\\n In a stateful LSTM network, you should only pass inputs with a number\\n of samples that can be divided by the batch size. Hence we use \"1\" as\\n it is a factor in any possible number of samples.\\n '\nself.... | <|body_start_0|>
self._model = model
self._data = data
self._scaled_data = scaled_data
'\n In a stateful LSTM network, you should only pass inputs with a number\n of samples that can be divided by the batch size. Hence we use "1" as\n it is a factor in any possible n... | Forecast LSTM. Based on: https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/ | ForecastLSTM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForecastLSTM:
"""Forecast LSTM. Based on: https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/"""
def __init__(self, model, data, scaled_data):
"""Instantiate the class. Args: model: Trained LSTM model data: Data object scaled_data: Scaled... | stack_v2_sparse_classes_10k_train_007052 | 25,558 | no_license | [
{
"docstring": "Instantiate the class. Args: model: Trained LSTM model data: Data object scaled_data: Scaled data array to be used for forecasting Returns: None",
"name": "__init__",
"signature": "def __init__(self, model, data, scaled_data)"
},
{
"docstring": "Make a one-step forecast. Args: in... | 3 | stack_v2_sparse_classes_30k_train_003917 | Implement the Python class `ForecastLSTM` described below.
Class description:
Forecast LSTM. Based on: https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/
Method signatures and docstrings:
- def __init__(self, model, data, scaled_data): Instantiate the class. Args: model:... | Implement the Python class `ForecastLSTM` described below.
Class description:
Forecast LSTM. Based on: https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/
Method signatures and docstrings:
- def __init__(self, model, data, scaled_data): Instantiate the class. Args: model:... | 36a7996b140cccb9003cba8367364645e2d65d85 | <|skeleton|>
class ForecastLSTM:
"""Forecast LSTM. Based on: https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/"""
def __init__(self, model, data, scaled_data):
"""Instantiate the class. Args: model: Trained LSTM model data: Data object scaled_data: Scaled... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ForecastLSTM:
"""Forecast LSTM. Based on: https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/"""
def __init__(self, model, data, scaled_data):
"""Instantiate the class. Args: model: Trained LSTM model data: Data object scaled_data: Scaled data array t... | the_stack_v2_python_sparse | timeseries/forecast/_archive/forecast-keras-machinelearningmastery-1543954101.py | palisadoes/AI | train | 1 |
1570a9e3f56f5326b90a087254f2cf8a76d175ce | [
"super(GibbsChain, self).__init__(net, rng, evidence)\nself.gibbs_distributions = {}\nfor node in self.net.nodes():\n self.gibbs_distributions[node] = gibbs.all_gibbs_distributions(node, rng)",
"for node in self.net.nodes():\n if node not in self.evidence:\n self.update_node(node)",
"markov_blanket... | <|body_start_0|>
super(GibbsChain, self).__init__(net, rng, evidence)
self.gibbs_distributions = {}
for node in self.net.nodes():
self.gibbs_distributions[node] = gibbs.all_gibbs_distributions(node, rng)
<|end_body_0|>
<|body_start_1|>
for node in self.net.nodes():
... | A Gibbs Markov chain. | GibbsChain | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GibbsChain:
"""A Gibbs Markov chain."""
def __init__(self, net, rng, evidence):
"""Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values"""
<|body_0|>
def transition(self):
"""Transition to next chain state by... | stack_v2_sparse_classes_10k_train_007053 | 5,157 | no_license | [
{
"docstring": "Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values",
"name": "__init__",
"signature": "def __init__(self, net, rng, evidence)"
},
{
"docstring": "Transition to next chain state by randomly updating each node in net.",
"... | 3 | stack_v2_sparse_classes_30k_train_006968 | Implement the Python class `GibbsChain` described below.
Class description:
A Gibbs Markov chain.
Method signatures and docstrings:
- def __init__(self, net, rng, evidence): Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values
- def transition(self): Transition t... | Implement the Python class `GibbsChain` described below.
Class description:
A Gibbs Markov chain.
Method signatures and docstrings:
- def __init__(self, net, rng, evidence): Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values
- def transition(self): Transition t... | 49630b731bd5b1c43eb015075cbd794428569f53 | <|skeleton|>
class GibbsChain:
"""A Gibbs Markov chain."""
def __init__(self, net, rng, evidence):
"""Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values"""
<|body_0|>
def transition(self):
"""Transition to next chain state by... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GibbsChain:
"""A Gibbs Markov chain."""
def __init__(self, net, rng, evidence):
"""Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values"""
super(GibbsChain, self).__init__(net, rng, evidence)
self.gibbs_distributions = {}
... | the_stack_v2_python_sparse | i3/mcmc.py | stuhlmueller/i3 | train | 5 |
3d8964c3943257226a2f79a7f9f5f536af386542 | [
"self.__zenhub = zenhub\nself.__client = client\nself.__log = getLogger(self)",
"self.__log.debug('Pinging zenhub')\ntry:\n response = (yield self.__zenhub.callRemote('ping'))\n self.__log.debug('Pinged zenhub: %s', response)\nexcept Exception as ex:\n self.__log.error('Ping failed: %s', ex)\n self._... | <|body_start_0|>
self.__zenhub = zenhub
self.__client = client
self.__log = getLogger(self)
<|end_body_0|>
<|body_start_1|>
self.__log.debug('Pinging zenhub')
try:
response = (yield self.__zenhub.callRemote('ping'))
self.__log.debug('Pinged zenhub: %s', ... | Simple task to ping ZenHub. PingZenHub's real purpose is to allow the ZenHubWorker to detect when ZenHub is no longer responsive (for whatever reason). | PingZenHub | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PingZenHub:
"""Simple task to ping ZenHub. PingZenHub's real purpose is to allow the ZenHubWorker to detect when ZenHub is no longer responsive (for whatever reason)."""
def __init__(self, zenhub, client):
"""Initialize a PingZenHub instance."""
<|body_0|>
def __call__(s... | stack_v2_sparse_classes_10k_train_007054 | 22,180 | no_license | [
{
"docstring": "Initialize a PingZenHub instance.",
"name": "__init__",
"signature": "def __init__(self, zenhub, client)"
},
{
"docstring": "Ping zenhub. If the ping fails, causes the connection to ZenHub to reset.",
"name": "__call__",
"signature": "def __call__(self)"
}
] | 2 | null | Implement the Python class `PingZenHub` described below.
Class description:
Simple task to ping ZenHub. PingZenHub's real purpose is to allow the ZenHubWorker to detect when ZenHub is no longer responsive (for whatever reason).
Method signatures and docstrings:
- def __init__(self, zenhub, client): Initialize a PingZ... | Implement the Python class `PingZenHub` described below.
Class description:
Simple task to ping ZenHub. PingZenHub's real purpose is to allow the ZenHubWorker to detect when ZenHub is no longer responsive (for whatever reason).
Method signatures and docstrings:
- def __init__(self, zenhub, client): Initialize a PingZ... | 1ea508c3d2b51742bc3b448c445cd0a3dba9e798 | <|skeleton|>
class PingZenHub:
"""Simple task to ping ZenHub. PingZenHub's real purpose is to allow the ZenHubWorker to detect when ZenHub is no longer responsive (for whatever reason)."""
def __init__(self, zenhub, client):
"""Initialize a PingZenHub instance."""
<|body_0|>
def __call__(s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PingZenHub:
"""Simple task to ping ZenHub. PingZenHub's real purpose is to allow the ZenHubWorker to detect when ZenHub is no longer responsive (for whatever reason)."""
def __init__(self, zenhub, client):
"""Initialize a PingZenHub instance."""
self.__zenhub = zenhub
self.__clien... | the_stack_v2_python_sparse | Products/ZenHub/zenhubworker.py | zenoss/zenoss-prodbin | train | 27 |
b02454931141648339b5569adc78116d08fc068b | [
"peak_list = self.findPeaks(height)\nif len(peak_list) <= 1:\n return 0\nelse:\n start, end = (min(peak_list[0], peak_list[1]), max(peak_list[0], peak_list[1]))\n peak_list = peak_list[2:]\n volume = self.vol(height[start:end + 1])\n while peak_list:\n next_peak_idx = peak_list.pop(0)\n ... | <|body_start_0|>
peak_list = self.findPeaks(height)
if len(peak_list) <= 1:
return 0
else:
start, end = (min(peak_list[0], peak_list[1]), max(peak_list[0], peak_list[1]))
peak_list = peak_list[2:]
volume = self.vol(height[start:end + 1])
... | Solution_A | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_A:
def trap(self, height: List[int]) -> int:
"""according to the peak and find the volume"""
<|body_0|>
def vol(self, height: List[int]) -> int:
"""Helper Aa Calculate the volume between two peaks"""
<|body_1|>
def findPeaks(self, height: List[i... | stack_v2_sparse_classes_10k_train_007055 | 5,662 | permissive | [
{
"docstring": "according to the peak and find the volume",
"name": "trap",
"signature": "def trap(self, height: List[int]) -> int"
},
{
"docstring": "Helper Aa Calculate the volume between two peaks",
"name": "vol",
"signature": "def vol(self, height: List[int]) -> int"
},
{
"do... | 3 | null | Implement the Python class `Solution_A` described below.
Class description:
Implement the Solution_A class.
Method signatures and docstrings:
- def trap(self, height: List[int]) -> int: according to the peak and find the volume
- def vol(self, height: List[int]) -> int: Helper Aa Calculate the volume between two peak... | Implement the Python class `Solution_A` described below.
Class description:
Implement the Solution_A class.
Method signatures and docstrings:
- def trap(self, height: List[int]) -> int: according to the peak and find the volume
- def vol(self, height: List[int]) -> int: Helper Aa Calculate the volume between two peak... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class Solution_A:
def trap(self, height: List[int]) -> int:
"""according to the peak and find the volume"""
<|body_0|>
def vol(self, height: List[int]) -> int:
"""Helper Aa Calculate the volume between two peaks"""
<|body_1|>
def findPeaks(self, height: List[i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution_A:
def trap(self, height: List[int]) -> int:
"""according to the peak and find the volume"""
peak_list = self.findPeaks(height)
if len(peak_list) <= 1:
return 0
else:
start, end = (min(peak_list[0], peak_list[1]), max(peak_list[0], peak_list[1])... | the_stack_v2_python_sparse | LeetCode/LC042_trapping_rain_water.py | jxie0755/Learning_Python | train | 0 | |
f010861e2989a19675cd54f6022fdac4b29ec0ff | [
"Parametre.__init__(self, 'renommer', 'rename')\nself.tronquer = True\nself.schema = '<ancien:nom_familier> <nouveau:nom_familier>'\nself.aide_courte = \"change le nom d'un familier\"\nself.aide_longue = \"Cette commande permet de changer le nom d'un familer. Ce nom est important, puisqu'il s'agit du nom que vous u... | <|body_start_0|>
Parametre.__init__(self, 'renommer', 'rename')
self.tronquer = True
self.schema = '<ancien:nom_familier> <nouveau:nom_familier>'
self.aide_courte = "change le nom d'un familier"
self.aide_longue = "Cette commande permet de changer le nom d'un familer. Ce nom est ... | Commande 'familier renommer'. | PrmRenommer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmRenommer:
"""Commande 'familier renommer'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def ajouter(self):
"""Méthode appelée lors de l'ajout de la commande à l'interpréteur"""
<|body_1|>
def interpreter(self, personnage, dic_... | stack_v2_sparse_classes_10k_train_007056 | 3,553 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode appelée lors de l'ajout de la commande à l'interpréteur",
"name": "ajouter",
"signature": "def ajouter(self)"
},
{
"docstring": "Interprétation du paramètr... | 3 | null | Implement the Python class `PrmRenommer` described below.
Class description:
Commande 'familier renommer'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def ajouter(self): Méthode appelée lors de l'ajout de la commande à l'interpréteur
- def interpreter(self, personnage, dic_masq... | Implement the Python class `PrmRenommer` described below.
Class description:
Commande 'familier renommer'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def ajouter(self): Méthode appelée lors de l'ajout de la commande à l'interpréteur
- def interpreter(self, personnage, dic_masq... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmRenommer:
"""Commande 'familier renommer'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def ajouter(self):
"""Méthode appelée lors de l'ajout de la commande à l'interpréteur"""
<|body_1|>
def interpreter(self, personnage, dic_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PrmRenommer:
"""Commande 'familier renommer'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'renommer', 'rename')
self.tronquer = True
self.schema = '<ancien:nom_familier> <nouveau:nom_familier>'
self.aide_courte = "change le nom d... | the_stack_v2_python_sparse | src/secondaires/familier/commandes/familier/renommer.py | vincent-lg/tsunami | train | 5 |
8f5f8b22d8c33add339fb30b721e08604d818ecd | [
"nums.sort()\nn = len(nums)\ntmp = list()\nans = list()\nfor i in range(n - 1, 1, -1):\n a = nums[i]\n for k in range(i - 1, 0, -1):\n b = nums[k]\n for j in range(k - 1, -1, -1):\n c = nums[j]\n if a + b + c == 0:\n tmp.append([a, b, c])\nfor li in tmp:\n ... | <|body_start_0|>
nums.sort()
n = len(nums)
tmp = list()
ans = list()
for i in range(n - 1, 1, -1):
a = nums[i]
for k in range(i - 1, 0, -1):
b = nums[k]
for j in range(k - 1, -1, -1):
c = nums[j]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum_1(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
def threeSum2(self, nums):
""":type nums: List[int] :rty... | stack_v2_sparse_classes_10k_train_007057 | 5,602 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum_1",
"signature": "def threeSum_1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums)"
},
{
"docstring": ":type ... | 3 | stack_v2_sparse_classes_30k_train_002226 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum_1(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum2(self, nums): :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum_1(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum2(self, nums): :... | 3f7b2ea959308eb80f4c65be35aaeed666570f80 | <|skeleton|>
class Solution:
def threeSum_1(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
def threeSum2(self, nums):
""":type nums: List[int] :rty... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def threeSum_1(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
nums.sort()
n = len(nums)
tmp = list()
ans = list()
for i in range(n - 1, 1, -1):
a = nums[i]
for k in range(i - 1, 0, -1):
b = nums... | the_stack_v2_python_sparse | 15.三数之和.py | dxc19951001/Everyday_LeetCode | train | 1 | |
b262c340a44780636a623d2e6a78f82fc81ace64 | [
"if d and 'object_type' in d:\n ObjectRegistry.registry[d['object_type']] = self\nABCMeta.__init__(self, name, bases, d)",
"if name in ObjectRegistry.registry:\n return ObjectRegistry.registry[name](**kwargs)\nraise NotImplementedError(gettext(\"This feature has not been implemented for object type '{0}'.\"... | <|body_start_0|>
if d and 'object_type' in d:
ObjectRegistry.registry[d['object_type']] = self
ABCMeta.__init__(self, name, bases, d)
<|end_body_0|>
<|body_start_1|>
if name in ObjectRegistry.registry:
return ObjectRegistry.registry[name](**kwargs)
raise NotImple... | class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error. | ObjectRegistry | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectRegistry:
"""class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error."""
d... | stack_v2_sparse_classes_10k_train_007058 | 31,605 | permissive | [
{
"docstring": "This method is used to register the objects based on object type.",
"name": "__init__",
"signature": "def __init__(self, name, bases, d)"
},
{
"docstring": "This method returns the object based on register object type else return not implemented error Args: name: object type for ... | 2 | stack_v2_sparse_classes_30k_val_000166 | Implement the Python class `ObjectRegistry` described below.
Class description:
class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else ... | Implement the Python class `ObjectRegistry` described below.
Class description:
class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else ... | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | <|skeleton|>
class ObjectRegistry:
"""class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error."""
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObjectRegistry:
"""class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error."""
def __init__(s... | the_stack_v2_python_sparse | _MY_ORGS/Web-Dev-Collaborative/blog-research/database/pg-admin/web/pgadmin/tools/sqleditor/command.py | bgoonz/UsefulResourceRepo2.0 | train | 10 |
df2ec3c18aa1eca3675b04d71f2b5a477577f30d | [
"if root == None:\n return ''\ndata = []\n\ndef traversal(root):\n if root == None:\n data.append('#')\n return\n data.append(str(root.val))\n traversal(root.left)\n traversal(root.right)\n return\ntraversal(root)\nreturn ' '.join(data)",
"if data == '':\n return None\ndata = da... | <|body_start_0|>
if root == None:
return ''
data = []
def traversal(root):
if root == None:
data.append('#')
return
data.append(str(root.val))
traversal(root.left)
traversal(root.right)
retur... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_007059 | 1,455 | 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_003278 | 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:... | 56047a5058c6a20b356ab20e52eacb425ad45762 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root == None:
return ''
data = []
def traversal(root):
if root == None:
data.append('#')
return
da... | the_stack_v2_python_sparse | Python/巨硬/A13.树的序列化与反序列化.py | Leahxuliu/Data-Structure-And-Algorithm | train | 2 | |
035148d5be5f89589fe82b4a4f100972a85ee38b | [
"ctx.alpha = alpha\nctx.offset = offset\nscale = 2 ** nbit - 1 if alpha is None else (2 ** nbit - 1) / alpha\nctx.scale = scale\nreturn torch.round(input * scale) / scale if offset is None else (torch.round(input * scale) + torch.round(offset)) / scale",
"if ctx.offset is None:\n return (grad_output, None, Non... | <|body_start_0|>
ctx.alpha = alpha
ctx.offset = offset
scale = 2 ** nbit - 1 if alpha is None else (2 ** nbit - 1) / alpha
ctx.scale = scale
return torch.round(input * scale) / scale if offset is None else (torch.round(input * scale) + torch.round(offset)) / scale
<|end_body_0|>
... | Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit | Quantizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Quantizer:
"""Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit"""
def forward(ctx, input, nbit, alpha=None, offset=None):
"""Forward. :pa... | stack_v2_sparse_classes_10k_train_007060 | 14,341 | permissive | [
{
"docstring": "Forward. :param input: batch of input :type input: Tensor :param nbit: bit width :type nbit: int :param alpha: scale factor :type alpha: float or Tensor :param offset: offset factor :type offset: float or Tensor :return: quantized output :rtype: Tensor",
"name": "forward",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_003283 | Implement the Python class `Quantizer` described below.
Class description:
Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit
Method signatures and docstrings:
- def forward... | Implement the Python class `Quantizer` described below.
Class description:
Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit
Method signatures and docstrings:
- def forward... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class Quantizer:
"""Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit"""
def forward(ctx, input, nbit, alpha=None, offset=None):
"""Forward. :pa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Quantizer:
"""Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit"""
def forward(ctx, input, nbit, alpha=None, offset=None):
"""Forward. :param input: ba... | the_stack_v2_python_sparse | zeus/modules/operators/quant/pytorch_quant.py | huawei-noah/xingtian | train | 308 |
85f47f0d3e6a9c0418d427d00de354e8fc2f4223 | [
"temperature = np.arange(6).reshape(2, 3)\nself.temperature_cube = set_up_variable_cube(temperature)\norography = np.array([[20.0, 30.0, 40.0, 30.0, 25.0, 25.0], [30.0, 50.0, 80.0, 60.0, 50.0, 45.0], [50.0, 65.0, 90.0, 70.0, 60.0, 50.0], [45.0, 60.0, 85.0, 65.0, 55.0, 45.0]])\norography_cube = set_up_orography_cube... | <|body_start_0|>
temperature = np.arange(6).reshape(2, 3)
self.temperature_cube = set_up_variable_cube(temperature)
orography = np.array([[20.0, 30.0, 40.0, 30.0, 25.0, 25.0], [30.0, 50.0, 80.0, 60.0, 50.0, 45.0], [50.0, 65.0, 90.0, 70.0, 60.0, 50.0], [45.0, 60.0, 85.0, 65.0, 55.0, 45.0]])
... | Test the _regrid_variable method | Test__regrid_variable | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__regrid_variable:
"""Test the _regrid_variable method"""
def setUp(self):
"""Set up input cubes"""
<|body_0|>
def test_basic(self):
"""Test cube of the correct shape and type is returned"""
<|body_1|>
def test_axis_inversion(self):
"""Te... | stack_v2_sparse_classes_10k_train_007061 | 34,979 | permissive | [
{
"docstring": "Set up input cubes",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test cube of the correct shape and type is returned",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test axes are output in ascending order",
... | 6 | null | Implement the Python class `Test__regrid_variable` described below.
Class description:
Test the _regrid_variable method
Method signatures and docstrings:
- def setUp(self): Set up input cubes
- def test_basic(self): Test cube of the correct shape and type is returned
- def test_axis_inversion(self): Test axes are out... | Implement the Python class `Test__regrid_variable` described below.
Class description:
Test the _regrid_variable method
Method signatures and docstrings:
- def setUp(self): Set up input cubes
- def test_basic(self): Test cube of the correct shape and type is returned
- def test_axis_inversion(self): Test axes are out... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test__regrid_variable:
"""Test the _regrid_variable method"""
def setUp(self):
"""Set up input cubes"""
<|body_0|>
def test_basic(self):
"""Test cube of the correct shape and type is returned"""
<|body_1|>
def test_axis_inversion(self):
"""Te... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Test__regrid_variable:
"""Test the _regrid_variable method"""
def setUp(self):
"""Set up input cubes"""
temperature = np.arange(6).reshape(2, 3)
self.temperature_cube = set_up_variable_cube(temperature)
orography = np.array([[20.0, 30.0, 40.0, 30.0, 25.0, 25.0], [30.0, 50.... | the_stack_v2_python_sparse | improver_tests/orographic_enhancement/test_OrographicEnhancement.py | metoppv/improver | train | 101 |
ccdc4a3b0ba5286393458b078f76bd7f954a9ce3 | [
"url = 'updates/cluster'\npostdata = {}\nif updateReason:\n postdata['reason'] = updateReason\nif len(opts) > 0:\n postdata['opts'] = json.dumps(opts)\ntry:\n self.post(url, postdata)\nexcept TortugaException:\n raise\nexcept Exception as ex:\n raise TortugaException(exception=ex)",
"url = 'updates... | <|body_start_0|>
url = 'updates/cluster'
postdata = {}
if updateReason:
postdata['reason'] = updateReason
if len(opts) > 0:
postdata['opts'] = json.dumps(opts)
try:
self.post(url, postdata)
except TortugaException:
raise
... | Cluster sync WS API class | SyncWsApi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyncWsApi:
"""Cluster sync WS API class"""
def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}):
"""Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException"""
<|body_0|>
def getUpdateStatus(self):
"""Re... | stack_v2_sparse_classes_10k_train_007062 | 2,010 | permissive | [
{
"docstring": "Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException",
"name": "scheduleClusterUpdate",
"signature": "def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={})"
},
{
"docstring": "Return cluster update status Returns: Boo... | 2 | stack_v2_sparse_classes_30k_train_001498 | Implement the Python class `SyncWsApi` described below.
Class description:
Cluster sync WS API class
Method signatures and docstrings:
- def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException
- def getU... | Implement the Python class `SyncWsApi` described below.
Class description:
Cluster sync WS API class
Method signatures and docstrings:
- def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}): Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException
- def getU... | 56d808d7836cd15d6c6748cbf704cdea4407fef6 | <|skeleton|>
class SyncWsApi:
"""Cluster sync WS API class"""
def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}):
"""Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException"""
<|body_0|>
def getUpdateStatus(self):
"""Re... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SyncWsApi:
"""Cluster sync WS API class"""
def scheduleClusterUpdate(self, updateReason: Optional[Union[str, None]]=None, opts={}):
"""Schedule cluster update. Returns: None Throws: UserNotAuthorized TortugaException"""
url = 'updates/cluster'
postdata = {}
if updateReason... | the_stack_v2_python_sparse | src/core/src/tortuga/wsapi/syncWsApi.py | UnivaCorporation/tortuga | train | 33 |
bddc953027593aedb9e9519b3f74892df84226cc | [
"if user.is_anonymous or user.is_client:\n return False\nif user.is_administrator:\n return False\nif user.is_manager:\n return False\nif user.is_advisor:\n return Image.objects.filter(pk=image.pk).accessible_by(user).exists()\nreturn self.admin_permission(user, image, *args)",
"if user.is_anonymous o... | <|body_start_0|>
if user.is_anonymous or user.is_client:
return False
if user.is_administrator:
return False
if user.is_manager:
return False
if user.is_advisor:
return Image.objects.filter(pk=image.pk).accessible_by(user).exists()
... | ImagePermissionLogic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImagePermissionLogic:
def view(self, user, image, *args):
"""Permissions for viewing Image"""
<|body_0|>
def create(self, user, image, *args):
"""Permissions for creating image"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if user.is_anonymous or ... | stack_v2_sparse_classes_10k_train_007063 | 1,151 | no_license | [
{
"docstring": "Permissions for viewing Image",
"name": "view",
"signature": "def view(self, user, image, *args)"
},
{
"docstring": "Permissions for creating image",
"name": "create",
"signature": "def create(self, user, image, *args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007221 | Implement the Python class `ImagePermissionLogic` described below.
Class description:
Implement the ImagePermissionLogic class.
Method signatures and docstrings:
- def view(self, user, image, *args): Permissions for viewing Image
- def create(self, user, image, *args): Permissions for creating image | Implement the Python class `ImagePermissionLogic` described below.
Class description:
Implement the ImagePermissionLogic class.
Method signatures and docstrings:
- def view(self, user, image, *args): Permissions for viewing Image
- def create(self, user, image, *args): Permissions for creating image
<|skeleton|>
cla... | 95d21cd6036a99c5f399b700a5426e9e2e17e878 | <|skeleton|>
class ImagePermissionLogic:
def view(self, user, image, *args):
"""Permissions for viewing Image"""
<|body_0|>
def create(self, user, image, *args):
"""Permissions for creating image"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImagePermissionLogic:
def view(self, user, image, *args):
"""Permissions for viewing Image"""
if user.is_anonymous or user.is_client:
return False
if user.is_administrator:
return False
if user.is_manager:
return False
if user.is_advi... | the_stack_v2_python_sparse | newsletters/perms/image_perm.py | alexandrenorman/mixeur | train | 0 | |
d4f974c9075411b7de1bb3323f797da9b7608a53 | [
"image_url1 = getParameter('image_url1')\nimage_file1 = getFile('image_file1')\nimage_base64_1 = getFile('image_base64_1')\nface_rectangle1 = getParameter('face_rectangle1')\nimage_url2 = getParameter('image_url2')\nimage_file2 = getFile('image_file2')\nimage_base64_2 = getFile('image_base64_2')\nface_rectangle2 = ... | <|body_start_0|>
image_url1 = getParameter('image_url1')
image_file1 = getFile('image_file1')
image_base64_1 = getFile('image_base64_1')
face_rectangle1 = getParameter('face_rectangle1')
image_url2 = getParameter('image_url2')
image_file2 = getFile('image_file2')
... | PredictionController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PredictionController:
def compare():
"""1 vs 1 人脸比对"""
<|body_0|>
def search():
"""1 vs n 人脸检索"""
<|body_1|>
def load_recent_prediction():
"""加载最近的识别结果"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
image_url1 = getParameter('i... | stack_v2_sparse_classes_10k_train_007064 | 1,790 | no_license | [
{
"docstring": "1 vs 1 人脸比对",
"name": "compare",
"signature": "def compare()"
},
{
"docstring": "1 vs n 人脸检索",
"name": "search",
"signature": "def search()"
},
{
"docstring": "加载最近的识别结果",
"name": "load_recent_prediction",
"signature": "def load_recent_prediction()"
}
] | 3 | stack_v2_sparse_classes_30k_train_006676 | Implement the Python class `PredictionController` described below.
Class description:
Implement the PredictionController class.
Method signatures and docstrings:
- def compare(): 1 vs 1 人脸比对
- def search(): 1 vs n 人脸检索
- def load_recent_prediction(): 加载最近的识别结果 | Implement the Python class `PredictionController` described below.
Class description:
Implement the PredictionController class.
Method signatures and docstrings:
- def compare(): 1 vs 1 人脸比对
- def search(): 1 vs n 人脸检索
- def load_recent_prediction(): 加载最近的识别结果
<|skeleton|>
class PredictionController:
def compar... | 3c756d00c83cd0a8dd745fd32a074c9121977ab8 | <|skeleton|>
class PredictionController:
def compare():
"""1 vs 1 人脸比对"""
<|body_0|>
def search():
"""1 vs n 人脸检索"""
<|body_1|>
def load_recent_prediction():
"""加载最近的识别结果"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PredictionController:
def compare():
"""1 vs 1 人脸比对"""
image_url1 = getParameter('image_url1')
image_file1 = getFile('image_file1')
image_base64_1 = getFile('image_base64_1')
face_rectangle1 = getParameter('face_rectangle1')
image_url2 = getParameter('image_url2... | the_stack_v2_python_sparse | web/prediction_controller.py | esfamely/es_face_server | train | 0 | |
84560eaf255e62046345ffe183427c23a1f61a47 | [
"Parametre.__init__(self, 'liste', 'list')\nself.tronquer = True\nself.aide_courte = 'affiche les chambres libres'\nself.aide_longue = \"Cette commande permet de lister les chambres libres d'une auberge ainsi que leur prix au jour. Vous devez vous trouver auprès d'un aubergiste pour cela. Les chambres affichées son... | <|body_start_0|>
Parametre.__init__(self, 'liste', 'list')
self.tronquer = True
self.aide_courte = 'affiche les chambres libres'
self.aide_longue = "Cette commande permet de lister les chambres libres d'une auberge ainsi que leur prix au jour. Vous devez vous trouver auprès d'un aubergis... | Commande 'louer liste' | PrmListe | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmListe:
"""Commande 'louer liste'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parame... | stack_v2_sparse_classes_10k_train_007065 | 4,343 | permissive | [
{
"docstring": "Constructeur du paramètre.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode d'interprétation de commande",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmListe` described below.
Class description:
Commande 'louer liste'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande | Implement the Python class `PrmListe` described below.
Class description:
Commande 'louer liste'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
<|skeleton|>
class PrmListe:
"""Commande 'loue... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmListe:
"""Commande 'louer liste'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PrmListe:
"""Commande 'louer liste'"""
def __init__(self):
"""Constructeur du paramètre."""
Parametre.__init__(self, 'liste', 'list')
self.tronquer = True
self.aide_courte = 'affiche les chambres libres'
self.aide_longue = "Cette commande permet de lister les chamb... | the_stack_v2_python_sparse | src/secondaires/auberge/commandes/louer/liste.py | vincent-lg/tsunami | train | 5 |
90a1f96b7268c4cff4c4973a7742f97929a265fb | [
"self.sample_size = coord_bounds\nself.coords_lo_lim = lower_lim_region_size\nself.coords_hi_lim = upper_lim_region_size\nself.dim = len(self.sample_size)",
"size = [np.random.randint(low=self.coords_lo_lim[i], high=self.coords_hi_lim[i]) for i in range(self.dim)]\ncoords_lo = [np.random.randint(low=0, high=self.... | <|body_start_0|>
self.sample_size = coord_bounds
self.coords_lo_lim = lower_lim_region_size
self.coords_hi_lim = upper_lim_region_size
self.dim = len(self.sample_size)
<|end_body_0|>
<|body_start_1|>
size = [np.random.randint(low=self.coords_lo_lim[i], high=self.coords_hi_lim[i]... | A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample. | RegionGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegionGenerator:
"""A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample."""
def __init__(self, coord_bounds: list, lower_lim_region_size: list, upper_lim_reg... | stack_v2_sparse_classes_10k_train_007066 | 2,604 | permissive | [
{
"docstring": "Parameters ---------- coord_bounds - coordinate bounds of a sample with the format: [depth, width, height] lower_lim_region_size - region minimal size along each axis with the format: [min_depth, min_width, min_height] upper_lim_region_size - region maximal size along each axis with the format: ... | 2 | stack_v2_sparse_classes_30k_train_000761 | Implement the Python class `RegionGenerator` described below.
Class description:
A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample.
Method signatures and docstrings:
- def __init__(... | Implement the Python class `RegionGenerator` described below.
Class description:
A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample.
Method signatures and docstrings:
- def __init__(... | a8b8fa0b68735a106cc4d947bdb0d6647e991fb3 | <|skeleton|>
class RegionGenerator:
"""A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample."""
def __init__(self, coord_bounds: list, lower_lim_region_size: list, upper_lim_reg... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RegionGenerator:
"""A class instance generates regions with arbitrary spatial size and location within the specified coordinate bounds. The coordinate bounds are usually the spatial size of the input sample."""
def __init__(self, coord_bounds: list, lower_lim_region_size: list, upper_lim_region_size: lis... | the_stack_v2_python_sparse | elektronn3/data/transforms/region_generator.py | ELEKTRONN/elektronn3 | train | 167 |
f6a2d84c6c26292b2622a9487cde697bf4f90517 | [
"if self.action in ['retrieve', 'list', 'add_view']:\n permission_classes = [AllowAny]\nelse:\n permission_classes = [IsAdminUser]\nreturn [permission() for permission in permission_classes]",
"queryset = super().get_queryset()\nif self.request.user.is_authenticated and self.request.user.is_staff:\n retu... | <|body_start_0|>
if self.action in ['retrieve', 'list', 'add_view']:
permission_classes = [AllowAny]
else:
permission_classes = [IsAdminUser]
return [permission() for permission in permission_classes]
<|end_body_0|>
<|body_start_1|>
queryset = super().get_queryse... | Provide all methods for manage Story. | StoryViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StoryViewSet:
"""Provide all methods for manage Story."""
def get_permissions(self):
"""Instantiates and returns the list of permissions that this view requires."""
<|body_0|>
def get_queryset(self):
"""Customize the queryset according to the current user."""
... | stack_v2_sparse_classes_10k_train_007067 | 3,643 | no_license | [
{
"docstring": "Instantiates and returns the list of permissions that this view requires.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Customize the queryset according to the current user.",
"name": "get_queryset",
"signature": "def get_queryse... | 4 | stack_v2_sparse_classes_30k_train_006005 | Implement the Python class `StoryViewSet` described below.
Class description:
Provide all methods for manage Story.
Method signatures and docstrings:
- def get_permissions(self): Instantiates and returns the list of permissions that this view requires.
- def get_queryset(self): Customize the queryset according to the... | Implement the Python class `StoryViewSet` described below.
Class description:
Provide all methods for manage Story.
Method signatures and docstrings:
- def get_permissions(self): Instantiates and returns the list of permissions that this view requires.
- def get_queryset(self): Customize the queryset according to the... | 617f6c990845d233efa64c9f0b309f5afef17590 | <|skeleton|>
class StoryViewSet:
"""Provide all methods for manage Story."""
def get_permissions(self):
"""Instantiates and returns the list of permissions that this view requires."""
<|body_0|>
def get_queryset(self):
"""Customize the queryset according to the current user."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StoryViewSet:
"""Provide all methods for manage Story."""
def get_permissions(self):
"""Instantiates and returns the list of permissions that this view requires."""
if self.action in ['retrieve', 'list', 'add_view']:
permission_classes = [AllowAny]
else:
pe... | the_stack_v2_python_sparse | apps/story/views.py | patate-et-cornichon/patateetcornichon-api | train | 3 |
ae2de0cebcca72fc50ed0898603b49c1bc827754 | [
"self.setFragmentParent(page)\nself.hyperbola = hyperbola\nself._resolver = ixmantissa.ITemplateNameResolver(self.hyperbola.store)\nsuper(BlogListFragment, self).__init__()",
"site = ixmantissa.ISiteURLGenerator(self.hyperbola.store.parent)\nblogURL = websharing.linkTo(blog)\nsiteURL = site.encryptedRoot()\nblogU... | <|body_start_0|>
self.setFragmentParent(page)
self.hyperbola = hyperbola
self._resolver = ixmantissa.ITemplateNameResolver(self.hyperbola.store)
super(BlogListFragment, self).__init__()
<|end_body_0|>
<|body_start_1|>
site = ixmantissa.ISiteURLGenerator(self.hyperbola.store.pare... | Fragment which renders a list of all blogs | BlogListFragment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogListFragment:
"""Fragment which renders a list of all blogs"""
def __init__(self, page, hyperbola):
"""@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence"""
<|body_0|>
def _getPostURL(self, blog):
"""Figure out a URL which could be used for ... | stack_v2_sparse_classes_10k_train_007068 | 28,777 | permissive | [
{
"docstring": "@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence",
"name": "__init__",
"signature": "def __init__(self, page, hyperbola)"
},
{
"docstring": "Figure out a URL which could be used for posting to C{blog} @type blog: L{xmantissa.sharing.SharedProxy} @rtype: L{nevo... | 3 | stack_v2_sparse_classes_30k_train_002197 | Implement the Python class `BlogListFragment` described below.
Class description:
Fragment which renders a list of all blogs
Method signatures and docstrings:
- def __init__(self, page, hyperbola): @type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence
- def _getPostURL(self, blog): Figure out a URL whi... | Implement the Python class `BlogListFragment` described below.
Class description:
Fragment which renders a list of all blogs
Method signatures and docstrings:
- def __init__(self, page, hyperbola): @type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence
- def _getPostURL(self, blog): Figure out a URL whi... | bf9c26051e8dfd1325bdc63aab1c560dbad7f6b7 | <|skeleton|>
class BlogListFragment:
"""Fragment which renders a list of all blogs"""
def __init__(self, page, hyperbola):
"""@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence"""
<|body_0|>
def _getPostURL(self, blog):
"""Figure out a URL which could be used for ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BlogListFragment:
"""Fragment which renders a list of all blogs"""
def __init__(self, page, hyperbola):
"""@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence"""
self.setFragmentParent(page)
self.hyperbola = hyperbola
self._resolver = ixmantissa.ITemplateN... | the_stack_v2_python_sparse | Hyperbola/hyperbola/hyperbola_view.py | feitianyiren/divmod.org | train | 0 |
20f658c5be84d6dbc4c99b6e7c2ef2a11d4d53eb | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SimulationReportOverview()",
"from .recommended_action import RecommendedAction\nfrom .simulation_events_content import SimulationEventsContent\nfrom .training_events_content import TrainingEventsContent\nfrom .recommended_action impor... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return SimulationReportOverview()
<|end_body_0|>
<|body_start_1|>
from .recommended_action import RecommendedAction
from .simulation_events_content import SimulationEventsContent
from .... | SimulationReportOverview | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimulationReportOverview:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationReportOverview:
"""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 cre... | stack_v2_sparse_classes_10k_train_007069 | 4,392 | 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: SimulationReportOverview",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimi... | 3 | stack_v2_sparse_classes_30k_train_005093 | Implement the Python class `SimulationReportOverview` described below.
Class description:
Implement the SimulationReportOverview class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationReportOverview: Creates a new instance of the appropriate c... | Implement the Python class `SimulationReportOverview` described below.
Class description:
Implement the SimulationReportOverview class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationReportOverview: Creates a new instance of the appropriate c... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class SimulationReportOverview:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationReportOverview:
"""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 cre... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SimulationReportOverview:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationReportOverview:
"""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... | the_stack_v2_python_sparse | msgraph/generated/models/simulation_report_overview.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
1d33c339a471d73df0253d0cda5ebe5e059f8fc7 | [
"length = len(nums)\nif length > 0:\n maxSoFar = nums[0]\n maxEndingHere = nums[0]\n for i in range(1, length):\n maxEndingHere = max(maxEndingHere + nums[i], nums[i])\n maxSoFar = max(maxSoFar, maxEndingHere)\n return maxSoFar\nelse:\n return 0",
"count = len(nums)\nif count == 0:\n ... | <|body_start_0|>
length = len(nums)
if length > 0:
maxSoFar = nums[0]
maxEndingHere = nums[0]
for i in range(1, length):
maxEndingHere = max(maxEndingHere + nums[i], nums[i])
maxSoFar = max(maxSoFar, maxEndingHere)
return ma... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray_self(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = len(nums)
if length > 0... | stack_v2_sparse_classes_10k_train_007070 | 896 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray",
"signature": "def maxSubArray(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_self",
"signature": "def maxSubArray_self(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_self(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_self(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxSub... | ea492ec864b50547214ecbbb2cdeeac21e70229b | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray_self(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
length = len(nums)
if length > 0:
maxSoFar = nums[0]
maxEndingHere = nums[0]
for i in range(1, length):
maxEndingHere = max(maxEndingHere + nums[i], nums[i... | the_stack_v2_python_sparse | 53_maximum_subarray/sol.py | lianke123321/leetcode_sol | train | 0 | |
f54aeed44b551aa2eb2a75dd4d85bccd44a97262 | [
"result = '{key:s}{type:s}'.format(key=self.oauth_consumer_key, type=' [cs]' if self.consumer_site_id else ' [pl]' if self.playlist_id else '')\nif self.deleted:\n result = _('{:s}[deleted]').format(result)\nreturn result",
"if self.consumer_site and self.playlist:\n message = _('You should set either a Con... | <|body_start_0|>
result = '{key:s}{type:s}'.format(key=self.oauth_consumer_key, type=' [cs]' if self.consumer_site_id else ' [pl]' if self.playlist_id else '')
if self.deleted:
result = _('{:s}[deleted]').format(result)
return result
<|end_body_0|>
<|body_start_1|>
if self.c... | Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instructor. A playlist pre-exists in Marsha. Th... | LTIPassport | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LTIPassport:
"""Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instruct... | stack_v2_sparse_classes_10k_train_007071 | 20,635 | permissive | [
{
"docstring": "Get the string representation of an instance.",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Clean instance fields before saving.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Generate the oauth consumer key and sha... | 3 | null | Implement the Python class `LTIPassport` described below.
Class description:
Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlis... | Implement the Python class `LTIPassport` described below.
Class description:
Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlis... | f767f1bdc12c9712f26ea17cb8b19f536389f0ed | <|skeleton|>
class LTIPassport:
"""Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instruct... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LTIPassport:
"""Model representing an LTI passport for LTI consumers to interact with Marsha. An LTI passport stores credentials that can be used by an LTI consumer to interact with Marsha acting as an LTI provider. A passport can be granted for: - a playlist: to be used when we trust an instructor. A playlis... | the_stack_v2_python_sparse | src/backend/marsha/core/models/account.py | openfun/marsha | train | 92 |
074f25ac8b0fc9bb33cfd536ce98c5347e47bb29 | [
"self.action = action\nself.datastore_entity = datastore_entity\nself.power_state_config = power_state_config\nself.rename_restored_object_param = rename_restored_object_param\nself.resource_pool_entity = resource_pool_entity\nself.restore_parent_source = restore_parent_source\nself.restored_objects_network_config ... | <|body_start_0|>
self.action = action
self.datastore_entity = datastore_entity
self.power_state_config = power_state_config
self.rename_restored_object_param = rename_restored_object_param
self.resource_pool_entity = resource_pool_entity
self.restore_parent_source = resto... | Implementation of the 'RestoreObjectParams' model. TODO: type description here. Attributes: action (int): The action to perform. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional if object is being restored to its original parent source. If not spe... | RestoreObjectParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreObjectParams:
"""Implementation of the 'RestoreObjectParams' model. TODO: type description here. Attributes: action (int): The action to perform. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional if object is being res... | stack_v2_sparse_classes_10k_train_007072 | 7,111 | permissive | [
{
"docstring": "Constructor for the RestoreObjectParams class",
"name": "__init__",
"signature": "def __init__(self, action=None, datastore_entity=None, power_state_config=None, rename_restored_object_param=None, resource_pool_entity=None, restore_parent_source=None, restored_objects_network_config=None... | 2 | null | Implement the Python class `RestoreObjectParams` described below.
Class description:
Implementation of the 'RestoreObjectParams' model. TODO: type description here. Attributes: action (int): The action to perform. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This f... | Implement the Python class `RestoreObjectParams` described below.
Class description:
Implementation of the 'RestoreObjectParams' model. TODO: type description here. Attributes: action (int): The action to perform. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This f... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreObjectParams:
"""Implementation of the 'RestoreObjectParams' model. TODO: type description here. Attributes: action (int): The action to perform. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional if object is being res... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RestoreObjectParams:
"""Implementation of the 'RestoreObjectParams' model. TODO: type description here. Attributes: action (int): The action to perform. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional if object is being restored to its ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_object_params.py | cohesity/management-sdk-python | train | 24 |
e527c2db8b182bbe208f446d07b5c47c1dd77d08 | [
"self.__screen = screen\nself.__msg = INSTALLATION_COMPLETED.localize() + REBOOT_MSG.localize()\nself.__buttonsBar = ButtonBar(self.__screen, [(REBOOT.localize(), 'reboot')])\nself.__grid = GridForm(self.__screen, IBM_ZKVM.localize() % STR_VERSION, 1, 2)\nself.__grid.add(self.__buttonsBar, 0, 1, (0, 1, 0, 0))",
"... | <|body_start_0|>
self.__screen = screen
self.__msg = INSTALLATION_COMPLETED.localize() + REBOOT_MSG.localize()
self.__buttonsBar = ButtonBar(self.__screen, [(REBOOT.localize(), 'reboot')])
self.__grid = GridForm(self.__screen, IBM_ZKVM.localize() % STR_VERSION, 1, 2)
self.__grid.... | Last screen for the installer application | RebootSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RebootSystem:
"""Last screen for the installer application"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
<|body_0|>
def run(self, error=False):
"""Draws the screen @type error: boolean @param error:... | stack_v2_sparse_classes_10k_train_007073 | 1,427 | no_license | [
{
"docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance",
"name": "__init__",
"signature": "def __init__(self, screen)"
},
{
"docstring": "Draws the screen @type error: boolean @param error: reboot due to error @rtype: integer @returns: sucess status",
"name... | 2 | stack_v2_sparse_classes_30k_train_001396 | Implement the Python class `RebootSystem` described below.
Class description:
Last screen for the installer application
Method signatures and docstrings:
- def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance
- def run(self, error=False): Draws the screen @type error: ... | Implement the Python class `RebootSystem` described below.
Class description:
Last screen for the installer application
Method signatures and docstrings:
- def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance
- def run(self, error=False): Draws the screen @type error: ... | 1c738fd5e6ee3f8fd4f47acf2207038f20868212 | <|skeleton|>
class RebootSystem:
"""Last screen for the installer application"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
<|body_0|>
def run(self, error=False):
"""Draws the screen @type error: boolean @param error:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RebootSystem:
"""Last screen for the installer application"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
self.__screen = screen
self.__msg = INSTALLATION_COMPLETED.localize() + REBOOT_MSG.localize()
self.__bu... | the_stack_v2_python_sparse | zfrobisher-installer/src/viewer/newt/rebootsystem.py | fedosu85nce/work | train | 2 |
796cfb8e71990ec8a252dc775aaff0e21be06e15 | [
"self.vocab = vocab\nself.unk_token = unk_token\nself.normalize_text = normalize_text",
"if self.normalize_text:\n text = unicodedata.normalize('NFKC', text)\noutput_tokens = []\nfor char in text:\n if char not in self.vocab:\n output_tokens.append(self.unk_token)\n continue\n output_tokens... | <|body_start_0|>
self.vocab = vocab
self.unk_token = unk_token
self.normalize_text = normalize_text
<|end_body_0|>
<|body_start_1|>
if self.normalize_text:
text = unicodedata.normalize('NFKC', text)
output_tokens = []
for char in text:
if char not... | Runs Character tokenization. | CharacterTokenizer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharacterTokenizer:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) ... | stack_v2_sparse_classes_10k_train_007074 | 40,187 | permissive | [
{
"docstring": "Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) boolean (default True) Whether to apply unicode normalization to text before tokenization.",
"name": "__init__",
"signatu... | 2 | null | Implement the Python class `CharacterTokenizer` described below.
Class description:
Runs Character tokenization.
Method signatures and docstrings:
- def __init__(self, vocab, unk_token, normalize_text=True): Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for o... | Implement the Python class `CharacterTokenizer` described below.
Class description:
Runs Character tokenization.
Method signatures and docstrings:
- def __init__(self, vocab, unk_token, normalize_text=True): Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for o... | 4fa0aff21ee083d0197a898cdf17ff476fae2ac3 | <|skeleton|>
class CharacterTokenizer:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CharacterTokenizer:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) boolean (defa... | the_stack_v2_python_sparse | src/transformers/models/bert_japanese/tokenization_bert_japanese.py | huggingface/transformers | train | 102,193 |
b01b045560974ed8e326e8ebeb4f91ffbaee1c7c | [
"super(Criterion, self).__init__()\nself.n_classes = opt.n_classes\nself.pos_weight = opt.loss_multisimilarity_pos_weight\nself.neg_weight = opt.loss_multisimilarity_neg_weight\nself.margin = opt.loss_multisimilarity_margin\nself.thresh = opt.loss_multisimilarity_thresh\nself.name = 'multisimilarity'",
"similarit... | <|body_start_0|>
super(Criterion, self).__init__()
self.n_classes = opt.n_classes
self.pos_weight = opt.loss_multisimilarity_pos_weight
self.neg_weight = opt.loss_multisimilarity_neg_weight
self.margin = opt.loss_multisimilarity_margin
self.thresh = opt.loss_multisimilari... | Criterion | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Criterion:
def __init__(self, opt):
"""Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training."""
<|body_0|>
def forward(self, batch, labels):
"... | stack_v2_sparse_classes_10k_train_007075 | 2,496 | permissive | [
{
"docstring": "Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training.",
"name": "__init__",
"signature": "def __init__(self, opt)"
},
{
"docstring": "Args: batch: torch.Te... | 2 | stack_v2_sparse_classes_30k_train_005434 | Implement the Python class `Criterion` described below.
Class description:
Implement the Criterion class.
Method signatures and docstrings:
- def __init__(self, opt): Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of differe... | Implement the Python class `Criterion` described below.
Class description:
Implement the Criterion class.
Method signatures and docstrings:
- def __init__(self, opt): Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of differe... | 01a7220bac7ebb1e70416ef663f3ba7cee9e8bf5 | <|skeleton|>
class Criterion:
def __init__(self, opt):
"""Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training."""
<|body_0|>
def forward(self, batch, labels):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Criterion:
def __init__(self, opt):
"""Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training."""
super(Criterion, self).__init__()
self.n_classes = opt.n_classes
... | the_stack_v2_python_sparse | criteria/multisimilarity.py | chenyanlinzhugoushou/DCML | train | 0 | |
4a0521e733d7580ef3eba6519f3e26a369b68637 | [
"super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.kernel_size = kernel_size\nself._conv = conv\nshape = (kernel_size, in_channels, out_channels)\nself.weight = torch.nn.Parameter(torch.Tensor(*shape))\nif bias:\n self.bias = torch.nn.Parameter(torch.Tensor(out_channels))... | <|body_start_0|>
super().__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.kernel_size = kernel_size
self._conv = conv
shape = (kernel_size, in_channels, out_channels)
self.weight = torch.nn.Parameter(torch.Tensor(*shape))
if ... | Graph convolutional layer. | ChebConv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChebConv:
"""Graph convolutional layer."""
def __init__(self, in_channels, out_channels, kernel_size, bias=True, conv=cheb_conv):
"""Initialize the Chebyshev layer. Args: in_channels (int): Number of channels/features in the input graph. out_channels (int): Number of channels/feature... | stack_v2_sparse_classes_10k_train_007076 | 41,403 | no_license | [
{
"docstring": "Initialize the Chebyshev layer. Args: in_channels (int): Number of channels/features in the input graph. out_channels (int): Number of channels/features in the output graph. kernel_size (int): Number of trainable parameters per filter, which is also the size of the convolutional kernel. The orde... | 3 | null | Implement the Python class `ChebConv` described below.
Class description:
Graph convolutional layer.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, kernel_size, bias=True, conv=cheb_conv): Initialize the Chebyshev layer. Args: in_channels (int): Number of channels/features in the in... | Implement the Python class `ChebConv` described below.
Class description:
Graph convolutional layer.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, kernel_size, bias=True, conv=cheb_conv): Initialize the Chebyshev layer. Args: in_channels (int): Number of channels/features in the in... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class ChebConv:
"""Graph convolutional layer."""
def __init__(self, in_channels, out_channels, kernel_size, bias=True, conv=cheb_conv):
"""Initialize the Chebyshev layer. Args: in_channels (int): Number of channels/features in the input graph. out_channels (int): Number of channels/feature... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChebConv:
"""Graph convolutional layer."""
def __init__(self, in_channels, out_channels, kernel_size, bias=True, conv=cheb_conv):
"""Initialize the Chebyshev layer. Args: in_channels (int): Number of channels/features in the input graph. out_channels (int): Number of channels/features in the outp... | the_stack_v2_python_sparse | generated/test_deepsphere_deepsphere_pytorch.py | jansel/pytorch-jit-paritybench | train | 35 |
86df5f8b13401771eef7316d913ac9570fc5e948 | [
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_responses('English')\nself.assertIn('English', my_survey.responses)",
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['English', 'Spanish... | <|body_start_0|>
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_responses('English')
self.assertIn('English', my_survey.responses)
<|end_body_0|>
<|body_start_1|>
question = 'What language did you first learn to spe... | Tests for the class AnonymousSurvey | TestAnonymousSurvey | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAnonymousSurvey:
"""Tests for the class AnonymousSurvey"""
def test_store_single_response(self):
"""Test that a single response is stored properly."""
<|body_0|>
def test_store_three_responses(self):
"""Test that three individual responses are stored properly... | stack_v2_sparse_classes_10k_train_007077 | 850 | no_license | [
{
"docstring": "Test that a single response is stored properly.",
"name": "test_store_single_response",
"signature": "def test_store_single_response(self)"
},
{
"docstring": "Test that three individual responses are stored properly.",
"name": "test_store_three_responses",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_006979 | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Tests for the class AnonymousSurvey
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored properly.
- def test_store_three_responses(self): Test that three individual response... | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Tests for the class AnonymousSurvey
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored properly.
- def test_store_three_responses(self): Test that three individual response... | cc8bf7577c69544e67bf1ddada6dd4f3165610cb | <|skeleton|>
class TestAnonymousSurvey:
"""Tests for the class AnonymousSurvey"""
def test_store_single_response(self):
"""Test that a single response is stored properly."""
<|body_0|>
def test_store_three_responses(self):
"""Test that three individual responses are stored properly... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestAnonymousSurvey:
"""Tests for the class AnonymousSurvey"""
def test_store_single_response(self):
"""Test that a single response is stored properly."""
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_respons... | the_stack_v2_python_sparse | chapter11_tetsting/2_test_class/test_survey.py | yigitkarabiyik/python_crash_course_answers | train | 1 |
ff2479cdfbadd59bcfda849b5f8f21a26d198143 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.TxTime = TxTime\nself.TxPos = TxPos\nself.RcvTime = RcvTime\nself.RcvPos = RcvPos\nself.SRPTime = SRPTime\nself.SRPPos = SRPPos\nself.AmpSF = AmpSF\nself.TropoSRP = TropoSR... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.TxTime = TxTime
self.TxPos = TxPos
self.RcvTime = RcvTime
self.RcvPos = RcvPos
self.SRPTime ... | The vector parameters sizes object. | VectorParametersType | [
"LicenseRef-scancode-free-unknown",
"MIT",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VectorParametersType:
"""The vector parameters sizes object."""
def __init__(self, TxTime=8, TxPos=24, RcvTime=8, RcvPos=24, SRPTime=None, SRPPos=24, AmpSF=None, TropoSRP=None, FxParameters=None, TOAParameters=None, **kwargs):
"""Parameters ---------- TxTime : int TxPos : int RcvTime... | stack_v2_sparse_classes_10k_train_007078 | 10,466 | permissive | [
{
"docstring": "Parameters ---------- TxTime : int TxPos : int RcvTime : int RcvPos : int SRPTime : None|int SRPPos : int AmpSF : None|int TropoSRP : None|int FxParameters : None|FxParametersType TOAParameters : None|TOAParametersType kwargs",
"name": "__init__",
"signature": "def __init__(self, TxTime=... | 4 | stack_v2_sparse_classes_30k_train_000079 | Implement the Python class `VectorParametersType` described below.
Class description:
The vector parameters sizes object.
Method signatures and docstrings:
- def __init__(self, TxTime=8, TxPos=24, RcvTime=8, RcvPos=24, SRPTime=None, SRPPos=24, AmpSF=None, TropoSRP=None, FxParameters=None, TOAParameters=None, **kwargs... | Implement the Python class `VectorParametersType` described below.
Class description:
The vector parameters sizes object.
Method signatures and docstrings:
- def __init__(self, TxTime=8, TxPos=24, RcvTime=8, RcvPos=24, SRPTime=None, SRPPos=24, AmpSF=None, TropoSRP=None, FxParameters=None, TOAParameters=None, **kwargs... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class VectorParametersType:
"""The vector parameters sizes object."""
def __init__(self, TxTime=8, TxPos=24, RcvTime=8, RcvPos=24, SRPTime=None, SRPPos=24, AmpSF=None, TropoSRP=None, FxParameters=None, TOAParameters=None, **kwargs):
"""Parameters ---------- TxTime : int TxPos : int RcvTime... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VectorParametersType:
"""The vector parameters sizes object."""
def __init__(self, TxTime=8, TxPos=24, RcvTime=8, RcvPos=24, SRPTime=None, SRPPos=24, AmpSF=None, TropoSRP=None, FxParameters=None, TOAParameters=None, **kwargs):
"""Parameters ---------- TxTime : int TxPos : int RcvTime : int RcvPos... | the_stack_v2_python_sparse | sarpy/io/phase_history/cphd0_3_elements/VectorParameters.py | ngageoint/sarpy | train | 192 |
3571fe525cc229d60ac2beecc85b12280658eea6 | [
"site = models.SiteSettings.objects.get()\ndata = {'form': forms.RegistrationForm(instance=site)}\nreturn TemplateResponse(request, 'settings/registration.html', data)",
"site = models.SiteSettings.objects.get()\nform = forms.RegistrationForm(request.POST, request.FILES, instance=site)\nif not form.is_valid():\n ... | <|body_start_0|>
site = models.SiteSettings.objects.get()
data = {'form': forms.RegistrationForm(instance=site)}
return TemplateResponse(request, 'settings/registration.html', data)
<|end_body_0|>
<|body_start_1|>
site = models.SiteSettings.objects.get()
form = forms.Registratio... | Control everything about registration | Registration | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Registration:
"""Control everything about registration"""
def get(self, request):
"""edit form"""
<|body_0|>
def post(self, request):
"""edit the site settings"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
site = models.SiteSettings.objects.ge... | stack_v2_sparse_classes_10k_train_007079 | 3,435 | no_license | [
{
"docstring": "edit form",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "edit the site settings",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000375 | Implement the Python class `Registration` described below.
Class description:
Control everything about registration
Method signatures and docstrings:
- def get(self, request): edit form
- def post(self, request): edit the site settings | Implement the Python class `Registration` described below.
Class description:
Control everything about registration
Method signatures and docstrings:
- def get(self, request): edit form
- def post(self, request): edit the site settings
<|skeleton|>
class Registration:
"""Control everything about registration"""
... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class Registration:
"""Control everything about registration"""
def get(self, request):
"""edit form"""
<|body_0|>
def post(self, request):
"""edit the site settings"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Registration:
"""Control everything about registration"""
def get(self, request):
"""edit form"""
site = models.SiteSettings.objects.get()
data = {'form': forms.RegistrationForm(instance=site)}
return TemplateResponse(request, 'settings/registration.html', data)
def p... | the_stack_v2_python_sparse | bookwyrm/views/admin/site.py | bookwyrm-social/bookwyrm | train | 1,398 |
60392b959b52d3e8e49f8e465d1a3644d085de2c | [
"with open(path, 'r') as stream:\n lines = []\n for line in stream:\n if line.startswith(self.separator):\n yield self._parse(''.join(lines))\n lines = []\n else:\n lines.append(line)",
"with open(path, 'r') as stream:\n for line in stream:\n yield se... | <|body_start_0|>
with open(path, 'r') as stream:
lines = []
for line in stream:
if line.startswith(self.separator):
yield self._parse(''.join(lines))
lines = []
else:
lines.append(line)
<|end_body... | Parser reads trace log files generated by the Fluidinfo API service. | TraceLogParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TraceLogParser:
"""Parser reads trace log files generated by the Fluidinfo API service."""
def parseOldFormat(self, path):
"""Generator that loads L{TraceLog} instances from an old log file. Old logs used multiple lines for each L{TraceLog}. This method is kept for backwards compatib... | stack_v2_sparse_classes_10k_train_007080 | 10,436 | permissive | [
{
"docstring": "Generator that loads L{TraceLog} instances from an old log file. Old logs used multiple lines for each L{TraceLog}. This method is kept for backwards compatibility. @param path: The path to a trace log file.",
"name": "parseOldFormat",
"signature": "def parseOldFormat(self, path)"
},
... | 3 | stack_v2_sparse_classes_30k_test_000086 | Implement the Python class `TraceLogParser` described below.
Class description:
Parser reads trace log files generated by the Fluidinfo API service.
Method signatures and docstrings:
- def parseOldFormat(self, path): Generator that loads L{TraceLog} instances from an old log file. Old logs used multiple lines for eac... | Implement the Python class `TraceLogParser` described below.
Class description:
Parser reads trace log files generated by the Fluidinfo API service.
Method signatures and docstrings:
- def parseOldFormat(self, path): Generator that loads L{TraceLog} instances from an old log file. Old logs used multiple lines for eac... | b5a8c8349f3eaf3364cc4efba4736c3e33b30d96 | <|skeleton|>
class TraceLogParser:
"""Parser reads trace log files generated by the Fluidinfo API service."""
def parseOldFormat(self, path):
"""Generator that loads L{TraceLog} instances from an old log file. Old logs used multiple lines for each L{TraceLog}. This method is kept for backwards compatib... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TraceLogParser:
"""Parser reads trace log files generated by the Fluidinfo API service."""
def parseOldFormat(self, path):
"""Generator that loads L{TraceLog} instances from an old log file. Old logs used multiple lines for each L{TraceLog}. This method is kept for backwards compatibility. @param... | the_stack_v2_python_sparse | fluiddb/scripts/logs.py | fluidinfo/fluiddb | train | 3 |
37894ebd2417402c047a0f492707e5acb428afff | [
"from collections import Counter\nsize = len(p)\nans = []\nfor i in range(len(s) - size + 1):\n c = Counter(s[i:size + i]) - Counter(p)\n if len(list(c.elements())) == 0:\n ans.append(i)\nreturn ans",
"ans = []\nsize = len(p)\npd = {}\nfor c in p:\n if c in pd:\n pd[c] += 1\n else:\n ... | <|body_start_0|>
from collections import Counter
size = len(p)
ans = []
for i in range(len(s) - size + 1):
c = Counter(s[i:size + i]) - Counter(p)
if len(list(c.elements())) == 0:
ans.append(i)
return ans
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findAnagrams2(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_0|>
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections impor... | stack_v2_sparse_classes_10k_train_007081 | 3,017 | no_license | [
{
"docstring": ":type s: str :type p: str :rtype: List[int]",
"name": "findAnagrams2",
"signature": "def findAnagrams2(self, s, p)"
},
{
"docstring": ":type s: str :type p: str :rtype: List[int]",
"name": "findAnagrams",
"signature": "def findAnagrams(self, s, p)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007334 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAnagrams2(self, s, p): :type s: str :type p: str :rtype: List[int]
- def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAnagrams2(self, s, p): :type s: str :type p: str :rtype: List[int]
- def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
<|skeleton|>
class Solutio... | a57282895fb213b68e5d81db301903721a92d80f | <|skeleton|>
class Solution:
def findAnagrams2(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_0|>
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findAnagrams2(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
from collections import Counter
size = len(p)
ans = []
for i in range(len(s) - size + 1):
c = Counter(s[i:size + i]) - Counter(p)
if len(list(c.elements())... | the_stack_v2_python_sparse | Python/438_find-all-anagrams-in-a-string.py | antonylu/leetcode2 | train | 0 | |
1c2587e2e11a60265619963bdf60ef9e0b94f7ca | [
"if JoinCode.objects.filter(code=joincode).exists():\n JoinerCode = JoinCode.objects.get(code=joincode)\n if not JoinerCode.used:\n return True\nreturn False",
"JoinCodeInstance = JoinCode.objects.get(code=joincode)\nJoinCodeInstance.joiner = joiner\nJoinCodeInstance.used = True\nJoinCodeInstance.sav... | <|body_start_0|>
if JoinCode.objects.filter(code=joincode).exists():
JoinerCode = JoinCode.objects.get(code=joincode)
if not JoinerCode.used:
return True
return False
<|end_body_0|>
<|body_start_1|>
JoinCodeInstance = JoinCode.objects.get(code=joincode)
... | Creates the user account in admin group using the joincode | ShopOwnerSignUpAPIView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShopOwnerSignUpAPIView:
"""Creates the user account in admin group using the joincode"""
def _isJoinCodeValid(self, joincode):
"""Check if the joincode is valid"""
<|body_0|>
def _addJoinerInJoinCodeInstance(self, joincode, joiner):
"""The joiner will be saved wi... | stack_v2_sparse_classes_10k_train_007082 | 15,595 | permissive | [
{
"docstring": "Check if the joincode is valid",
"name": "_isJoinCodeValid",
"signature": "def _isJoinCodeValid(self, joincode)"
},
{
"docstring": "The joiner will be saved with the joincode instance",
"name": "_addJoinerInJoinCodeInstance",
"signature": "def _addJoinerInJoinCodeInstance... | 3 | stack_v2_sparse_classes_30k_train_000778 | Implement the Python class `ShopOwnerSignUpAPIView` described below.
Class description:
Creates the user account in admin group using the joincode
Method signatures and docstrings:
- def _isJoinCodeValid(self, joincode): Check if the joincode is valid
- def _addJoinerInJoinCodeInstance(self, joincode, joiner): The jo... | Implement the Python class `ShopOwnerSignUpAPIView` described below.
Class description:
Creates the user account in admin group using the joincode
Method signatures and docstrings:
- def _isJoinCodeValid(self, joincode): Check if the joincode is valid
- def _addJoinerInJoinCodeInstance(self, joincode, joiner): The jo... | 82820d93876a2c3e6caec2725b1c6078e79e3bfb | <|skeleton|>
class ShopOwnerSignUpAPIView:
"""Creates the user account in admin group using the joincode"""
def _isJoinCodeValid(self, joincode):
"""Check if the joincode is valid"""
<|body_0|>
def _addJoinerInJoinCodeInstance(self, joincode, joiner):
"""The joiner will be saved wi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ShopOwnerSignUpAPIView:
"""Creates the user account in admin group using the joincode"""
def _isJoinCodeValid(self, joincode):
"""Check if the joincode is valid"""
if JoinCode.objects.filter(code=joincode).exists():
JoinerCode = JoinCode.objects.get(code=joincode)
... | the_stack_v2_python_sparse | grocery/shopowner/views.py | DeepakDk04/bigbasketClone | train | 0 |
58483fd26ded2eef48506baf01f41c8d30f8086e | [
"super().__init__(env_spec)\nself.state_des = state_des\nself.limit_rad = 0.5236\nself.kp_servo = 14.0\nself.Kp, self.Kd = (None, None)\nself.init_param(kp, kd)",
"th_x, th_y, x, y, _, _, x_dot, y_dot = obs\nerr = to.tensor([self.state_des[0] - x, self.state_des[1] - y])\nerr_dot = to.tensor([0.0 - x_dot, 0.0 - y... | <|body_start_0|>
super().__init__(env_spec)
self.state_des = state_des
self.limit_rad = 0.5236
self.kp_servo = 14.0
self.Kp, self.Kd = (None, None)
self.init_param(kp, kd)
<|end_body_0|>
<|body_start_1|>
th_x, th_y, x, y, _, _, x_dot, y_dot = obs
err = to... | PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`. | QBallBalancerPDCtrl | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QBallBalancerPDCtrl:
"""PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`.... | stack_v2_sparse_classes_10k_train_007083 | 25,612 | permissive | [
{
"docstring": "Constructor :param env_spec: environment specification :param state_des: tensor of desired x and y ball position [m] :param kp: 2x2 tensor of constant controller feedback coefficients for error [V/m] :param kd: 2x2 tensor of constant controller feedback coefficients for error time derivative [Vs... | 4 | null | Implement the Python class `QBallBalancerPDCtrl` described below.
Class description:
PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado... | Implement the Python class `QBallBalancerPDCtrl` described below.
Class description:
PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado... | a6c982862e2ab39a9f65d1c09aa59d9a8b7ac6c5 | <|skeleton|>
class QBallBalancerPDCtrl:
"""PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QBallBalancerPDCtrl:
"""PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`."""
def ... | the_stack_v2_python_sparse | Pyrado/pyrado/policies/environment_specific.py | jacarvalho/SimuRLacra | train | 0 |
2288c7e93069d369f7693626a7994bf25ef0a459 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn HostCookie()",
"from .artifact import Artifact\nfrom .host import Host\nfrom .artifact import Artifact\nfrom .host import Host\nfields: Dict[str, Callable[[Any], None]] = {'domain': lambda n: setattr(self, 'domain', n.get_str_value()),... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return HostCookie()
<|end_body_0|>
<|body_start_1|>
from .artifact import Artifact
from .host import Host
from .artifact import Artifact
from .host import Host
fields: D... | HostCookie | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostCookie:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostCookie:
"""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: Host... | stack_v2_sparse_classes_10k_train_007084 | 3,561 | 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: HostCookie",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pa... | 3 | stack_v2_sparse_classes_30k_train_006050 | Implement the Python class `HostCookie` described below.
Class description:
Implement the HostCookie class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostCookie: Creates a new instance of the appropriate class based on discriminator value Args: pa... | Implement the Python class `HostCookie` described below.
Class description:
Implement the HostCookie class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostCookie: Creates a new instance of the appropriate class based on discriminator value Args: pa... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class HostCookie:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostCookie:
"""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: Host... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HostCookie:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostCookie:
"""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: HostCookie"""
... | the_stack_v2_python_sparse | msgraph/generated/models/security/host_cookie.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
481e2ab43ed04bdc09b072fb8ebd6c9925e32787 | [
"ret = subprocess.getoutput(['swift auth'])\nret = ret.split('\\n')[0]\nret = ret.split('=')[1]\nreturn ret",
"client_url = os.environ.get('SWIFT_X_ACCOUNT_SHARING_URL', None)\nif not client_url:\n logging.log(logging.ERROR, 'Swift X Account sharing API environment variables %s%s', \"haven't been sourced. Plea... | <|body_start_0|>
ret = subprocess.getoutput(['swift auth'])
ret = ret.split('\n')[0]
ret = ret.split('=')[1]
return ret
<|end_body_0|>
<|body_start_1|>
client_url = os.environ.get('SWIFT_X_ACCOUNT_SHARING_URL', None)
if not client_url:
logging.log(logging.ERR... | Share and publish Openstack Swift containers. | Publish | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Publish:
"""Share and publish Openstack Swift containers."""
def _get_address():
"""Discover the address for the object storage."""
<|body_0|>
async def _push_share(self, container, recipient, rights):
"""Wrap the async share_new_access function."""
<|bod... | stack_v2_sparse_classes_10k_train_007085 | 3,766 | permissive | [
{
"docstring": "Discover the address for the object storage.",
"name": "_get_address",
"signature": "def _get_address()"
},
{
"docstring": "Wrap the async share_new_access function.",
"name": "_push_share",
"signature": "async def _push_share(self, container, recipient, rights)"
},
{... | 4 | stack_v2_sparse_classes_30k_train_003489 | Implement the Python class `Publish` described below.
Class description:
Share and publish Openstack Swift containers.
Method signatures and docstrings:
- def _get_address(): Discover the address for the object storage.
- async def _push_share(self, container, recipient, rights): Wrap the async share_new_access funct... | Implement the Python class `Publish` described below.
Class description:
Share and publish Openstack Swift containers.
Method signatures and docstrings:
- def _get_address(): Discover the address for the object storage.
- async def _push_share(self, container, recipient, rights): Wrap the async share_new_access funct... | 2d70bf112b9ea5df4622ea23cb70a17125434e83 | <|skeleton|>
class Publish:
"""Share and publish Openstack Swift containers."""
def _get_address():
"""Discover the address for the object storage."""
<|body_0|>
async def _push_share(self, container, recipient, rights):
"""Wrap the async share_new_access function."""
<|bod... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Publish:
"""Share and publish Openstack Swift containers."""
def _get_address():
"""Discover the address for the object storage."""
ret = subprocess.getoutput(['swift auth'])
ret = ret.split('\n')[0]
ret = ret.split('=')[1]
return ret
async def _push_share(sel... | the_stack_v2_python_sparse | bindings/python/publish.py | CSCfi/swift-browser-ui | train | 12 |
8a192c9046b7dd28fb09d8bf9684e215064c0fcf | [
"self._qubit0 = self._syntax_for_measure(qubit0)\nself._cbit0 = self._syntax_for_measure(cbit0)\nself._qubit1 = self._syntax_for_measure(qubit1)\nself._cbit1 = self._syntax_for_measure(cbit1)\ntype_str = 'Not Product' if negate else 'Product'\nqubit0 = list(self._qubit0) if isinstance(self._qubit0, Register) else s... | <|body_start_0|>
self._qubit0 = self._syntax_for_measure(qubit0)
self._cbit0 = self._syntax_for_measure(cbit0)
self._qubit1 = self._syntax_for_measure(qubit1)
self._cbit1 = self._syntax_for_measure(cbit1)
type_str = 'Not Product' if negate else 'Product'
qubit0 = list(sel... | A measurement instruction that additionally performs statistical tests on the measurement outcomes to assert whether the state is a product state or not. | AssertProduct | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssertProduct:
"""A measurement instruction that additionally performs statistical tests on the measurement outcomes to assert whether the state is a product state or not."""
def __init__(self, qubit0, cbit0, qubit1, cbit1, pcrit, negate):
"""Constructor for AssertProduct Args: qubit... | stack_v2_sparse_classes_10k_train_007086 | 5,447 | permissive | [
{
"docstring": "Constructor for AssertProduct Args: qubit0(QuantumRegister or list): quantum register cbit0(ClassicalRegister or list): classical register qubit1(QuantumRegister or list): quantum register cbit1(ClassicalRegister or list): classical register pcrit(float): the critical p-value negate(bool): True ... | 2 | stack_v2_sparse_classes_30k_train_002561 | Implement the Python class `AssertProduct` described below.
Class description:
A measurement instruction that additionally performs statistical tests on the measurement outcomes to assert whether the state is a product state or not.
Method signatures and docstrings:
- def __init__(self, qubit0, cbit0, qubit1, cbit1, ... | Implement the Python class `AssertProduct` described below.
Class description:
A measurement instruction that additionally performs statistical tests on the measurement outcomes to assert whether the state is a product state or not.
Method signatures and docstrings:
- def __init__(self, qubit0, cbit0, qubit1, cbit1, ... | 8ee4f02be2ad4d3be87cbd2368d0bd509411d3e3 | <|skeleton|>
class AssertProduct:
"""A measurement instruction that additionally performs statistical tests on the measurement outcomes to assert whether the state is a product state or not."""
def __init__(self, qubit0, cbit0, qubit1, cbit1, pcrit, negate):
"""Constructor for AssertProduct Args: qubit... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AssertProduct:
"""A measurement instruction that additionally performs statistical tests on the measurement outcomes to assert whether the state is a product state or not."""
def __init__(self, qubit0, cbit0, qubit1, cbit1, pcrit, negate):
"""Constructor for AssertProduct Args: qubit0(QuantumRegi... | the_stack_v2_python_sparse | qiskit/assertions/assertproduct.py | edasgupta/qiskit-terra | train | 3 |
fa786575b9c7c156ee9e2d03d4d477d0db8db939 | [
"book = get_object_or_404(models.Edition, id=book_id)\ndata = {'file_link_form': forms.FileLinkForm(), 'book': book}\nreturn TemplateResponse(request, 'book/file_links/file_link_page.html', data)",
"book = get_object_or_404(models.Book.objects.select_subclasses(), id=book_id)\nlink = get_object_or_404(models.File... | <|body_start_0|>
book = get_object_or_404(models.Edition, id=book_id)
data = {'file_link_form': forms.FileLinkForm(), 'book': book}
return TemplateResponse(request, 'book/file_links/file_link_page.html', data)
<|end_body_0|>
<|body_start_1|>
book = get_object_or_404(models.Book.objects.... | a book! this is the stuff | AddFileLink | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddFileLink:
"""a book! this is the stuff"""
def get(self, request, book_id):
"""Create link form"""
<|body_0|>
def post(self, request, book_id, link_id=None):
"""Add a link to a copy of the book you can read"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_10k_train_007087 | 3,716 | no_license | [
{
"docstring": "Create link form",
"name": "get",
"signature": "def get(self, request, book_id)"
},
{
"docstring": "Add a link to a copy of the book you can read",
"name": "post",
"signature": "def post(self, request, book_id, link_id=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005544 | Implement the Python class `AddFileLink` described below.
Class description:
a book! this is the stuff
Method signatures and docstrings:
- def get(self, request, book_id): Create link form
- def post(self, request, book_id, link_id=None): Add a link to a copy of the book you can read | Implement the Python class `AddFileLink` described below.
Class description:
a book! this is the stuff
Method signatures and docstrings:
- def get(self, request, book_id): Create link form
- def post(self, request, book_id, link_id=None): Add a link to a copy of the book you can read
<|skeleton|>
class AddFileLink:
... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class AddFileLink:
"""a book! this is the stuff"""
def get(self, request, book_id):
"""Create link form"""
<|body_0|>
def post(self, request, book_id, link_id=None):
"""Add a link to a copy of the book you can read"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AddFileLink:
"""a book! this is the stuff"""
def get(self, request, book_id):
"""Create link form"""
book = get_object_or_404(models.Edition, id=book_id)
data = {'file_link_form': forms.FileLinkForm(), 'book': book}
return TemplateResponse(request, 'book/file_links/file_li... | the_stack_v2_python_sparse | bookwyrm/views/books/links.py | bookwyrm-social/bookwyrm | train | 1,398 |
ee7b959f12a81d2d981a9ebf5c2fdb4cef154f76 | [
"super(InfoGAN_Discriminator, self).__init__()\nself.n_layer = n_layer\nself.n_conti = n_conti\nself.n_discrete = n_discrete\nself.num_category = num_category\nself.featmap_dim = featmap_dim\nconvs = []\nBNs = []\nfor layer in range(self.n_layer):\n if layer == self.n_layer - 1:\n n_conv_in = n_channel\n ... | <|body_start_0|>
super(InfoGAN_Discriminator, self).__init__()
self.n_layer = n_layer
self.n_conti = n_conti
self.n_discrete = n_discrete
self.num_category = num_category
self.featmap_dim = featmap_dim
convs = []
BNs = []
for layer in range(self.n_... | InfoGAN_Discriminator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoGAN_Discriminator:
def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1):
"""InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN."""
<|body_0|>
def forward(self, x... | stack_v2_sparse_classes_10k_train_007088 | 19,546 | no_license | [
{
"docstring": "InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN.",
"name": "__init__",
"signature": "def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1)"
},
{
"docstring": "Output th... | 2 | null | Implement the Python class `InfoGAN_Discriminator` described below.
Class description:
Implement the InfoGAN_Discriminator class.
Method signatures and docstrings:
- def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1): InfoGAN Discriminator, have additi... | Implement the Python class `InfoGAN_Discriminator` described below.
Class description:
Implement the InfoGAN_Discriminator class.
Method signatures and docstrings:
- def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1): InfoGAN Discriminator, have additi... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class InfoGAN_Discriminator:
def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1):
"""InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN."""
<|body_0|>
def forward(self, x... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InfoGAN_Discriminator:
def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1):
"""InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN."""
super(InfoGAN_Discriminator, self).__init__()
... | the_stack_v2_python_sparse | generated/test_AaronYALai_Generative_Adversarial_Networks_PyTorch.py | jansel/pytorch-jit-paritybench | train | 35 | |
fdc440a4b8096fecd15c0a7680fd1f4ae08bd924 | [
"if not root:\n return root\nif p == root or q == root:\n return root\nleft = self.lowestCommonAncestor(root.left, p, q)\nright = self.lowestCommonAncestor(root.right, p, q)\nif left and right:\n return root\nif not left and (not right):\n return None\nif not left:\n return right\nreturn left",
"if... | <|body_start_0|>
if not root:
return root
if p == root or q == root:
return root
left = self.lowestCommonAncestor(root.left, p, q)
right = self.lowestCommonAncestor(root.right, p, q)
if left and right:
return root
if not left and (not r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :没有利用二叉搜索树的性质"""
<|body_0|>
def lowestCommonAncestor2(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rt... | stack_v2_sparse_classes_10k_train_007089 | 2,274 | no_license | [
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :没有利用二叉搜索树的性质",
"name": "lowestCommonAncestor",
"signature": "def lowestCommonAncestor(self, root, p, q)"
},
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :二叉搜索树的... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :没有利用二叉搜索树的性质
- def lowestCommonAncestor2(self, root, p, q):... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :没有利用二叉搜索树的性质
- def lowestCommonAncestor2(self, root, p, q):... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :没有利用二叉搜索树的性质"""
<|body_0|>
def lowestCommonAncestor2(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rt... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode :没有利用二叉搜索树的性质"""
if not root:
return root
if p == root or q == root:
return root
left = self.lowestCommonAncestor(root.left... | the_stack_v2_python_sparse | out/production/leetcode/235.二叉搜索树的最近公共祖先.py | yangyuxiang1996/leetcode | train | 0 | |
f78c4063bc7b46c14aeed2b204ead3271a43c51a | [
"super(GameLR, self).__init__()\nself.queries, self.encrypt, self.key_len = (queries, encrypt, key_len)\nself.key = ''\nself.b = -1\nself.key_gen = key_gen",
"if self.key_gen is None:\n self.key = random_string(self.key_len)\nelse:\n self.key = self.key_gen()\nif b is None:\n b = random.randrange(0, 2, 1... | <|body_start_0|>
super(GameLR, self).__init__()
self.queries, self.encrypt, self.key_len = (queries, encrypt, key_len)
self.key = ''
self.b = -1
self.key_gen = key_gen
<|end_body_0|>
<|body_start_1|>
if self.key_gen is None:
self.key = random_string(self.key_... | This game is used as a base game for games that need to determine between a left and right encryption. It is useful to determine how well a scheme is hiding its data from the adversary. | GameLR | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameLR:
"""This game is used as a base game for games that need to determine between a left and right encryption. It is useful to determine how well a scheme is hiding its data from the adversary."""
def __init__(self, queries, encrypt, key_len, key_gen=None):
""":param encrypt: This... | stack_v2_sparse_classes_10k_train_007090 | 2,984 | no_license | [
{
"docstring": ":param encrypt: This must be a callable python function that takes two inputs, k and x where k is a key of length key_len and x is a message. :param key_len: Length of the key (in bytes) used in the function that will be tested with this game.",
"name": "__init__",
"signature": "def __in... | 4 | stack_v2_sparse_classes_30k_train_002380 | Implement the Python class `GameLR` described below.
Class description:
This game is used as a base game for games that need to determine between a left and right encryption. It is useful to determine how well a scheme is hiding its data from the adversary.
Method signatures and docstrings:
- def __init__(self, queri... | Implement the Python class `GameLR` described below.
Class description:
This game is used as a base game for games that need to determine between a left and right encryption. It is useful to determine how well a scheme is hiding its data from the adversary.
Method signatures and docstrings:
- def __init__(self, queri... | 9014f5a9bf7021bef9f5cc4aa5b16424ca83dee9 | <|skeleton|>
class GameLR:
"""This game is used as a base game for games that need to determine between a left and right encryption. It is useful to determine how well a scheme is hiding its data from the adversary."""
def __init__(self, queries, encrypt, key_len, key_gen=None):
""":param encrypt: This... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GameLR:
"""This game is used as a base game for games that need to determine between a left and right encryption. It is useful to determine how well a scheme is hiding its data from the adversary."""
def __init__(self, queries, encrypt, key_len, key_gen=None):
""":param encrypt: This must be a ca... | the_stack_v2_python_sparse | src/playcrypt/games/game_lr.py | UCSDCSE107/playcrypt | train | 2 |
943f5c3b00fe9584a6e9a24d7d44644ba8e0b603 | [
"self.d = defaultdict(list)\nfor i, word in enumerate(words):\n self.d[word] += (i,)",
"d = self.d\nindexes1, indexes2 = (d[word1], d[word2])\ni = j = 0\n_min = float('inf')\nwhile i < len(indexes1) and j < len(indexes2):\n _min = min(_min, abs(indexes1[i] - indexes2[j]))\n if indexes1[i] < indexes2[j]:\... | <|body_start_0|>
self.d = defaultdict(list)
for i, word in enumerate(words):
self.d[word] += (i,)
<|end_body_0|>
<|body_start_1|>
d = self.d
indexes1, indexes2 = (d[word1], d[word2])
i = j = 0
_min = float('inf')
while i < len(indexes1) and j < len(in... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
"""Adds a word into the data structure. :type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k_train_007091 | 1,039 | no_license | [
{
"docstring": "initialize your data structure here. :type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": "Adds a word into the data structure. :type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortes... | 2 | null | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): initialize your data structure here. :type words: List[str]
- def shortest(self, word1, word2): Adds a word into the data structure. :type word... | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): initialize your data structure here. :type words: List[str]
- def shortest(self, word1, word2): Adds a word into the data structure. :type word... | 036a29d681cc91f2317d454e04530d7375d55478 | <|skeleton|>
class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
"""Adds a word into the data structure. :type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
self.d = defaultdict(list)
for i, word in enumerate(words):
self.d[word] += (i,)
def shortest(self, word1, word2):
"""Adds a word into the data structure.... | the_stack_v2_python_sparse | leetcode/shortest_word_distance_ii_v2.py | myliu/python-algorithm | train | 0 | |
dea5b347ac137197c39d64d7f2b5ed5fd6881a45 | [
"self.token = random_number_token(length)\nself.valid_until = timezone.now() + timedelta(seconds=valid_secs)\nif commit:\n self.save()",
"_now = timezone.now()\nif self.token is not None and token == self.token and (_now < self.valid_until):\n self.token = None\n self.valid_until = _now\n self.save()\... | <|body_start_0|>
self.token = random_number_token(length)
self.valid_until = timezone.now() + timedelta(seconds=valid_secs)
if commit:
self.save()
<|end_body_0|>
<|body_start_1|>
_now = timezone.now()
if self.token is not None and token == self.token and (_now < self... | Abstract base model for a side-channel :term:`device` attached to a user. This model implements token generation, verification and expiration, so the concrete devices only have to implement delivery. | SideChannelDevice | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SideChannelDevice:
"""Abstract base model for a side-channel :term:`device` attached to a user. This model implements token generation, verification and expiration, so the concrete devices only have to implement delivery."""
def generate_token(self, length=6, valid_secs=300, commit=True):
... | stack_v2_sparse_classes_10k_train_007092 | 13,172 | permissive | [
{
"docstring": "Generates a token of the specified length, then sets it on the model and sets the expiration of the token on the model. Pass 'commit=False' to avoid calling self.save(). :param int length: Number of decimal digits in the generated token. :param int valid_secs: Amount of seconds the token should ... | 2 | stack_v2_sparse_classes_30k_train_000323 | Implement the Python class `SideChannelDevice` described below.
Class description:
Abstract base model for a side-channel :term:`device` attached to a user. This model implements token generation, verification and expiration, so the concrete devices only have to implement delivery.
Method signatures and docstrings:
-... | Implement the Python class `SideChannelDevice` described below.
Class description:
Abstract base model for a side-channel :term:`device` attached to a user. This model implements token generation, verification and expiration, so the concrete devices only have to implement delivery.
Method signatures and docstrings:
-... | d65a039582509a08c56c35f905380fe3ff8507cb | <|skeleton|>
class SideChannelDevice:
"""Abstract base model for a side-channel :term:`device` attached to a user. This model implements token generation, verification and expiration, so the concrete devices only have to implement delivery."""
def generate_token(self, length=6, valid_secs=300, commit=True):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SideChannelDevice:
"""Abstract base model for a side-channel :term:`device` attached to a user. This model implements token generation, verification and expiration, so the concrete devices only have to implement delivery."""
def generate_token(self, length=6, valid_secs=300, commit=True):
"""Gene... | the_stack_v2_python_sparse | src/django_otp/models.py | django-otp/django-otp | train | 460 |
197829184cb24021170fa3b05836ea0ef845c0dc | [
"self.name = name\nself.parent = None\nself.pb_types = {}",
"for child in self.pb_types.values():\n for i in range(child.num_pb):\n yield (child, i)",
"assert elem.tag in ['mode', 'pb_type'], elem.tag\nif elem.tag == 'pb_type':\n name = 'default'\nelse:\n name = elem.attrib['name']\nmode = Mode(... | <|body_start_0|>
self.name = name
self.parent = None
self.pb_types = {}
<|end_body_0|>
<|body_start_1|>
for child in self.pb_types.values():
for i in range(child.num_pb):
yield (child, i)
<|end_body_1|>
<|body_start_2|>
assert elem.tag in ['mode', 'p... | A mode of a pb_type | Mode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mode:
"""A mode of a pb_type"""
def __init__(self, name):
"""Basic constructor"""
<|body_0|>
def yield_children(self):
"""Yields all child pb_types and their indices taking into account num_pb."""
<|body_1|>
def from_etree(elem):
"""Create th... | stack_v2_sparse_classes_10k_train_007093 | 11,880 | permissive | [
{
"docstring": "Basic constructor",
"name": "__init__",
"signature": "def __init__(self, name)"
},
{
"docstring": "Yields all child pb_types and their indices taking into account num_pb.",
"name": "yield_children",
"signature": "def yield_children(self)"
},
{
"docstring": "Create... | 3 | stack_v2_sparse_classes_30k_train_001431 | Implement the Python class `Mode` described below.
Class description:
A mode of a pb_type
Method signatures and docstrings:
- def __init__(self, name): Basic constructor
- def yield_children(self): Yields all child pb_types and their indices taking into account num_pb.
- def from_etree(elem): Create the object from i... | Implement the Python class `Mode` described below.
Class description:
A mode of a pb_type
Method signatures and docstrings:
- def __init__(self, name): Basic constructor
- def yield_children(self): Yields all child pb_types and their indices taking into account num_pb.
- def from_etree(elem): Create the object from i... | 835a40534f9efd70770d74f56f25fef6cfc6ebc6 | <|skeleton|>
class Mode:
"""A mode of a pb_type"""
def __init__(self, name):
"""Basic constructor"""
<|body_0|>
def yield_children(self):
"""Yields all child pb_types and their indices taking into account num_pb."""
<|body_1|>
def from_etree(elem):
"""Create th... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Mode:
"""A mode of a pb_type"""
def __init__(self, name):
"""Basic constructor"""
self.name = name
self.parent = None
self.pb_types = {}
def yield_children(self):
"""Yields all child pb_types and their indices taking into account num_pb."""
for child i... | the_stack_v2_python_sparse | f4pga/utils/quicklogic/repacker/pb_type.py | f4pga/f4pga | train | 19 |
b4c9e801b142ee0efa5887ebe2015a3098fa8947 | [
"logging.info('Received a message from: ' + mail_message.sender)\nlogging.info(self.getBody(mail_message))\nself.sendEmailByTask(mail_message)",
"html_bodies = mail_message.bodies('text/html')\nfor content_type, body in html_bodies:\n decoded_html = body.decode()\n return decoded_html",
"subject = 'Messag... | <|body_start_0|>
logging.info('Received a message from: ' + mail_message.sender)
logging.info(self.getBody(mail_message))
self.sendEmailByTask(mail_message)
<|end_body_0|>
<|body_start_1|>
html_bodies = mail_message.bodies('text/html')
for content_type, body in html_bodies:
... | General class to recived messages. by now, it just records them in the log | LogSenderHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogSenderHandler:
"""General class to recived messages. by now, it just records them in the log"""
def receive(self, mail_message):
"""receives an email and log it"""
<|body_0|>
def getBody(self, mail_message):
"""Return the html body of a message."""
<|b... | stack_v2_sparse_classes_10k_train_007094 | 2,562 | no_license | [
{
"docstring": "receives an email and log it",
"name": "receive",
"signature": "def receive(self, mail_message)"
},
{
"docstring": "Return the html body of a message.",
"name": "getBody",
"signature": "def getBody(self, mail_message)"
},
{
"docstring": "Uses the message received ... | 3 | stack_v2_sparse_classes_30k_train_006661 | Implement the Python class `LogSenderHandler` described below.
Class description:
General class to recived messages. by now, it just records them in the log
Method signatures and docstrings:
- def receive(self, mail_message): receives an email and log it
- def getBody(self, mail_message): Return the html body of a me... | Implement the Python class `LogSenderHandler` described below.
Class description:
General class to recived messages. by now, it just records them in the log
Method signatures and docstrings:
- def receive(self, mail_message): receives an email and log it
- def getBody(self, mail_message): Return the html body of a me... | 088db8f6cc85ad0430b5d7d501bc4a4c34fad24b | <|skeleton|>
class LogSenderHandler:
"""General class to recived messages. by now, it just records them in the log"""
def receive(self, mail_message):
"""receives an email and log it"""
<|body_0|>
def getBody(self, mail_message):
"""Return the html body of a message."""
<|b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LogSenderHandler:
"""General class to recived messages. by now, it just records them in the log"""
def receive(self, mail_message):
"""receives an email and log it"""
logging.info('Received a message from: ' + mail_message.sender)
logging.info(self.getBody(mail_message))
s... | the_stack_v2_python_sparse | handlers/email_incoming.py | wakaru44/capitulizer | train | 0 |
1cd13fd81d7ee1ac2eafc5ab84bf218b3d90870c | [
"QtGui.QDialog.__init__(self, parent)\nself.data = data_for_plotting\nself.graph_name = bar_chart_name\nself.ordinate_name = ordinate_name\nself.figure = plt.figure()\nself.canvas = FigureCanvas(self.figure)\nself.toolbar = NavigationToolbar(self.canvas, self)\nlayout = QtGui.QVBoxLayout()\nlayout.addWidget(self.to... | <|body_start_0|>
QtGui.QDialog.__init__(self, parent)
self.data = data_for_plotting
self.graph_name = bar_chart_name
self.ordinate_name = ordinate_name
self.figure = plt.figure()
self.canvas = FigureCanvas(self.figure)
self.toolbar = NavigationToolbar(self.canvas,... | Implements mechanism for plotting of a bar chart for given data. | BarChart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BarChart:
"""Implements mechanism for plotting of a bar chart for given data."""
def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None):
"""Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It i... | stack_v2_sparse_classes_10k_train_007095 | 2,458 | no_license | [
{
"docstring": "Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It is a ordinate name of a bar chart. data_for_plotting (list): It is a data for plotting of a bar chart.",
"name": "__init__",
"signature": "def __init__(self, bar_chart_name... | 2 | stack_v2_sparse_classes_30k_train_000817 | Implement the Python class `BarChart` described below.
Class description:
Implements mechanism for plotting of a bar chart for given data.
Method signatures and docstrings:
- def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): Make a instance of BarChart class. Args: bar_chart_name (str... | Implement the Python class `BarChart` described below.
Class description:
Implements mechanism for plotting of a bar chart for given data.
Method signatures and docstrings:
- def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None): Make a instance of BarChart class. Args: bar_chart_name (str... | 44d4b2977ee40564629e379f954dd54c68fa2c1a | <|skeleton|>
class BarChart:
"""Implements mechanism for plotting of a bar chart for given data."""
def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None):
"""Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BarChart:
"""Implements mechanism for plotting of a bar chart for given data."""
def __init__(self, bar_chart_name, ordinate_name, data_for_plotting, parent=None):
"""Make a instance of BarChart class. Args: bar_chart_name (str): It is a name of a bar chart. ordinate_name (str): It is a ordinate ... | the_stack_v2_python_sparse | gui/BarChart.py | andrei-volkau/ground_station | train | 2 |
27fe09b7cb917c800936f92418e336a711280fa4 | [
"if not is_all(eids):\n gidx = gidx.edge_subgraph([eids], True).graph\nif norm_by == 'src':\n gidx = gidx.reverse()\nif score.is_cuda:\n score_max = _gspmm(gidx, 'copy_rhs', 'max', None, score)[0]\n score = th.exp(_gsddmm(gidx, 'sub', score, score_max, 'e', 'v'))\n score_sum = _gspmm(gidx, 'copy_rhs'... | <|body_start_0|>
if not is_all(eids):
gidx = gidx.edge_subgraph([eids], True).graph
if norm_by == 'src':
gidx = gidx.reverse()
if score.is_cuda:
score_max = _gspmm(gidx, 'copy_rhs', 'max', None, score)[0]
score = th.exp(_gsddmm(gidx, 'sub', score, ... | EdgeSoftmax | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EdgeSoftmax:
def forward(ctx, gidx, score, eids, norm_by):
"""Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type dgl.NDat... | stack_v2_sparse_classes_10k_train_007096 | 40,333 | permissive | [
{
"docstring": "Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type dgl.NData out = score / score_sum # edge_div_dst, ret dgl.EData return out.dat... | 2 | null | Implement the Python class `EdgeSoftmax` described below.
Class description:
Implement the EdgeSoftmax class.
Method signatures and docstrings:
- def forward(ctx, gidx, score, eids, norm_by): Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData sc... | Implement the Python class `EdgeSoftmax` described below.
Class description:
Implement the EdgeSoftmax class.
Method signatures and docstrings:
- def forward(ctx, gidx, score, eids, norm_by): Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData sc... | bbc8ff6261f2e0d2b5982e992b6fbe545e2a4aa1 | <|skeleton|>
class EdgeSoftmax:
def forward(ctx, gidx, score, eids, norm_by):
"""Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type dgl.NDat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EdgeSoftmax:
def forward(ctx, gidx, score, eids, norm_by):
"""Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type dgl.NData out = score ... | the_stack_v2_python_sparse | python/dgl/backend/pytorch/sparse.py | dmlc/dgl | train | 12,631 | |
8b0771d35a27548c0670094a510e88aed8c36ac2 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IntuneBrand()",
"from .mime_content import MimeContent\nfrom .rgb_color import RgbColor\nfrom .mime_content import MimeContent\nfrom .rgb_color import RgbColor\nfields: Dict[str, Callable[[Any], None]] = {'contactITEmailAddress': lambd... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return IntuneBrand()
<|end_body_0|>
<|body_start_1|>
from .mime_content import MimeContent
from .rgb_color import RgbColor
from .mime_content import MimeContent
from .rgb_color ... | intuneBrand contains data which is used in customizing the appearance of the Company Portal applications as well as the end user web portal. | IntuneBrand | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntuneBrand:
"""intuneBrand contains data which is used in customizing the appearance of the Company Portal applications as well as the end user web portal."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntuneBrand:
"""Creates a new instance of the a... | stack_v2_sparse_classes_10k_train_007097 | 7,014 | 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: IntuneBrand",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(p... | 3 | null | Implement the Python class `IntuneBrand` described below.
Class description:
intuneBrand contains data which is used in customizing the appearance of the Company Portal applications as well as the end user web portal.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNo... | Implement the Python class `IntuneBrand` described below.
Class description:
intuneBrand contains data which is used in customizing the appearance of the Company Portal applications as well as the end user web portal.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNo... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class IntuneBrand:
"""intuneBrand contains data which is used in customizing the appearance of the Company Portal applications as well as the end user web portal."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntuneBrand:
"""Creates a new instance of the a... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IntuneBrand:
"""intuneBrand contains data which is used in customizing the appearance of the Company Portal applications as well as the end user web portal."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntuneBrand:
"""Creates a new instance of the appropriate cl... | the_stack_v2_python_sparse | msgraph/generated/models/intune_brand.py | microsoftgraph/msgraph-sdk-python | train | 135 |
1aa546bfbee14f271b80a1ae5b130d8b41aa38a7 | [
"InputFinder.__init__(self, **kwargs)\nself.input_finder_class = input_finder_class\nself.input_finder_params = input_finder_params",
"if not isinstance(self.input_finder_class, list):\n self.input_finder_class = [self.input_finder_class]\nif not isinstance(self.input_finder_params, list):\n self.input_find... | <|body_start_0|>
InputFinder.__init__(self, **kwargs)
self.input_finder_class = input_finder_class
self.input_finder_params = input_finder_params
<|end_body_0|>
<|body_start_1|>
if not isinstance(self.input_finder_class, list):
self.input_finder_class = [self.input_finder_cl... | Pipeline Input Finder It execute in sequence a list of input finder heuristics where the result of previous heuristic is passed as an input to the next heuristic Attributes: input_finder_class (Union[class, list]): list of input finder classes input_finder_params (Union[dict, list]): list of initialization parameters f... | PipelineInputFinder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PipelineInputFinder:
"""Pipeline Input Finder It execute in sequence a list of input finder heuristics where the result of previous heuristic is passed as an input to the next heuristic Attributes: input_finder_class (Union[class, list]): list of input finder classes input_finder_params (Union[di... | stack_v2_sparse_classes_10k_train_007098 | 2,264 | no_license | [
{
"docstring": "Initialization",
"name": "__init__",
"signature": "def __init__(self, input_finder_class, input_finder_params=None, **kwargs)"
},
{
"docstring": "Execute the heuristic Returns: list(GAIndividual): list of encoded control inputs",
"name": "solve",
"signature": "def solve(s... | 2 | stack_v2_sparse_classes_30k_val_000263 | Implement the Python class `PipelineInputFinder` described below.
Class description:
Pipeline Input Finder It execute in sequence a list of input finder heuristics where the result of previous heuristic is passed as an input to the next heuristic Attributes: input_finder_class (Union[class, list]): list of input finde... | Implement the Python class `PipelineInputFinder` described below.
Class description:
Pipeline Input Finder It execute in sequence a list of input finder heuristics where the result of previous heuristic is passed as an input to the next heuristic Attributes: input_finder_class (Union[class, list]): list of input finde... | ce7045918f60c92ce1ed5ca4389b969bf28e6b82 | <|skeleton|>
class PipelineInputFinder:
"""Pipeline Input Finder It execute in sequence a list of input finder heuristics where the result of previous heuristic is passed as an input to the next heuristic Attributes: input_finder_class (Union[class, list]): list of input finder classes input_finder_params (Union[di... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PipelineInputFinder:
"""Pipeline Input Finder It execute in sequence a list of input finder heuristics where the result of previous heuristic is passed as an input to the next heuristic Attributes: input_finder_class (Union[class, list]): list of input finder classes input_finder_params (Union[dict, list]): l... | the_stack_v2_python_sparse | sp/system_controller/optimizer/llc/input_finder/pipeline.py | adysonmaia/phd-sp-dynamic | train | 0 |
d3190b2172dbb8b8071bf720cd25e81b48e2ef57 | [
"self.loggit = logging.getLogger('curator.validators.SchemaCheck')\nself.loggit.debug('Schema: %s', schema)\nself.loggit.debug('\"%s\" config: %s', test_what, config)\nself.config = config\nself.schema = schema\nself.test_what = test_what\nself.location = location\nself.badvalue = None\nself.error = None",
"def g... | <|body_start_0|>
self.loggit = logging.getLogger('curator.validators.SchemaCheck')
self.loggit.debug('Schema: %s', schema)
self.loggit.debug('"%s" config: %s', test_what, config)
self.config = config
self.schema = schema
self.test_what = test_what
self.location = ... | SchemaCheck | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchemaCheck:
def __init__(self, config, schema, test_what, location):
"""Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :p... | stack_v2_sparse_classes_10k_train_007099 | 3,571 | permissive | [
{
"docstring": "Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :py:meth:`result` returns ``config`` a valid :py:class:`~.voluptuous.schema_builder... | 3 | stack_v2_sparse_classes_30k_train_002425 | Implement the Python class `SchemaCheck` described below.
Class description:
Implement the SchemaCheck class.
Method signatures and docstrings:
- def __init__(self, config, schema, test_what, location): Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what``... | Implement the Python class `SchemaCheck` described below.
Class description:
Implement the SchemaCheck class.
Method signatures and docstrings:
- def __init__(self, config, schema, test_what, location): Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what``... | b41743a061ad790820affe7acee5f71abe819357 | <|skeleton|>
class SchemaCheck:
def __init__(self, config, schema, test_what, location):
"""Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SchemaCheck:
def __init__(self, config, schema, test_what, location):
"""Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :py:meth:`result... | the_stack_v2_python_sparse | curator/validators/schemacheck.py | volatilemolotov/curator | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.