name
stringclasses
844 values
input_types
listlengths
0
100
output_type
stringlengths
1
419
code
stringlengths
34
233k
dependencies
listlengths
0
6
lib_used
listlengths
0
11
imports
listlengths
0
66
line_count
int64
3
199
full_code
stringlengths
39
1.01M
input_type_defs
listlengths
1
12
v0
[]
None
def v0(self) -> None: self._create_models_for_number_manually_tests() v1 = self.request('motion.create', {'title': 'test_Xcdfgee', 'meeting_id': 222, 'workflow_id': 12, 'text': 'test'}) self.assert_status_code(v1, 200) v2 = self.request('motion.create', {'title': 'test_Xcdfgee', 'meeting_id': 222, 'work...
[]
[]
[]
12
from tests.system.action.base import BaseActionTestCase class MotionSetNumberMixinTest(BaseActionTestCase): def test_create_set_number_return_because_number_preset(self) -> None: self.set_models( { "meeting/222": { "name": "name_SNLGsvIV", ...
null
v0
[]
None
def v0(self) -> None: self._create_models_for_number_per_category_1() v1 = self.request('motion.create', {'title': 'test_Xcdfgee', 'meeting_id': 222, 'workflow_id': 12, 'category_id': 7, 'text': 'test'}) self.assert_status_code(v1, 200) v2 = self.get_model('motion/1') assert v2.get('number') == 'A00...
[]
[]
[]
32
from tests.system.action.base import BaseActionTestCase class MotionSetNumberMixinTest(BaseActionTestCase): def test_create_set_number_return_because_number_preset(self) -> None: self.set_models( { "meeting/222": { "name": "name_SNLGsvIV", ...
null
v0
[]
None
def v0(self) -> None: self._create_models_for_number_per_category_1() v1 = self.request('motion.create', {'title': 'test_Xcdfgee', 'meeting_id': 222, 'workflow_id': 12, 'text': 'test'}) self.assert_status_code(v1, 200) v2 = self.get_model('motion/1') assert v2.get('number') == '001' assert v2.ge...
[]
[]
[]
13
from tests.system.action.base import BaseActionTestCase class MotionSetNumberMixinTest(BaseActionTestCase): def test_create_set_number_return_because_number_preset(self) -> None: self.set_models( { "meeting/222": { "name": "name_SNLGsvIV", ...
null
v0
[]
None
def v0(self) -> None: self._create_models_for_number_per_category_2() v1 = self.request('motion.create', {'title': 'test_Xcdfgee', 'meeting_id': 222, 'workflow_id': 12, 'text': 'test', 'category_id': 7}) self.assert_status_code(v1, 200) v2 = self.get_model('motion/1') assert v2.get('number') == 'A 0...
[]
[]
[]
18
from tests.system.action.base import BaseActionTestCase class MotionSetNumberMixinTest(BaseActionTestCase): def test_create_set_number_return_because_number_preset(self) -> None: self.set_models( { "meeting/222": { "name": "name_SNLGsvIV", ...
null
v0
[]
None
def v0(self) -> None: self.set_models({'meeting/222': {'name': 'name_SNLGsvIV'}, 'user/1': {'meeting_ids': [222]}, 'motion_category/7': {'name': 'A', 'prefix': 'A', 'meeting_id': 222}, 'motion_state/76': {'name': 'test0', 'motion_ids': [], 'next_state_ids': [77], 'previous_state_ids': [], 'show_state_extension_fiel...
[]
[]
[]
8
from tests.system.action.base import BaseActionTestCase class MotionSetNumberMixinTest(BaseActionTestCase): def test_create_set_number_return_because_number_preset(self) -> None: self.set_models( { "meeting/222": { "name": "name_SNLGsvIV", ...
null
v0
[ "Any" ]
Optional[List[int]]
def v0(self, v1=True) -> Optional[List[int]]: v2 = self.hanabi_env.reset() self._reset_agents(player_number=v2['current_player']) self.rewards = {agent: 0 for v3 in self.agents} self._process_latest_observations(obs=v2) if v1: return self.observe(agent_name=self.agent_selection) else: ...
[]
[]
[]
9
from typing import Optional, Dict, List, Union import numpy as np from gym import spaces from pettingzoo import AECEnv from pettingzoo.utils import agent_selector, wrappers from gym.utils import seeding, EzPickle """ Wrapper class around google deepmind's hanabi. """ def env(**kwargs): env = raw_env(**kwargs) ...
null
v0
[ "int", "bool", "bool" ]
Optional[Union[np.ndarray, List[List[dict]]]]
def v0(self, v1: int, v2: bool=True, v3: bool=True) -> Optional[Union[np.ndarray, List[List[dict]]]]: v1 = int(v1) v4 = self.agent_selection if v1 not in self.legal_moves: raise ValueError('Illegal action. Please choose between legal actions, as documented in dict self.infos') else: self...
[]
[]
[]
12
from typing import Optional, Dict, List, Union import numpy as np from gym import spaces from pettingzoo import AECEnv from pettingzoo.utils import agent_selector, wrappers from gym.utils import seeding, EzPickle """ Wrapper class around google deepmind's hanabi. """ def env(**kwargs): env = raw_env(**kwargs) ...
null
v0
[ "Dict", "Optional[float]", "Optional[bool]" ]
Any
def v0(self, v1: Dict, v2: Optional[float]=0, v3: Optional[bool]=False): self.latest_observations = v1 for (v4, v5) in self.rewards.items(): self.rewards[v4] = v2 + v5 self.dones = {player_name: v3 for v6 in self.agents} self.infos = {v6: dict(legal_moves=self.latest_observations['player_observa...
[]
[]
[]
6
from typing import Optional, Dict, List, Union import numpy as np from gym import spaces from pettingzoo import AECEnv from pettingzoo.utils import agent_selector, wrappers from gym.utils import seeding, EzPickle """ Wrapper class around google deepmind's hanabi. """ def env(**kwargs): env = raw_env(**kwargs) ...
null
v26
[ "Any", "Any", "Any", "Any" ]
str
def v26(v27, v28, v29, v30) -> str: v31 = v0(v27, v30) v32 = v27.name.split('.')[0] v33 = os.path.join(v31, v32 + '.build') v34 = os.path.join(v33, v29) v35 = os.path.join(v34, v28 + '.build') return v35
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "str", "code": "def v0(v1, v2) -> str:\n v3 = ''\n v4 = ResolveDerivedDataPath(v1)\n v5 = CoreFoundation.CFPreferencesCopyAppValue('IDEBuildLocationStyle', 'com.apple.dt.Xcode')\n for v6 in Switch(v5):\n ...
[ "hashlib", "os" ]
[ "import os", "import hashlib" ]
7
# Copyright (c) 2016, Samantha Marshall (http://pewpewthespells.com) # All rights reserved. # # https://github.com/samdmarshall/pylocalizer # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of sourc...
null
v26
[ "Any", "Any" ]
str
def v26(v27, v28) -> str: v29 = v0(v27, v28) return v29
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "str", "code": "def v0(v1, v2) -> str:\n v3 = ''\n v4 = ResolveDerivedDataPath(v1)\n v5 = CoreFoundation.CFPreferencesCopyAppValue('IDEBuildLocationStyle', 'com.apple.dt.Xcode')\n for v6 in Switch(v5):\n ...
[ "hashlib", "os" ]
[ "import os", "import hashlib" ]
3
# Copyright (c) 2016, Samantha Marshall (http://pewpewthespells.com) # All rights reserved. # # https://github.com/samdmarshall/pylocalizer # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of sourc...
null
v0
[ "behavior.Behavior", "str", "bool", "Union[int, Callable[[], int]]" ]
Any
def v0(self, v1: behavior.Behavior, v2: str, v3: bool=True, v4: Union[int, Callable[[], int]]=100): if self.has_subbehaviors(): raise AssertionError('Attempt to add more than one subbehavior to SingleRobotCompositeBehavior') super().add_subbehavior(v1, v2, v3, v4) self.robot_shell_id = None
[]
[]
[]
5
import single_robot_behavior import composite_behavior import role_assignment import logging import behavior from typing import Callable, Union ## Behavior that applies to a single ROBOT and may have up to one subbehavior at any time # Most of the implementation is just checking if we have subbehaviors and calling th...
null
v0
[ "str", "int" ]
Any
def v0(self, v1: str, v2: int): v2 = datetime.fromtimestamp(v2) v3 = v2.strftime('%Y%m%d') v4 = v2.strftime('%Y%m%d%H%M') v5 = './metrics/' + self.prometheus_host + '/' + v1 + '/' + v3 + '/' + v4 + '.json' return v5
[]
[ "datetime" ]
[ "from datetime import datetime, timedelta" ]
6
"""A Class for collection of metrics from a Prometheus Host.""" from urllib.parse import urlparse import bz2 import os import sys import json import logging import numpy from datetime import datetime, timedelta import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Re...
null
v0
[ "int" ]
bool
def v0(self, v1: int) -> bool: v2 = 1 while v2 * v2 < v1: v3 = v2 * v2 if v3 == v1: return True v2 += 1 return False if v1 < 2: return True (v4, v5) = (2, v1 // 2) while v4 <= v5: v6 = v4 + (v5 - v4) // 2 v7 = v6 * v6 if v7 == v...
[]
[]
[]
21
# Given a positive integer num, # write a function which returns True if num is a perfect square else False. # Note: Do not use any built-in library function such as sqrt. # Example 1: # Input: 16 # Output: true # Example 2: # Input: 14 # Output: false class Solution: def isPerfectSquare(self, num: int) -> boo...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = v1.split('_') return v2[0].lower() + ''.join((part.capitalize() for v3 in v2[1:]))
[]
[]
[]
3
from pydantic import BaseModel as _BaseModel, Extra def camelcase(name: str) -> str: name_parts = name.split('_') return name_parts[0].lower() + ''.join(part.capitalize() for part in name_parts[1:]) class BaseModel(_BaseModel): class Config: allow_population_by_field_name = True alias_g...
null
v0
[ "List[torch.Tensor]", "List[torch.Tensor]", "List[torch.Tensor]" ]
Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]
def v0(self, v1: List[torch.Tensor], v2: List[torch.Tensor], v3: List[torch.Tensor]) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: v4 = 0 assert len(v1) > 0 assert len(v1) == len(v2) assert len(v1) == len(v3) assert len(v1) == len(self.include_last_offsets) for v5 in range(len(se...
[]
[ "torch" ]
[ "import torch" ]
39
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # pyre-unsafe import unittest from typing import List, Optional, Tuple import torch tr...
null
v20
[ "torch.Tensor", "float", "Optional[torch.Tensor]", "bool", "int", "str" ]
torch.Tensor
def v20(v21: torch.Tensor, v22: float, v23: Optional[torch.Tensor]=None, v24: bool=False, v25: int=32, v26: str='source_to_target') -> torch.Tensor: assert v26 in ['source_to_target', 'target_to_source'] (v27, v28) = v0(v21, v21, v22, v23, v23, v25 if v24 else v25 + 1) (v27, v28) = (v28, v27) if v26 == 'sou...
[ { "name": "v0", "input_types": [ "torch.Tensor", "torch.Tensor", "float", "Optional[torch.Tensor]", "Optional[torch.Tensor]", "int" ], "output_type": "torch.Tensor", "code": "def v0(v1: torch.Tensor, v2: torch.Tensor, v3: float, v4: Optional[torch.Tensor]=None...
[ "torch" ]
[ "import torch" ]
8
from typing import Optional import torch import scipy.spatial @torch.jit.script def sample(col: torch.Tensor, count: int) -> torch.Tensor: if col.size(0) > count: col = col[torch.randperm(col.size(0), dtype=torch.long)][:count] return col def radius(x: torch.Tensor, y: torch.Tensor, r: float, ...
null
v0
[ "hsim.SceneNode", "float", "int" ]
Any
def v0(v1: hsim.SceneNode, v2: float, v3: int): v4 = v1.absolute_transformation()[0:3, v3] v1.translate_local(v4 * v2)
[]
[]
[]
3
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .controls import register_move_fn, ActuationSpec from habitat_sim import utils import habitat_sim.bindings as hsim ...
null
v0
[ "hsim.SceneNode", "float", "int" ]
Any
def v0(v1: hsim.SceneNode, v2: float, v3: int): v4 = np.zeros(3, dtype=np.float32) v4[v3] = 1 v1.rotate_local(np.deg2rad(v2), v4) v1.normalize()
[]
[ "numpy" ]
[ "import numpy as np" ]
5
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .controls import register_move_fn, ActuationSpec from habitat_sim import utils import habitat_sim.bindings as hsim ...
null
v0
[ "ast.Expression" ]
ast.Expression
def v0(self, v1: ast.Expression) -> ast.Expression: v2 = copy.deepcopy(v1) v2.body = self.visit(v2.body) return v2
[]
[ "copy" ]
[ "import copy" ]
4
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v0
[ "ast.UnaryOp" ]
Union[ast.UnaryOp, ast.Constant]
def v0(self, v1: ast.UnaryOp) -> Union[ast.UnaryOp, ast.Constant]: v1.operand = self.visit(v1.operand) if isinstance(v1.operand, (ast.Constant, ast.Num)): v2 = ast.Constant(n=self._match_ops(v1.op, self._unary_ops, v1.operand.n)) return ast.copy_location(v2, v1) return v1
[]
[ "ast" ]
[ "import ast" ]
6
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v0
[ "ast.BinOp" ]
Union[ast.BinOp, ast.Constant]
def v0(self, v1: ast.BinOp) -> Union[ast.BinOp, ast.Constant]: v1.left = self.visit(v1.left) v1.right = self.visit(v1.right) if isinstance(v1.left, (ast.Constant, ast.Num)) and isinstance(v1.right, (ast.Constant, ast.Num)): v2 = ast.Constant(n=self._match_ops(v1.op, self._binary_ops, v1.left.n, v1.r...
[]
[ "ast" ]
[ "import ast" ]
7
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v0
[ "ast.Call" ]
Union[ast.Call, ast.Constant]
def v0(self, v1: ast.Call) -> Union[ast.Call, ast.Constant]: if not isinstance(v1.func, ast.Name): raise PulseError('Unsafe expression is detected.') v1.args = [self.visit(arg) for v2 in v1.args] if all((isinstance(v2, (ast.Constant, ast.Num)) for v2 in v1.args)): if v1.func.id not in self._...
[]
[ "ast", "qiskit" ]
[ "import ast", "from qiskit.pulse.exceptions import PulseError", "from qiskit.circuit import ParameterExpression" ]
14
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v0
[ "np.ndarray", "np.ndarray" ]
NoReturn
def v0(self, v1: np.ndarray, v2: np.ndarray) -> NoReturn: self.D_ = np.ones(len(v1)) / len(v1) self.weights_ = [] self.models_ = [] for v3 in range(self.iterations_): print(v3) v4 = self.wl_() v4.fit(v1, v2 * self.D_) v5 = v4.predict(v1) v6 = np.sum(self.D_ * (v2 ...
[]
[ "numpy" ]
[ "import numpy as np" ]
15
import numpy as np from ..base import BaseEstimator from typing import Callable, NoReturn from IMLearn import metrics class AdaBoost(BaseEstimator): """ AdaBoost class for boosting a specified weak learner Attributes ---------- self.wl_: Callable[[], BaseEstimator] Callable for obtaining ...
null
v0
[ "np.ndarray", "int" ]
np.ndarray
def v0(self, v1: np.ndarray, v2: int) -> np.ndarray: if v2 <= self.iterations_: v3 = v2 else: v3 = self.iterations_ v4 = np.zeros(v1.shape[0]) for v5 in range(v3): v4 += self.models_[v5].predict(v1) * self.weights_[v5] return np.sign(v4)
[]
[ "numpy" ]
[ "import numpy as np" ]
9
import numpy as np from ..base import BaseEstimator from typing import Callable, NoReturn from IMLearn import metrics class AdaBoost(BaseEstimator): """ AdaBoost class for boosting a specified weak learner Attributes ---------- self.wl_: Callable[[], BaseEstimator] Callable for obtaining ...
null
v8
[ "str", "int", "Optional[str]" ]
None
def v8(v9: str, v10: int, v11: Optional[str]=None) -> None: if not v11: v11 = v9.lower() if hasattr(logging, v9): raise AttributeError('{} already defined in logging module'.format(v9)) if hasattr(logging, v11): raise AttributeError('{} already defined in logging module'.format(v11))...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(self, v1, *v2, **v3):\n if self.isEnabledFor(levelNum):\n self._log(levelNum, v1, v2, **v3)", "dependencies": [] }, { "name": "v4", "input_types": [ "Any" ], "output_type...
[ "logging" ]
[ "import logging" ]
20
"""Main module.""" import asyncio from datetime import datetime, timedelta, timezone import logging import pathlib import shutil import json from asyncio.exceptions import TimeoutError from typing import Callable, List, Optional import aiocron from aiohttp.client_exceptions import ClientPayloadError from pyunifiprotec...
null
v0
[ "logging.StreamHandler", "logging.FileHandler" ]
None
def v0(v1: logging.StreamHandler, v2: logging.FileHandler) -> None: logging.root.setLevel(logging.DEBUG) for v3 in logging.root.handlers[:]: logging.root.removeHandler(v3) v3.close() logging.root.addHandler(v1) logging.root.addHandler(v2)
[]
[ "logging" ]
[ "import logging", "from logging.handlers import QueueHandler, QueueListener" ]
7
import sys import coloredlogs import os import queue import logging from logging.handlers import QueueHandler, QueueListener from threading import currentThread, Lock ARTIFACTS_PATH = os.environ.get('CIRCLE_ARTIFACTS', '.') LOGGING_FORMAT = '[%(asctime)s] - [%(threadName)s] - [%(levelname)s] - %(message)s' LEVEL_STYLE...
null
v0
[ "str" ]
Any
def v0(self, v1: str): v2: Queue = Queue(-1) v3 = QueueHandler(v2) v3.setLevel(logging.DEBUG) v4 = logging.getLogger(v1) v4.propagate = False v4.setLevel(logging.DEBUG) v4.addHandler(v3) v5 = QueueListener(v2, self.console_handler, self.file_handler, respect_handler_level=True) self....
[]
[ "logging", "queue" ]
[ "import logging", "from logging.handlers import QueueHandler, QueueListener", "from queue import Queue" ]
12
import logging import os import sys from logging.handlers import QueueHandler, QueueListener from queue import Queue from threading import Lock, currentThread from typing import Any, Dict, Set import coloredlogs ARTIFACTS_PATH = os.environ.get('ARTIFACTS_FOLDER', '.') LOGGING_FORMAT = '[%(asctime)s] - [%(threadName)s...
null
v0
[ "str", "bool" ]
None
def v0(self, v1: str, v2: bool=False) -> None: v3 = currentThread().getName() if v3 not in self.thread_names: self._add_logger(v3) v4 = self.real_time_logger.exception if v2 or self.real_time_logs_only else self.loggers[v3].exception v4(v1)
[]
[ "threading" ]
[ "from threading import currentThread, Lock" ]
6
import sys import coloredlogs import os import queue import logging from logging.handlers import QueueHandler, QueueListener from threading import currentThread, Lock ARTIFACTS_PATH = os.environ.get('CIRCLE_ARTIFACTS', '.') LOGGING_FORMAT = '[%(asctime)s] - [%(threadName)s] - [%(levelname)s] - %(message)s' LEVEL_STYLE...
null
v0
[]
None
def v0(self) -> None: v1 = currentThread().getName() self.logs_lock.acquire() self.listeners[v1].start() self.listeners[v1].stop() self.logs_lock.release()
[]
[ "threading" ]
[ "from threading import currentThread, Lock" ]
6
import sys import coloredlogs import os import queue import logging from logging.handlers import QueueHandler, QueueListener from threading import currentThread, Lock ARTIFACTS_PATH = os.environ.get('CIRCLE_ARTIFACTS', '.') LOGGING_FORMAT = '[%(asctime)s] - [%(threadName)s] - [%(levelname)s] - %(message)s' LEVEL_STYLE...
null
v0
[ "str" ]
bool
def v0(self, v1: str) -> bool: if not isinstance(v1, str) or len(v1) != self.id_size: raise TypeError(f'client id must be string and size {self.id_size}') v2 = self.client_list_header for v3 in range(len(v1)): if v1[v3] in v2.child_nodes: v2 = v2.child_nodes[v1[v3]] else:...
[]
[]
[]
10
import random from typing import Dict import threading import string class ClientCharacterNode: # 트라이 노드(철자 단위) def __init__(self, is_word: bool): self.child_nodes: Dict[str, ClientCharacterNode] = {} self.is_word: bool = is_word class ClientList: client_list_header: ClientCharacterNode ...
null
v7
[ "str" ]
None
def v7(self, v8: str) -> None: if not isinstance(v8, str) or len(v8) != self.id_size: raise TypeError(f'client id must be string and size {self.id_size}') v9 = self.client_list_header def v10(v11: v0, v12: str, v13: int) -> bool: if v13 == len(v12): return True else: ...
[ { "name": "v2", "input_types": [ "v0", "str", "int" ], "output_type": "bool", "code": "def v2(v3: v0, v4: str, v5: int) -> bool:\n if v5 == len(v4):\n return True\n else:\n v6 = v4[v5]\n if v6 in v3.child_nodes and v2(v3.child_nodes[v6], v4, v5 + 1):\...
[]
[]
16
import random from typing import Dict import threading import string class ClientCharacterNode: # 트라이 노드(철자 단위) def __init__(self, is_word: bool): self.child_nodes: Dict[str, ClientCharacterNode] = {} self.is_word: bool = is_word class ClientList: client_list_header: ClientCharacterNode ...
[ "class v0:\n\n def __init__(self, v1: bool):\n self.child_nodes: Dict[str, v0] = {}\n self.is_word: bool = v1" ]
v0
[ "str", "str", "dict", "Any" ]
dict
def v0(self, v1: str, v2: str='', v3: dict=None, v4=False, **v5) -> dict: if self.nosub: return dict(LOG=v1, LST='') v3 = v3 if v3 is not None else {} if v2 == '': if self.results.upper() == 'PANDAS': v2 = 'HTML' else: v2 = self.results v6 = self._io.submi...
[]
[]
[]
11
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[ "str", "str", "str", "str", "dict" ]
str
def v0(self, v1: str, v2: str=' ', v3: str='', v4: str=' ', v5: dict=None) -> str: v5 = v5 if v5 is not None else {} v6 = 'libname ' + v1 + ' ' + v2 + ' ' if len(v3) > 0: v6 += " '" + v3 + "' " v6 += v4 + ';' if self.nosub: print(v6) else: v7 = self._io.submit(v6, 'text',...
[]
[]
[]
14
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[ "str" ]
str
def v0(self, v1: str='') -> str: v2 = 'proc datasets' if v1: v2 += ' dd=' + v1 v2 += '; quit;' if self.nosub: print(v2) elif self.results.lower() == 'html': v3 = self._io.submit(v2, 'html') if not self.batch: self.DISPLAY(self.HTML(v3['LST'])) else...
[]
[]
[]
19
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[ "str", "str", "str", "dict", "dict" ]
str
def v0(self, v1: str, v2: str, v3: str='', v4: dict=None, v5: dict=None) -> str: v4 = v4 if v4 is not None else {} v5 = v5 if v5 is not None else {} v6 = self._io.write_csv(v1, v2, v3, self.nosub, v4, v5) if not self.batch: print(v6) else: return v6
[]
[]
[]
8
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[ "str", "str", "dict", "str" ]
'pandas.DataFrame'
def v0(self, v1: str, v2: str='', v3: dict=None, v4: str='MEMORY', **v5) -> 'pandas.DataFrame': v3 = v3 if v3 is not None else {} return self.sasdata2dataframe(v1, v2, v3, v4, **v5)
[]
[]
[]
3
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[ "str", "str", "dict", "str", "bool", "dict" ]
'pandas.DataFrame'
def v0(self, v1: str, v2: str='', v3: dict=None, v4: str=None, v5: bool=False, v6: dict=None, **v7) -> 'pandas.DataFrame': v3 = v3 if v3 is not None else {} v6 = v6 if v6 is not None else {} return self.sasdata2dataframe(v1, v2, v3, method='CSV', tempfile=v4, tempkeep=v5, opts=v6, **v7)
[]
[ "tempfile" ]
[ "import tempfile" ]
4
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[ "str", "str", "dict", "str" ]
'pd.DataFrame'
def v0(self, v1: str, v2: str='', v3: dict=None, v4: str='MEMORY', **v5) -> 'pd.DataFrame': if self.sascfg.pandas: raise type(self.sascfg.pandas)(self.sascfg.pandas.msg) v3 = v3 if v3 is not None else {} if self.exist(v1, v2) == 0: print('The SAS Data Set ' + v2 + '.' + v1 + ' does not exist...
[]
[]
[]
12
# # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
null
v0
[]
dict
async def v0(self, *v1, **v2) -> dict: v3 = v2.get('timeout', 1) v4 = self.get(timeout=v3) self.log.debug('Received message on channel: {}, msg_id: {}, msg_type: {}'.format(self.channel_name, v4['msg_id'], v4['msg_type'] if v4 else 'null')) self.task_done() return v4
[]
[]
[]
6
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import datetime import json import os from logging import Logger from queue import Queue from threading import Thread from typing import Dict import websocket from jupyter_client.asynchronous.client import AsyncKernelC...
null
v0
[]
None
def v0(self) -> None: if not self.empty(): v1 = [] while self.qsize(): v2 = self.get_nowait() if v2['msg_type'] != 'status': v1.append(v2['msg_type']) if self.channel_name == 'iopub' and 'shutdown_reply' in v1: return if len(v1): ...
[]
[]
[]
11
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import datetime import json import os from logging import Logger from queue import Queue from threading import Thread from typing import Dict import websocket from jupyter_client.asynchronous.client import AsyncKernelC...
null
v0
[ "str", "dict", "dict" ]
Any
def v0(v1: str, v2: dict={}, v3: dict={}): v4 = str(v1) + json.dumps(v2) + json.dumps(v3) v4 = ''.join(v4.split()) v5 = md5(v4.encode('utf-8')).hexdigest() return v5
[]
[ "hashlib", "json" ]
[ "import json", "from hashlib import md5" ]
5
"""Mid-level helper functions for AutoTS.""" import sys import traceback as tb import random from math import ceil import numpy as np import pandas as pd import datetime import json from hashlib import md5 from autots.tools.transform import RandomTransform, GeneralTransformer, shared_trans from autots.models.ensemble i...
null
v0
[ "Any", "Any", "list" ]
Any
def v0(v1, v2, v3: list=['Model', 'ModelParameters', 'TransformationParameters', 'Ensemble']): v4 = list(v2[v3].columns.values) v5 = v1.copy().set_index(v4).index v6 = v2.set_index(v4).index v7 = v2[~v6.isin(v5)] return v7
[]
[]
[]
6
"""Mid-level helper functions for AutoTS.""" import sys import traceback as tb import random from math import ceil import numpy as np import pandas as pd import datetime import json from hashlib import md5 from autots.tools.transform import RandomTransform, GeneralTransformer, shared_trans from autots.models.ensemble i...
null
v0
[ "dict", "dict" ]
Any
def v0(v1: dict, v2: dict): v3 = [*v2] v4 = int(len(v3) / 2) if len(v3) > 1 else 1 v5 = np.random.choice(v3, size=v4) v6 = {k: v2[k] for v7 in v5} v8 = {**v1, **v6} return v8
[]
[ "numpy" ]
[ "import numpy as np" ]
7
"""Mid-level helper functions for AutoTS.""" import numpy as np import pandas as pd import datetime import json from hashlib import md5 from autots.evaluator.metrics import PredictionEval from autots.tools.transform import RandomTransform def seasonal_int(include_one: bool = False): """Generate a random integer o...
null
v9
[ "torch.Tensor", "torch.Tensor" ]
torch.Tensor
def v9(v10: torch.Tensor, v11: torch.Tensor) -> torch.Tensor: (v12, v13) = v3(v10, v11) return v0(v12, v13)
[ { "name": "v0", "input_types": [ "torch.Tensor", "int" ], "output_type": "torch.Tensor", "code": "def v0(v1: torch.Tensor, v2: int) -> torch.Tensor:\n return v1 / v2", "dependencies": [] }, { "name": "v3", "input_types": [ "torch.Tensor", "torch.Tensor"...
[ "torch" ]
[ "import torch" ]
3
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
null
v0
[ "AbstractEventLoop" ]
None
def v0(v1: AbstractEventLoop) -> None: v1.add_signal_handler(signal.SIGINT, v1.stop) v1.add_signal_handler(signal.SIGTERM, v1.stop)
[]
[ "signal" ]
[ "import signal" ]
3
from __future__ import annotations import signal from asyncio import AbstractEventLoop, get_event_loop from evtstrd.config import Config from evtstrd.dispatcher import Dispatcher from evtstrd.http_server import HTTPServer from evtstrd.socket_server import SocketServer from evtstrd.stats import ServerStats def run_s...
null
v0
[ "Any", "Any", "Any", "Any" ]
Optional['CKCCClient']
def v0(self, v1, v2=True, *, v3=None, v4=True) -> Optional['CKCCClient']: v5 = super().get_client(v1, v2, devices=v3, allow_user_interaction=v4) if v5 is not None: v5.ping_check() return v5
[]
[]
[]
5
# # Coldcard Electrum plugin main code. # # import os, time, io import traceback from typing import TYPE_CHECKING, Optional import struct from electrum import bip32 from electrum.bip32 import BIP32Node, InvalidMasterKeyVersionBytes from electrum.i18n import _ from electrum.plugin import Device, hook from electrum.keys...
null
v0
[ "str" ]
Any
def v0(self, v1: str): if v1 in ('p2wpkh', 'p2wsh'): return self.types.OutputScriptType.PAYTOWITNESS if v1 in ('p2wpkh-p2sh', 'p2wsh-p2sh'): return self.types.OutputScriptType.PAYTOP2SHWITNESS if v1 in ('p2pkh',): return self.types.OutputScriptType.PAYTOADDRESS if v1 in ('p2sh',)...
[]
[]
[]
10
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_ltc.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_ltc.bip32 import BIP32Node from electrum_ltc import constants...
null
v0
[ "str" ]
bool
async def v0(self, v1: str) -> bool: v2 = {'service': v1} v3 = self.format_request('is_running', v2) v4 = await self._get(v3) if 'is_running' in v4['data']: return bool(v4['data']['is_running']) return False
[]
[]
[]
7
import asyncio import json import ssl from pathlib import Path from typing import Any, Dict, Optional import websockets from inan.server.server import ssl_context_for_client from inan.types.blockchain_format.sized_bytes import bytes32 from inan.util.config import load_config from inan.util.json_util import dict_to_js...
null
v0
[ "str", "int", "bool" ]
Any
def v0(self, v1: str, v2: int, v3: bool=True): if v1 not in self.latest_info: self.latest_info[v1] = {'last_tweet_id': 0, 'profile_image': '', 'media_only': v3, 'groups': []} self.latest_info[v1]['groups'].append(v2)
[]
[]
[]
4
import asyncio import os import pickle import random from typing import Dict, List from hoshino import Service, priv from hoshino.typing import CQEvent """ # 将以下三行添加到hoshino/modules/tiwtter/twitter.py 中的 twitter_poller 前,并注释掉原版 @sv.scheduled_job from .twitter_subscription import TwitterSubscription t_sub = TwitterSub...
null
v0
[ "list", "str" ]
Any
def v0(self, v1: list, v2: str): v1 = cv2.normalize(v1, None, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_32F) v1 = v1.astype(np.uint8) cv2.imwrite(v2, v1)
[]
[ "cv2", "numpy" ]
[ "import time, os, cv2", "import numpy as np" ]
4
""" Die Klasse LoggingCallback, erbt von tensorflow.keras.callbacks.Callback Wird als Instanz beim Trianieren mit der fit-Methode als callback übergeben. Die Methoden, welche mit "on_..." beginnen werden zu dem entsprechenden Zeitpunkt wärend des Trainingsprozesses aufgerufen und dokumentieren den Trainingsvortschritt...
null
v0
[ "Any" ]
None
def v0(self, v1: Any) -> None: super()._validate(v1) if v1 is not None: for (v2, v3) in enumerate(v1): if not isinstance(v3, int): raise ValueError('{}: tuple element at index {} with value {} in {} is not an integer'.format(self.name, v2, v3, v1))
[]
[]
[]
6
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "Any", "Any" ]
Any
def v0(self, v1: Any, v2: Any) -> Any: if isinstance(v2, Path): return [v2] return v2
[]
[ "pathlib" ]
[ "from pathlib import Path" ]
4
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "Dict[str, Any]", "bool" ]
None
def v0(self, v1: Dict[str, Any], v2: bool=True) -> None: for (v3, v4) in v1.items(): try: self.set_param(v3, v4) except ValueError: setattr(self, v3, v4) if v2: self.validate()
[]
[]
[]
8
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v6
[ "Optional[Dict[str, Any]]", "bool", "Optional[Set[str]]" ]
Dict[str, Any]
def v6(self, v7: Optional[Dict[str, Any]], v8: bool=True, v9: Optional[Set[str]]=None) -> Dict[str, Any]: def v10(v11: Optional[Dict[str, Any]]) -> Dict[str, Any]: v12: Dict[str, Any] = {} if v11 is not None: v13 = self.get_overridable_parameters().keys() for (v14, v15) in v...
[ { "name": "v0", "input_types": [ "Optional[Dict[str, Any]]" ], "output_type": "Dict[str, Any]", "code": "def v0(v1: Optional[Dict[str, Any]]) -> Dict[str, Any]:\n v2: Dict[str, Any] = {}\n if v1 is not None:\n v3 = self.get_overridable_parameters().keys()\n for (v4, v5)...
[]
[]
17
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "Dict[str, Any]", "Optional[Set[str]]" ]
None
def v0(self, v1: Dict[str, Any], v2: Optional[Set[str]]=None) -> None: for (v3, v4) in v1.items(): if v2 and v3 in v2: continue v5 = getattr(self, v3, None) if v5 == v4: continue if v3 not in self.params(): v6 = 'parameter is undefined' els...
[]
[ "logging" ]
[ "import logging" ]
17
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "str" ]
bool
def v0(v1: str) -> bool: v2 = str(v1).lower() if v2 in ('on', 't', 'true', 'y', 'yes', '1'): return True if v2 in ('off', 'f', 'false', 'n', 'no', '0'): return False raise ValueError(f'Invalid value {v1}, please supply one of True, true, false or False.')
[]
[]
[]
7
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "Optional[Dict[str, Any]]" ]
Dict[str, Any]
def v0(v1: Optional[Dict[str, Any]]) -> Dict[str, Any]: v2: Dict[str, Any] = {} if v1 is not None: v3 = self.get_overridable_parameters().keys() for (v4, v5) in v1.items(): if v4 in v3: v2[v4] = v5 setattr(self, v4, v5) return v2
[]
[]
[]
9
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v17
[ "Any" ]
Callable
def v17(v18) -> Callable: def v19(v20): @functools.wraps(v20) def v21(*v22, **v23): if not v8(v18, return_bool=True): raise ModuleNotFoundError(f'Could not find or import {v18}.') return v20(*v22, **v23) return v21 return v19
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n\n @functools.wraps(v1)\n def v2(*v3, **v4):\n if not which_import(pkg_name, return_bool=True):\n raise ModuleNotFoundError(f'Could not find or import {pkg_name}.')\n return...
[ "importlib" ]
[ "import importlib" ]
11
import os import shutil import sys from typing import List, Union, Callable import functools import importlib def require(pkg_name) -> Callable: """Returns a decorator function, ensures pkg_name is available and can be imported. Parameters ---------- pkg_name: str Name of the package required....
null
v0
[ "str", "bool", "bool", "str", "str", "bool" ]
Union[bool, None, str, List[str]]
def v0(v1: str, *, v2: bool=False, v3: bool=False, v4: str=None, v5: str=None, v6: bool=False) -> Union[bool, None, str, List[str]]: try: v7 = importlib.util.find_spec(v1, package=v5) except ModuleNotFoundError: v7 = None v8 = v7 is not None and v7.origin in [None, 'namespace'] if v7 is ...
[]
[ "importlib" ]
[ "import importlib" ]
19
import os import shutil import sys from typing import List, Union, Callable import functools import importlib def require(pkg_name) -> Callable: """Returns a decorator function, ensures pkg_name is available and can be imported. Parameters ---------- pkg_name: str Name of the package required....
null
v0
[ "str", "bool", "bool", "str", "str" ]
Union[bool, None, str]
def v0(v1: str, *, v2: bool=False, v3: bool=False, v4: str=None, v5: str=None) -> Union[bool, None, str]: if v5 is None: v6 = {'PATH': os.pathsep + os.environ.get('PATH', '') + os.path.dirname(sys.executable)} else: v6 = {'PATH': os.pathsep.join([os.path.abspath(x) for v7 in v5.split(os.pathsep)...
[]
[ "os", "shutil", "sys" ]
[ "import os", "import shutil", "import sys" ]
13
import os import shutil import sys from typing import List, Union, Callable import functools import importlib def require(pkg_name) -> Callable: """Returns a decorator function, ensures pkg_name is available and can be imported. Parameters ---------- pkg_name: str Name of the package required....
null
v3
[ "Path" ]
Path
def v3(v4: Path) -> Path: v5: Path = v2() v6: str = 'bladebit' v7: str = 'build' if sys.platform in ['win32', 'cygwin']: v6 = 'bladebit.exe' v7 = 'build/Release' if not v5.exists(): v5 = v0(v4) / v7 return v5 / v6
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "Path", "code": "def v0(v1: Path) -> Path:\n return v1 / BLADEBIT_PLOTTER_DIR", "dependencies": [] }, { "name": "v2", "input_types": [], "output_type": "Path", "code": "def v2() -> Path:\n return Path(o...
[ "os", "pathlib", "sys" ]
[ "import os", "import sys", "from pathlib import Path" ]
10
import asyncio import json import traceback import os import sys import logging from pathlib import Path from typing import Any, Dict, Optional, Tuple from stor.plotting.create_plots import resolve_plot_keys from stor.plotters.plotters_util import run_plotter, run_command log = logging.getLogger(__name__) BLADEBIT_...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = datetime.now(timezone.utc).timestamp() v3 = int(v2 * 1000000.0) return f'{v1}_{v3}_{secrets.token_hex(2)}'
[]
[ "datetime", "secrets" ]
[ "import secrets", "from datetime import datetime, timezone" ]
4
import secrets from datetime import datetime, timezone def generate_username(prefix: str) -> str: time_s = datetime.now(timezone.utc).timestamp() time_ns = int(time_s * 1e6) return f"{prefix}_{time_ns}_{secrets.token_hex(2)}" def parse_username(username: str) -> datetime: prefix, time_ns, token = us...
null
v0
[ "str" ]
datetime
def v0(v1: str) -> datetime: (v2, v3, v4) = v1.split('_') v5 = int(v3) / 1000000.0 return datetime.fromtimestamp(v5, timezone.utc)
[]
[ "datetime" ]
[ "from datetime import datetime, timezone" ]
4
import secrets from datetime import datetime, timezone def generate_username(prefix: str) -> str: time_s = datetime.now(timezone.utc).timestamp() time_ns = int(time_s * 1e6) return f"{prefix}_{time_ns}_{secrets.token_hex(2)}" def parse_username(username: str) -> datetime: prefix, time_ns, token = us...
null
v0
[]
None
def v0(self) -> None: while not self.event.is_set(): self.target() self.event.wait(self.interval_seconds)
[]
[]
[]
4
import threading from threading import Thread, Event from typing import Callable class IntervalRunner: event: Event thread: Thread def __init__(self, target: Callable[[], None], interval_seconds: float = 0.1): self.event = threading.Event() self.target = target self.interval_secon...
null
v0
[]
'IntervalRunner'
def v0(self) -> 'IntervalRunner': self.thread.start() return self
[]
[]
[]
3
import threading from threading import Thread, Event from typing import Callable class IntervalRunner: event: Event thread: Thread def __init__(self, target: Callable[[], None], interval_seconds: float = 0.1): self.event = threading.Event() self.target = target self.interval_secon...
null
v0
[]
np.ndarray
def v0(self) -> np.ndarray: if self.observer_vehicle: return self.observer_vehicle.position elif self.env.vehicle: return self.env.vehicle.position else: return np.array([0, 0])
[]
[ "numpy" ]
[ "import numpy as np" ]
7
import os from typing import TYPE_CHECKING, Callable, List, Optional import numpy as np import pygame from highway_env.envs.common.action import ActionType, DiscreteMetaAction, ContinuousAction from highway_env.road.graphics import WorldSurface, RoadGraphics from highway_env.vehicle.graphics import VehicleGraphics if...
null
v0
[ "Optional[pendulum.DateTime]" ]
Tuple[Optional[pendulum.DateTime], Optional[pendulum.DateTime]]
def v0(self, v1: Optional[pendulum.DateTime]) -> Tuple[Optional[pendulum.DateTime], Optional[pendulum.DateTime]]: if self.schedule_interval == '@once' and v1 or self.schedule_interval is None: return (None, None) v2 = self.next_dagrun_after_date(v1) if v2 is None: return (None, None) if ...
[]
[]
[]
9
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
null
v1
[ "Optional[pendulum.DateTime]" ]
Any
def v1(self, v2: Optional[pendulum.DateTime]): if not self.schedule_interval or self.is_subdag: return None if self.schedule_interval == '@once' and v2: return None if not (self.catchup or self.schedule_interval == '@once'): v3 = v0.utcnow() v4 = self.following_schedule(v3) ...
[ { "name": "v0", "input_types": [], "output_type": "Any", "code": "@property\ndef v0(self):\n return settings.TIMEZONE", "dependencies": [] } ]
[ "datetime" ]
[ "from datetime import datetime, timedelta" ]
42
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
null
v0
[]
bool
def v0(self) -> bool: v1 = False for v2 in self.tasks: if v2.executor_config is not None and 'periodic_config' in v2.executor_config: self.log.debug('{} has periodic task {}'.format(self.dag_id, v2.task_id)) v1 = True break if v2.has_subscribed_external_events...
[]
[]
[]
14
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
null
v4
[]
None
def v4(self) -> None: def v5(v6, v7=0): print(' ' * v7 * 4 + str(v6)) v7 += 1 for v8 in v6.downstream_list: v5(v8, v7) for v9 in self.roots: v5(v9)
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2=0):\n print(' ' * v2 * 4 + str(v1))\n v2 += 1\n for v3 in v1.downstream_list:\n v0(v3, v2)", "dependencies": [] } ]
[]
[]
9
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
null
v0
[]
set
def v0(self) -> set: v1 = set() for (v2, v3, v4, v5, v6) in self.task_event_dependencies: v1.add(v2) return v1
[]
[]
[]
5
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
null
v13
[ "web.Request" ]
Any
async def v13(v14: web.Request, *v15, **v16): v17 = [] for v18 in self.dazzler.middlewares: v19 = await v18(v14) if v19: v17.append(v19) v20 = await v3(v14, *v15, **v16) for v19 in v17: await v19(v20) return v20
[ { "name": "v0", "input_types": [ "asyncio.Task" ], "output_type": "Any", "code": "def v0(v1: asyncio.Task):\n pendings.remove(v1)\n v2 = v1.exception()\n if v2 and (not v1.cancelled()):\n v1.print_stack(file=sys.stderr)\n self.logger.error(v2)", "dependencies": [...
[ "sys" ]
[ "import sys" ]
10
import asyncio import os import pkgutil import sys from ssl import SSLContext from typing import Optional, List import weakref import aiohttp from aiohttp import web, WSCloseCode from .system import Page, UNDEFINED, Route from .tools import replace_all, format_tag from ._renderer import package as renderer class ...
null
v0
[ "Any", "Any", "Dict" ]
requests.Response
def v0(v1, v2=200, v3: Dict=None) -> requests.Response: v4 = requests.Response() v4._content = json.dumps(v1) v4.status_code = v2 if v3: v4.headers.update(v3) return v4
[]
[ "json", "requests" ]
[ "import json", "import requests" ]
7
import glob import importlib import io import json import os import re import shutil import tempfile import time import zipfile from contextlib import contextmanager from typing import Any, Callable, Dict, List, Optional, Tuple import boto3 import requests from six import iteritems from localstack.constants import ( ...
null
v0
[ "Callable[[dict], Any]", "str", "str", "Optional[str]" ]
list
def v0(v1: Callable[[dict], Any], v2: str, v3: str, v4: Optional[str]=None) -> list: if v4 is None: v4 = v2 v5 = None v6 = [] v7 = None while not v5 or v7: v8 = {v4: v7} if v7 else {} v5 = v1(v8) v7 = v5.get(v2) v6 += v5.get(v3, []) return v6
[]
[]
[]
12
import glob import importlib import io import json import os import re import shutil import tempfile import time import zipfile from contextlib import contextmanager from typing import Any, Callable, Dict, List, Optional, Tuple import boto3 import requests from six import iteritems from localstack.constants import ( ...
null
v1
[ "v0" ]
Any
def v1(self, v2: v0): self.assertNumEndpoints(v2, 1) v3 = v2.rds['virtualHosts'][0]['routes'][0]['route']['retryPolicy'] self.assertEqual(4, v3['numRetries']) self.assertEqual('unavailable', v3['retryOn'])
[]
[]
[]
5
# Copyright 2021 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
[ "v0 = xds_url_map_testcase.DumpedXdsConfig" ]
v0
[ "bool" ]
Any
def v0(v1: bool=False): self.retry_num = self.retry_num + 1 return ['...', '...', 'Buenaventura'][self.retry_num]
[]
[]
[]
3
#!/usr/bin/env python3 from unittest.mock import mock_open, patch from rkd.api.testing import BasicTestingCase from rkd.api.inputoutput import Wizard from rkd.api.inputoutput import BufferedSystemIO from rkd.test import TestTask from rkd.exception import InterruptExecution class TestWizard(BasicTestingCase): def...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: if v1 is None: return None v1 = re.sub('\\s+', '', v1) v1 = v1.strip() return v1
[]
[ "re" ]
[ "import re" ]
6
"""For working with strings that can be used as barcode identifiers.""" import re import uuid __all__ = ["sanitize_identifier_string", "generate_barcode_string"] def sanitize_identifier_string(barcode: str) -> str: """Remove whitespace and other junk characters from a barcode string.""" if barcode is None: ...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-jezero.gpx') self.assertEqual(v1.creator, 'GPSBabel - http://www.gpsbabel.org')
[]
[]
[]
3
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-jezero-no-creator.gpx') self.assertEqual(v1.creator, None)
[]
[]
[]
3
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-jezero.gpx') v2 = v1.to_xml() self.assertTrue('creator="GPSBabel - http://www.gpsbabel.org"' in v2) v3 = self.reparse(v1) self.assertEqual(v3.creator, 'GPSBabel - http://www.gpsbabel.org')
[]
[]
[]
6
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v8
[]
None
def v8(self) -> None: v9 = self.parse('cerknicko-jezero.gpx') v10 = self.reparse(v9) self.assertTrue(v0(v9.waypoints, v10.waypoints)) self.assertTrue(v0(v9.routes, v10.routes)) self.assertTrue(v0(v9.tracks, v10.tracks)) self.assertTrue(v0(v9, v10))
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any, v3: Any=None) -> bool:\n if not v1 and (not v2):\n return True\n if not v1 or not v2:\n print('Not obj2')\n return False\n if not v1.__...
[]
[]
7
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-jezero.gpx') self.assertTrue(v1.waypoints[0].time) self.assertTrue(isinstance(v1.waypoints[0].time, mod_datetime.datetime))
[]
[ "datetime" ]
[ "import datetime as mod_datetime" ]
4
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-jezero.gpx') for (v2, v3, v4, v5) in v1.walk(): self.assertTrue(v2.elevation is not None) v1.remove_elevation(tracks=True, waypoints=True, routes=True) for (v2, v3, v4, v5) in v1.walk(): self.assertTrue(v2.elevation is None) v6 = v1.to...
[]
[]
[]
9
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-jezero.gpx') for (v2, v3, v4, v5) in v1.walk(): self.assertTrue(v2.time is not None) v1.remove_time() for (v2, v3, v4, v5) in v1.walk(): self.assertTrue(v2.time is None)
[]
[]
[]
7
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('cerknicko-without-times.gpx') self.assertFalse(v1.has_times())
[]
[]
[]
3
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') self.assertTrue(len(v1.tracks) == 4) self.assertTrue(v1.tracks[0].has_times()) self.assertTrue(not v1.tracks[1].has_times()) self.assertTrue(v1.tracks[2].has_times()) self.assertTrue(v1.tracks[3].has_times())
[]
[]
[]
7
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('first_and_last_elevation.gpx') v2 = len(list(v1.walk())) v1.smooth(vertical=True, horizontal=False) self.assertEqual(v2, len(list(v1.walk())))
[]
[]
[]
5
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v8
[]
None
def v8(self) -> None: v9 = self.parse('track_with_speed.gpx') v10 = self.reparse(v9) self.assertTrue(v0(v9.waypoints, v10.waypoints)) self.assertTrue(v0(v9.routes, v10.routes)) self.assertTrue(v0(v9.tracks, v10.tracks)) self.assertTrue(v0(v9, v10)) self.assertEqual(v9.tracks[0].segments[0].p...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any, v3: Any=None) -> bool:\n if not v1 and (not v2):\n return True\n if not v1 or not v2:\n print('Not obj2')\n return False\n if not v1.__...
[]
[]
10
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v8
[]
None
def v8(self) -> None: v9 = self.parse('track_with_dilution_errors.gpx') v10 = self.reparse(v9) self.assertTrue(v0(v9.waypoints, v10.waypoints)) self.assertTrue(v0(v9.routes, v10.routes)) self.assertTrue(v0(v9.tracks, v10.tracks)) self.assertTrue(v0(v9, v10)) for v11 in (v9, v10): sel...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any, v3: Any=None) -> bool:\n if not v1 and (not v2):\n return True\n if not v1 or not v2:\n print('Not obj2')\n return False\n if not v1.__...
[]
[]
17
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.get_time_bounds() (v3, v4) = v1.get_time_bounds() self.assertEqual(v3, v2.start_time) self.assertEqual(v4, v2.end_time)
[]
[]
[]
6
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.get_moving_data() (v3, v4, v5, v6, v7) = v1.get_moving_data() self.assertEqual(v3, v2.moving_time) self.assertEqual(v4, v2.stopped_time) self.assertEqual(v5, v2.moving_distance) self.assertEqual(v6, v2.stopped_distance) ...
[]
[]
[]
9
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.get_uphill_downhill() (v3, v4) = v1.get_uphill_downhill() self.assertEqual(v3, v2.uphill) self.assertEqual(v4, v2.downhill)
[]
[]
[]
6
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.get_elevation_extremes() (v3, v4) = v1.get_elevation_extremes() self.assertEqual(v3, v2.minimum) self.assertEqual(v4, v2.maximum)
[]
[]
[]
6
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.tracks[1].segments[0].points[2] v2.latitude *= 1.00001 v2.longitude *= 0.99999 v3 = v1.get_nearest_location(v2) (v4, v5, v6, v7) = v1.get_nearest_location(v2) self.assertEqual(v4, v3.location) self.assertEqual(v5, v3.tr...
[]
[]
[]
11
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.get_points_data() for v3 in v2: (v4, v5, v6, v7, v8) = v3 self.assertEqual(v4, v3.point) self.assertEqual(v5, v3.distance_from_start) self.assertEqual(v6, v3.track_no) self.assertEqual(v7, v3.segment...
[]
[]
[]
10
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.get_points_data(distance_2d=True) (v3, v4, v5, v6, v7) = v2[-1] self.assertEqual(v5, len(v1.tracks) - 1) self.assertEqual(v6, len(v1.tracks[-1].segments) - 1) self.assertEqual(v7, len(v1.tracks[-1].segments[-1].points) - 1) ...
[]
[]
[]
15
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') for v2 in v1.walk(): self.assertTrue(v2) for (v2, v3, v4, v5) in v1.walk(): self.assertTrue(v2) self.assertEqual(v3, len(v1.tracks) - 1) self.assertEqual(v4, len(v1.tracks[-1].segments) - 1) self.assertEqual(v5, len(v1....
[]
[]
[]
9
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.tracks[1] for v3 in v2.walk(): self.assertTrue(v3) for (v4, v5, v6) in v2.walk(): self.assertTrue(v4) self.assertEqual(v5, len(v2.segments) - 1) self.assertEqual(v6, len(v2.segments[-1].points) - 1)
[]
[]
[]
9
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('korita-zbevnica.gpx') v2 = v1.tracks[1] v3 = v2.segments[0] assert len(v3.points) > 0 for v4 in v3.walk(): self.assertTrue(v4) '\n for point, segment_no, point_no in track.walk():\n self.assertTrue(point)\n\n self.assertEqua...
[]
[]
[]
8
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v0
[]
None
def v0(self) -> None: v1 = self.parse('custom_schema_locations.gpx') self.assertEqual(['http://www.topografix.com/GPX/1/1', 'http://www.topografix.com/GPX/1/1/gpx.xsd', 'http://www.garmin.com/xmlschemas/GpxExtensions/v3', 'http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd'], v1.schema_locations)
[]
[]
[]
3
# Copyright 2011 Tomo Krajina # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null