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: if not self.cluster.is_shutdown: self.cluster.shutdown()
[]
[]
[]
3
# # 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
[ "str" ]
bool
def v0(self, v1: str) -> bool: v2 = self.keyspace if '.' in v1: (v2, v1) = v1.split('.', 1) v3 = self.get_conn().cluster.metadata return v2 in v3.keyspaces and v1 in v3.keyspaces[v2].tables
[]
[]
[]
6
# # 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
[ "str", "Dict[str, str]" ]
bool
def v0(self, v1: str, v2: Dict[str, str]) -> bool: v3 = self.keyspace if '.' in v1: (v3, v1) = v1.split('.', 1) v4 = ' AND '.join((f'{key}=%({key})s' for v5 in v2.keys())) v6 = f'SELECT * FROM {v3}.{v1} WHERE {v4}' try: v7 = self.get_conn().execute(v6, v2) return v7.one() is ...
[]
[]
[]
11
# # 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
[ "str" ]
Dict[str, Any]
def v0(v1: str) -> Dict[str, Any]: v2 = dict() with open(v1) as v3: for (v4, v5) in json.load(v3).items(): v2[v4] = v5[-1] if isinstance(v5, list) else v5 return v2
[]
[ "json" ]
[ "import json" ]
6
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v6
[ "str", "List[str]" ]
List[Dict[str, Any]]
def v6(v7: str, v8: List[str]=('learn-embeddings',)) -> List[Dict[str, Any]]: v9 = [os.path.abspath(os.path.join(v7, x)) for v10 in sorted(os.listdir(v7)) if v10 not in v8] return [v0(os.path.join(path, 'results_val.json')) for v11 in v9]
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Dict[str, Any]", "code": "def v0(v1: str) -> Dict[str, Any]:\n v2 = dict()\n with open(v1) as v3:\n for (v4, v5) in json.load(v3).items():\n v2[v4] = v5[-1] if isinstance(v5, list) else v5\n return v2", ...
[ "json", "os" ]
[ "import json", "import os" ]
3
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v12
[ "str" ]
List[List[Dict[str, Any]]]
def v12(v13: str) -> List[List[Dict[str, Any]]]: v14 = list() for v13 in [os.path.abspath(os.path.join(v13, x)) for v15 in sorted(os.listdir(v13))]: v14.append(v6(v13)) return v14
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Dict[str, Any]", "code": "def v0(v1: str) -> Dict[str, Any]:\n v2 = dict()\n with open(v1) as v3:\n for (v4, v5) in json.load(v3).items():\n v2[v4] = v5[-1] if isinstance(v5, list) else v5\n return v2", ...
[ "json", "os" ]
[ "import json", "import os" ]
5
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v0
[ "Axes", "List[Dict[str, Any]]", "List[str]", "List[str]", "str" ]
Axes
def v0(v1: Axes, v2: List[Dict[str, Any]], v3: List[str]=None, v4: List[str]=None, v5: str=None) -> Axes: if v3 is None: v3 = list(v2[0].keys()) if v4 is None: v4 = list(v3) v6 = (1 - 0.2) / len(v2) v7 = [-(v6 * (len(v2) // 2)) + x * v6 for v8 in range(len(v2))] for (v9, v10) in enum...
[]
[]
[]
15
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v0
[ "Dict[str, Any]", "Dict[str, str]" ]
List[str]
def v0(v1: Dict[str, Any], v2: Dict[str, str]=None) -> List[str]: v3 = list() for (v4, v5) in v1.items(): if isinstance(v5, float): v5 = f'{v5:.04f}' v3.append(f'{v2.get(v4, v4)}: **{v5}**') return v3
[]
[]
[]
7
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v0
[ "List[str]", "str" ]
str
def v0(v1: List[str], v2: str=None) -> str: if v2 is None: v2 = ''.join([' '] * 10) return v2.join(v1)
[]
[]
[]
4
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v9
[ "List[Dict[str, Any]]", "Dict[str, str]", "str", "str" ]
str
def v9(v10: List[Dict[str, Any]], v11: Dict[str, str], v12: str=None, v13: str=None) -> str: if v12 is None: v12 = '' if v13 is None: v13 = '' v14 = [v0(hyperparameter, v11) for v15 in v10] v16 = [v6(particles) for v17 in v14] return v12 + v13.join(v16)
[ { "name": "v0", "input_types": [ "Dict[str, Any]", "Dict[str, str]" ], "output_type": "List[str]", "code": "def v0(v1: Dict[str, Any], v2: Dict[str, str]=None) -> List[str]:\n v3 = list()\n for (v4, v5) in v1.items():\n if isinstance(v5, float):\n v5 = f'{v5:....
[]
[]
8
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v0
[ "str", "str", "str" ]
Dict[str, Any]
def v0(v1: str, v2: str='f1', v3: str='high') -> Dict[str, Any]: v4 = [os.path.join(v1, x) for v5 in sorted(os.listdir(v1))] v6 = list() for v7 in [os.path.join(path, 'results_val.json') for v8 in v4]: if os.path.exists(v7): with open(v7) as v9: v10 = json.load(v9) ...
[]
[ "json", "os" ]
[ "import json", "import os" ]
13
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v12
[ "str", "str", "str" ]
Dict[str, Dict[str, Any]]
def v12(v13: str, v14: str='f1', v15: str='high') -> Dict[str, Dict[str, Any]]: v16 = dict() for v17 in sorted(os.listdir(v13)): v16[v17] = v0(os.path.join(v13, v17), v14, v15) return v16
[ { "name": "v0", "input_types": [ "str", "str", "str" ], "output_type": "Dict[str, Any]", "code": "def v0(v1: str, v2: str='f1', v3: str='high') -> Dict[str, Any]:\n v4 = [os.path.join(v1, x) for v5 in sorted(os.listdir(v1))]\n v6 = list()\n for v7 in [os.path.join(path...
[ "json", "os" ]
[ "import json", "import os" ]
5
# Copyright 2020 Miljenko Šuflaj # # 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 a...
null
v22
[ "str" ]
v0
def v22(v23: str) -> v0: with open(v23) as v24: v25 = v24.read() return v17(v25)
[ { "name": "v17", "input_types": [ "str" ], "output_type": "v0", "code": "def v17(v18: str) -> v0:\n v19 = Lark(GRAMMAR, parser='earley', propagate_positions=True)\n v20 = PatternTransformer(v18)\n v21 = v19.parse(v18)\n v20.transform(v21)\n return v0(v20.patterns, v20.defini...
[]
[]
4
from lark import Lark from lark.visitors import Transformer, v_args from dataclasses import dataclass from typing import List, TypeVar, Union, Any import re import json import itertools GRAMMAR = r""" start: var+ section+ var: IDENT "=" (WORD|ARRAY) _NL+ section: "++" IDENT "++" _NL pattern+ pattern: (WORD+ | match)+...
[ "class v0:\n v1: dict\n\n def __init__(self, v2: List[Pattern], v3: dict):\n v4 = itertools.groupby(v2, key=lambda p: p.section)\n self.definitions = v3\n self._sections = {}\n for (v5, v6) in v4:\n self._sections[v5] = [p.expanded for v7 in v6]\n self._meta = {ha...
v6
[ "List[dict]" ]
v0
def v6(self, v7: List[dict]) -> v0: v8 = hash(json.dumps(v7, sort_keys=True)) return self._meta[v8]
[]
[ "json" ]
[ "import json" ]
3
from lark import Lark from lark.visitors import Transformer, v_args from dataclasses import dataclass from typing import List, TypeVar, Union, Any import re import json import itertools GRAMMAR = r""" start: var+ section+ var: IDENT "=" (WORD|ARRAY) _NL+ section: "++" IDENT "++" _NL pattern+ pattern: (WORD+ | match)+...
[ "@dataclass\nclass v0:\n v1: str\n v2: str\n v3: Union[List[dict], str]\n v4: int\n\n def v5(self):\n return hash(json.dumps(self.expanded, sort_keys=True))" ]
v1
[ "str", "v0" ]
Union[List[List[dict]], v0]
def v1(self, v2: str, v3: v0) -> Union[List[List[dict]], v0]: if v2 in self._sections: return self._sections[v2] else: return v3
[]
[]
[]
5
from lark import Lark from lark.visitors import Transformer, v_args from dataclasses import dataclass from typing import List, TypeVar, Union, Any import re import json import itertools GRAMMAR = r""" start: var+ section+ var: IDENT "=" (WORD|ARRAY) _NL+ section: "++" IDENT "++" _NL pattern+ pattern: (WORD+ | match)+...
[ "v0 = TypeVar('T')" ]
v0
[ "Set[int]", "str", "List[str]" ]
str
def v0(v1: Set[int], v2: str, v3: List[str]) -> str: v4 = traceback.extract_stack() (v5, v5, v5, v6) = v4[-2] v7 = re.findall('[\\w]+(?=[,\\)])', v6)[0] v8 = f"{v7}.{v2}({', '.join(v3)})" return v8
[]
[ "re", "traceback" ]
[ "import re", "import traceback" ]
6
import re import traceback from typing import List, Set METHOD_LIST = ["discard", "pop", "remove"] def get_expression(obj: Set[int], command: str, values: List[str]) -> str: stack = traceback.extract_stack() _, _, _, code = stack[-2] st_name = re.findall(r"[\w]+(?=[,\)])", code)[0] expression = f"{...
null
v0
[ "Any" ]
int
def v0(self, v1) -> int: v2 = {} for v3 in range(len(v1)): v2[v1[v3]] = v2.get(v1[v3], 0) + 1 for v4 in v1: if v2[v4] > len(v1) // 2: return v4
[]
[]
[]
7
class Solution: def majorityElement(self, nums) -> int: # 字典这样初始化 dic = {} for i in range(len(nums)): dic[nums[i]] = dic.get(nums[i], 0) + 1 for num in nums: if(dic[num] > len(nums) // 2): return num
null
v12
[ "Path" ]
Any
def v12(v13: Path): if v8(v13): v2(v13) if v6(v13): v0(v13) if v10(v13): v4(v13)
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "Any", "code": "def v0(v1: Path):\n subprocess.run(['cmake-format', '-i', str(v1)], check=True)", "dependencies": [] }, { "name": "v2", "input_types": [ "Path" ], "output_type": "Any", "code": "d...
[ "subprocess" ]
[ "import subprocess" ]
7
import argparse import subprocess import utils from pathlib import Path def is_cpp_file(file: Path): return file.suffix in ['.h', '.hpp', '.c', '.cpp'] def is_cmake_file(file: Path): return file.name == 'CMakeLists.txt' or file.suffix == '.cmake' def is_python_file(file: Path): return file.suffix == ...
null
v0
[ "Path" ]
Any
def v0(v1: Path): v2 = ['clang-format', '--dry-run', '--Werror', str(v1)] return subprocess.run(v2).returncode != 0
[]
[ "subprocess" ]
[ "import subprocess" ]
3
import argparse import subprocess import utils from pathlib import Path def is_cpp_file(file: Path): return file.suffix in ['.h', '.hpp', '.c', '.cpp'] def is_cmake_file(file: Path): return file.name == 'CMakeLists.txt' or file.suffix == '.cmake' def is_python_file(file: Path): return file.suffix == ...
null
v0
[ "Path" ]
Any
def v0(v1: Path): v2 = ['cmake-format', '--check', str(v1)] return subprocess.run(v2, capture_output=True).returncode != 0
[]
[ "subprocess" ]
[ "import subprocess" ]
3
import argparse import subprocess import utils from pathlib import Path def is_cpp_file(file: Path): return file.suffix in ['.h', '.hpp', '.c', '.cpp'] def is_cmake_file(file: Path): return file.name == 'CMakeLists.txt' or file.suffix == '.cmake' def is_python_file(file: Path): return file.suffix == ...
null
v0
[ "Path" ]
Any
def v0(v1: Path): v2 = ['autopep8', '--exit-code', str(v1)] return subprocess.run(v2, capture_output=True).returncode != 0
[]
[ "subprocess" ]
[ "import subprocess" ]
3
import argparse import subprocess import utils from pathlib import Path def is_cpp_file(file: Path): return file.suffix in ['.h', '.hpp', '.c', '.cpp'] def is_cmake_file(file: Path): return file.name == 'CMakeLists.txt' or file.suffix == '.cmake' def is_python_file(file: Path): return file.suffix == ...
null
v15
[ "Path" ]
Any
def v15(v16: Path): if v8(v16): return v3(v16) if v6(v16): return v0(v16) if v10(v16): return v12(v16) return False
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "Any", "code": "def v0(v1: Path):\n v2 = ['cmake-format', '--check', str(v1)]\n return subprocess.run(v2, capture_output=True).returncode != 0", "dependencies": [] }, { "name": "v3", "input_types": [ "Pat...
[ "subprocess" ]
[ "import subprocess" ]
8
import argparse import subprocess import utils from pathlib import Path def is_cpp_file(file: Path): return file.suffix in ['.h', '.hpp', '.c', '.cpp'] def is_cmake_file(file: Path): return file.name == 'CMakeLists.txt' or file.suffix == '.cmake' def is_python_file(file: Path): return file.suffix == ...
null
v0
[ "List[str]" ]
int
def v0(self, v1: List[str]) -> int: if not isinstance(v1, list) or len(v1) <= 1: return -1 return self._findMinDifference(v1)
[]
[]
[]
4
#!/usr/bin/env python # -*- coding:utf-8 -*- """================================================================= @Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3 @File : LC-0539-Minimum-Time-Difference.py @Author : [YuweiYin](https://github.com/YuweiYin) @Date : 2022-01-18 ===========================...
null
v0
[ "List[str]" ]
int
def v0(self, v1: List[str]) -> int: v2 = len(v1) assert v2 > 1 v3 = 1440 v4 = [] for v5 in v1: assert isinstance(v5, str) and len(v5) == 5 assert v5[0:2].isdigit() and v5[3:].isdigit() v6 = int(v5[0:2]) v7 = int(v5[3:]) v8 = int(60 * v6 + v7) v4.append...
[]
[ "sys" ]
[ "import sys" ]
25
#!/usr/bin/env python # -*- coding:utf-8 -*- """================================================================= @Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3 @File : LC-0539-Minimum-Time-Difference.py @Author : [YuweiYin](https://github.com/YuweiYin) @Date : 2022-01-18 ===========================...
null
v0
[ "any", "any" ]
Any
def v0(v1: any, v2: any): global scale_x global scale_y v3 = StandardScaler().fit(v1) v4 = StandardScaler().fit(v2)
[]
[ "sklearn" ]
[ "from sklearn.preprocessing import StandardScaler" ]
5
from sklearn.preprocessing import StandardScaler scale_x = None scale_y = None def init_scale(x: any, y: any): global scale_x global scale_y scale_x = StandardScaler().fit(x) scale_y = StandardScaler().fit(y) def dismiss_scale(): global scale_x global scale_y scale_x = None scale_y ...
null
v0
[ "str", "str" ]
str
def v0(v1: str, v2: str) -> str: v3 = len(v1) v4 = [] for v5 in range(v3): v4.append(str(int(v1[v5]) ^ int(v2[v5]))) return ''.join(v4[::-1])
[]
[]
[]
6
# qubit number=4 # total number=43 import cirq import qiskit from qiskit import IBMQ from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from ma...
null
v0
[ "str", "str" ]
str
def v0(v1: str, v2: str) -> str: v3 = len(v1) v4 = 0 for v5 in range(v3): v4 += int(v1[v5]) * int(v2[v5]) return str(v4 % 2)
[]
[]
[]
6
# qubit number=4 # total number=43 import cirq import qiskit from qiskit import IBMQ from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from ma...
null
v0
[ "int", "Any" ]
QuantumCircuit
def v0(v1: int, v2) -> QuantumCircuit: v3 = QuantumRegister(v1, 'ofc') v4 = QuantumRegister(1, 'oft') v5 = QuantumCircuit(v3, v4, name='Of') for v6 in range(2 ** v1): v7 = np.binary_repr(v6, v1) if v2(v7) == '1': for v8 in range(v1): if v7[v8] == '0': ...
[]
[ "numpy", "qiskit" ]
[ "import qiskit", "from qiskit import IBMQ", "from qiskit.providers.ibmq import least_busy", "from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister", "from qiskit import BasicAer, execute, transpile", "from qiskit.test.mock import FakeVigo", "import numpy as np" ]
15
# qubit number=4 # total number=43 import cirq import qiskit from qiskit import IBMQ from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from ma...
null
v9
[ "int", "Any" ]
QuantumCircuit
def v9(v10: int, v11) -> QuantumCircuit: v12 = QuantumRegister(v10, 'qc') v13 = ClassicalRegister(v10, 'qm') v14 = QuantumCircuit(v12, v13) v14.cx(v12[0], v12[3]) v14.cx(v12[0], v12[3]) v14.x(v12[3]) v14.cx(v12[0], v12[3]) v14.cx(v12[0], v12[3]) v14.h(v12[1]) v14.h(v12[2]) v1...
[ { "name": "v0", "input_types": [ "int", "Any" ], "output_type": "QuantumCircuit", "code": "def v0(v1: int, v2) -> QuantumCircuit:\n v3 = QuantumRegister(v1, 'ofc')\n v4 = QuantumRegister(1, 'oft')\n v5 = QuantumCircuit(v3, v4, name='Of')\n for v6 in range(2 ** v1):\n ...
[ "numpy", "qiskit" ]
[ "import qiskit", "from qiskit import IBMQ", "from qiskit.providers.ibmq import least_busy", "from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister", "from qiskit import BasicAer, execute, transpile", "from qiskit.test.mock import FakeVigo", "import numpy as np" ]
46
# qubit number=4 # total number=49 import cirq import qiskit from qiskit import IBMQ from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from ma...
null
v0
[]
None
def v0(self) -> None: for v1 in self._ants: v1.do_your_job()
[]
[]
[]
3
from typing import List from core.ant import Ant class AntQueen: def __init__(self, ants: List[Ant]) -> None: self._ants = ants def do_morning_routine(self) -> None: for ant in self._ants: ant.do_your_job()
null
v0
[ "str" ]
datetime
def v0(v1: str) -> datetime: try: return datetime.strptime(v1, '%Y-%m-%dT%H:%M:%S.%f%z') except ValueError: return datetime.strptime(v1, '%Y-%m-%dT%H:%M:%S.%f')
[]
[ "datetime" ]
[ "from datetime import datetime" ]
5
import dataclasses from datetime import datetime from enum import Enum import json from typing import Dict, Tuple, Type, TypeVar from uuid import UUID from typing_extensions import Protocol from foundation.value_objects import Money from foundation.value_objects.factories import get_dollars T = TypeVar("T") class ...
null
v0
[ "str", "Any" ]
Any
def v0(v1: str, v2): v3 = {} v4 = 0 for (v5, v6) in v2: v3[v5] = v1[v4:v4 + v6].strip() v4 += v6 del v3['_'] return v3
[]
[]
[]
8
""" Read a SAS XPort format file into a Pandas DataFrame. Based on code from Jack Cushman (github.com/jcushman/xport). The file format is defined here: https://support.sas.com/techsup/technote/ts140.pdf """ from collections import abc from datetime import datetime from io import BytesIO import struct import warnings...
null
v0
[]
int
def v0(self) -> int: self.filepath_or_buffer.seek(0, 2) v1 = self.filepath_or_buffer.tell() - self.record_start if v1 % 80 != 0: warnings.warn('xport file may be corrupted.') if self.record_length > 80: self.filepath_or_buffer.seek(self.record_start) return v1 // self.record_leng...
[]
[ "numpy", "warnings" ]
[ "import warnings", "import numpy as np" ]
18
""" Read a SAS XPort format file into a Pandas DataFrame. Based on code from Jack Cushman (github.com/jcushman/xport). The file format is defined here: https://support.sas.com/content/dam/SAS/support/en/technical-papers/record-layout-of-a-sas-version-5-or-6-data-set-in-sas-transport-xport-format.pdf """ from __futur...
null
v0
[ "commands.Context" ]
str
def v0(self, v1: commands.Context) -> str: v2 = super().format_help_for_context(v1) v3 = 'Authors: ' + ', '.join(self.__authors__) return f'{v2}\n\n{v3}\nCog Version: {self.__version__}'
[]
[]
[]
4
import asyncio import functools import json import re from datetime import datetime, timezone from textwrap import shorten from urllib.parse import quote_plus, urlencode import aiohttp import discord from bs4 import BeautifulSoup from html2text import html2text as h2t from redbot.core import commands from redbot.core....
null
v0
[ "dict", "dict" ]
bool
async def v0(self, v1: dict, v2: dict) -> bool: v3 = v2['titleInfo'].get('gildingTrackingRecordHash', None) v4 = v1['profileRecords']['data']['records'] if str(v3) in v4: for v5 in v4[str(v3)]['objectives']: if v5['complete']: return True return False
[]
[]
[]
8
import asyncio import csv import datetime import functools import json import logging import re from io import BytesIO, StringIO from pathlib import Path from typing import List, Literal, Optional, Union import discord import pytz from redbot.core import Config, checks, commands from redbot.core.i18n import Translator...
null
v0
[]
None
async def v0(self) -> None: assert self._channel is not None assert self._stub is not None await self._channel.close() self._channel = None self._stub = None
[]
[]
[]
6
# -*- coding: utf-8 -*- import grpc import pickle from typing import Optional, Any, Mapping, Text, Tuple from grpc.aio._channel import Channel # noqa from recc.mime.mime_codec_register import MimeCodecRegister, get_global_mime_register from recc.network.uds import is_uds_family from recc.proto.daemon.daemon_api_pb2_g...
null
v0
[ "Tuple[np.ndarray, ...]" ]
Any
def v0(self, v1: Tuple[np.ndarray, ...]): if self.use_n_step: v1 = self.memory_n.add(v1) if v1: self.memory.add(v1)
[]
[]
[]
5
# -*- coding: utf-8 -*- """SAC agent from demonstration for episodic tasks in OpenAI Gym. - Author: Curt Park - Contact: curt.park@medipixel.io - Paper: https://arxiv.org/pdf/1801.01290.pdf https://arxiv.org/pdf/1812.05905.pdf https://arxiv.org/pdf/1511.05952.pdf https://arxiv.org/pdf/1707.0...
null
v0
[ "bytes", "Any", "Any" ]
Optional[int]
def v0(self, v1: bytes, v2=0, v3=None) -> Optional[int]: if v3 is None or v3 < v2: v3 = len(self) if not self.sorted: for v4 in range(v2, v3): v5 = self[v4] if v5 == v1: return v4 raise ValueError() v6 = self._sorted_find(v1, v2, v3) if v6 ...
[]
[]
[]
13
import os import bisect import struct from enum import IntFlag from typing import Tuple, Optional, Iterator from collections.abc import MutableSequence from .util import quickSort as _quickSort class SOBError(Exception): pass class SOBFlags(IntFlag): SORTED = 1 class SOBFile(MutableSequence): MAGIC =...
null
v0
[ "int", "Optional[int]", "int" ]
Iterator[int]
def v0(self, v1: int=0, v2: Optional[int]=None, v3: int=1024) -> Iterator[int]: if int(v3) == 0 or v2 == v1: return if v1 < 0: raise ValueError('lo must not be negative') if v2 is None: v2 = len(self) if v2 < v1: raise ValueError(f'{v2} < {v1}') v4 = (v1 + v2) // 2 ...
[]
[]
[]
15
import os import bisect import struct from enum import IntFlag from typing import Tuple, Optional, Iterator from collections.abc import MutableSequence from .util import quickSort as _quickSort class SOBError(Exception): pass class SOBFlags(IntFlag): SORTED = 1 class SOBFile(MutableSequence): MAGIC =...
null
v0
[ "bytes", "int", "int" ]
Any
def v0(self, v1: bytes, v2: int, v3: int): v4 = bisect.bisect_left(self, v1, v2, v3) v5 = self[v4] if v4 != len(self) and v5 == v1: return v4 return None
[]
[ "bisect" ]
[ "import bisect" ]
6
import os import bisect import struct from enum import IntFlag from typing import Tuple, Optional, Iterator from collections.abc import MutableSequence from .util import quickSort as _quickSort class SOBError(Exception): pass class SOBFlags(IntFlag): SORTED = 1 class SOBFile(MutableSequence): MAGIC =...
null
v6
[ "dict", "Any" ]
Any
def v6(v7: dict, v8): if not isinstance(v7, Mapping): raise ValueError('Object to be saved must be a dictionary') with h5py.File(v8, 'w-') as v9: v0(v9, v7)
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n for (v3, v4) in v2.items():\n if isinstance(v4, Mapping):\n v5 = v1.create_group(v3)\n v0(v5, v4)\n else:\n v1[v3] = v4", "dependenc...
[ "collections", "h5py" ]
[ "import h5py", "from collections.abc import Mapping" ]
5
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import h5py from collections.abc import Mapping import pickle def _dfs...
null
v0
[ "any" ]
str
def v0(v1: any) -> str: v2: str = str(v1) print(f'DEBUG: {v2}') return v2
[]
[]
[]
4
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v0
[]
str
def v0() -> str: v1: list[str] = list() v1.append('Blibdoolpoolp, kuo-toa goddess, [NE], Death, Lobster head or black perl.') v1.append('Laogzed, troglodyte god of hunger, [CE], Death, Image of lizard/toad') v1.append('Grolantor, hill giant god of war, [CE], War, Wooden Club') v1.append('Hruggek, bu...
[]
[ "random" ]
[ "import random" ]
10
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v0
[ "dict" ]
str
def v0(v1: dict) -> str: v2: str = '' for v3 in v1: v4 = v1[v3] if isinstance(v4, type): continue if hasattr(v4, 'hp') and hasattr(v4, 'name'): if getattr(v4, 'hp'): v2 += f'\n;## {v3}: {v4.name}' else: v2 += f'\n;## {v3...
[]
[]
[]
12
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v0
[ "dict" ]
str
def v0(v1: dict) -> str: v2: str = '' v3: list[str] = list() for v4 in v1: v5 = v1[v4] if isinstance(v5, type): continue if hasattr(v5, 'hp') and hasattr(v5, 'name'): if getattr(v5, 'hp'): v2 += f'\n;## {v4}: {v5.name}' else: ...
[]
[]
[]
17
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v2
[ "int", "int" ]
bool
def v2(v3: int, v4: int) -> bool: v5: int = v0(f'1d6x + {v4}') return v5 >= v3
[ { "name": "v0", "input_types": [ "str" ], "output_type": "int", "code": "def v0(v1: str) -> int:\n if v1.strip()[-1] != 't':\n v1 += ' t'\n return max(0, int(dice.roll(f'{v1}')))", "dependencies": [] } ]
[]
[]
3
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v9
[ "int", "int | None" ]
list[str]
def v9(v10: int=1, v11: int | None=None) -> list[str]: if v11 is not None: v12 = random.Random(v11) else: v12 = random.Random() v13: list[str] = list() while len(v13) < v10: v14: str = '; ' + v0(v12) if v14 in v13: continue v13.append(v14) v13.sort...
[ { "name": "v0", "input_types": [ "random.Random | None" ], "output_type": "str", "code": "def v0(v1: random.Random | None=None) -> str:\n if v1 is None:\n v1 = random.Random()\n v2: list[str] = list()\n if v1.randint(1, 100) < 75:\n v3 = v1.randint(1, 3)\n v2....
[ "random" ]
[ "import random" ]
13
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v0
[ "random.Random | None" ]
str
def v0(v1: random.Random | None=None) -> str: if v1 is None: v1 = random.Random() v2: list[str] = list() if v1.randint(1, 100) < 75: v3 = v1.randint(1, 3) v2.append(f'Amulet of Health, Max HP: {v3:+}') v3 = v1.randint(1, 3) v2.append(f'Belt of Might, Warrior: {v3:+}')...
[]
[ "random" ]
[ "import random" ]
172
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v0
[ "random.Random | None" ]
str
def v0(v1: random.Random | None=None) -> str: if v1 is None: v1 = random.Random() v2: list[str] = list() if v1.randint(1, 100) < 75: v3 = v1.randint(1, 3) v2.append(f'Belt of Might, Warrior: {v3:+}') v4 = v1.randint(1, 100) v3 = 1 if v4 < 75 else 2 if v4 < 96 else 3 ...
[]
[ "random" ]
[ "import random" ]
141
import random import dice import jsonpickle import character_sheet from equipment import Armor from equipment import Item from equipment import Money from equipment import Shield from equipment import Weapon from gamebook_core import dice_roll from skills import Difficulty def get_loot(challenge: int) -> list[Item ...
null
v0
[ "str" ]
List[str]
def v0(v1: str) -> List[str]: v1 = re.split('\r?\n\r?', v1) v2 = {str(file) for v3 in v1 if not v3.startswith('!') for v4 in glob(v3, recursive=True)} v5 = {str(v4) for v3 in v1 if v3.startswith('!') for v4 in glob(v3[1:], recursive=True)} return list(v2 - v5)
[]
[ "glob", "re" ]
[ "import re", "from glob import glob" ]
5
import json import logging import os import re from glob import glob from typing import List, Optional, Union import github from urllib3.util.retry import Retry import publish from publish import hide_comments_modes, available_annotations, default_annotations, \ pull_request_build_modes, fail_on_modes, fail_on_mo...
null
v0
[ "Union[str, List[str]]", "str", "str", "Optional[List[str]]" ]
None
def v0(v1: Union[str, List[str]], v2: str, v3: str, v4: Optional[List[str]]=None) -> None: if v1 is None: raise RuntimeError(f'{v3} must be provided via action input or environment variable {v2}') if v4: if isinstance(v1, str): if v1 not in v4: raise RuntimeError(f"Va...
[]
[]
[]
10
import json import logging import os import re from glob import glob from typing import List, Optional, Union import github from urllib3.util.retry import Retry import publish from publish import hide_comments_modes, available_annotations, default_annotations, \ pull_request_build_modes, fail_on_modes, fail_on_mo...
null
v0
[ "Any", "Any", "Any", "str" ]
Any
def v0(self, v1='tt', v2='p100k', v3='atten_position', v4: str=None): v5 = {'two_theta_counter': v1, 'default_roi_name': v2, 'attenuator_counter': v3, 'division_counter': v4} self._import_params.update(v5)
[]
[]
[]
3
import numpy as np from .base_fitter import BaseFitter, reload_scans from .results import FitResult, FitResultSeries from ..models import DefaultTrainedModel from ..xrrloader import FioLoader, NotReflectivityScanError class FioFitter(BaseFitter): @property def file_stem(self): return self._file_name...
null
v0
[ "float", "float", "float", "str", "str" ]
Any
def v0(self, v1: float, v2: float, v3: float, v4: str='gauss', v5: str='max'): v6 = {'wavelength': v1, 'beam_width': v3, 'sample_length': v2, 'beam_shape': v4, 'normalize_to': v5} self._footprint_params.update(v6)
[]
[]
[]
3
from typing import Iterable import numpy as np from .base_fitter import BaseFitter, reload_scans from .results import FitResult, FitResultSeries from ..models import DefaultTrainedModel from ..xrrloader import SpecLoader class SpecFitter(BaseFitter): """Load reflectivity scans from a SPEC file and fit them usin...
null
v0
[]
Dict[str, Any]
def v0(self) -> Dict[str, Any]: v1 = {'username': self.username, 'password_hash': self.password_hash, 'salt': self.salt, 'tokens': self.tokens} if self._id is not None: v1.update({'_id': self._id}) return v1
[]
[]
[]
5
import datetime import hashlib import random import secrets from functools import wraps from typing import Any, Dict, List import jwt import pymongo from flask import request from asch.config import Config class User(): _db = pymongo.MongoClient(Config.get_or_else('database', 'CONNECTION_STRING', None)).asch ...
null
v0
[ "str" ]
bool
def v0(self, v1: str) -> bool: if v1 in (self.tokens or {}): v2 = datetime.datetime.strptime(self.tokens[v1], '%Y-%m-%dT%H:%M:%S.%f') if v2 > datetime.datetime.utcnow(): return True return False
[]
[ "datetime" ]
[ "import datetime" ]
6
import datetime import hashlib import random import secrets from functools import wraps from typing import Any, Dict, List import jwt import pymongo from flask import request from asch.config import Config class User(): _db = pymongo.MongoClient(Config.get_or_else('database', 'CONNECTION_STRING', None)).asch ...
null
v0
[ "pd.DataFrame", "Any", "Any", "Any", "Any", "Any" ]
pd.DataFrame
def v0(v1: pd.DataFrame, v2=None, v3=None, v4='day', v5='value', v6='melt') -> pd.DataFrame: if v6 == 'melt': v1 = pd.melt(v1, id_vars=v2, value_vars=v3, var_name=v4, value_name=v5) elif v6 == 'pivot': v1 = pd.pivot(v1, index=v2, columns=v4, values=v5) v1.reset_index(level=0, inplace=Tru...
[]
[ "pandas" ]
[ "import pandas as pd" ]
7
import pandas as pd def reshaper(df: pd.DataFrame, index_col=None, value_vars=None, var_name = 'day', value_col="value", type = "melt") -> pd.DataFrame: """Reshape data to melt or pivot table format. Parameters ---------- df : DataFrame TODO index_col : str, op...
null
v2
[]
None
def v2(self) -> None: if self._peer_cid_available: self._logger.debug('Retiring CID %s (%d)', v0(self._peer_cid), self._peer_cid_seq) self._retire_connection_ids.append(self._peer_cid_seq) v3 = self._peer_cid_available.pop(0) self._peer_cid_seq = v3.sequence_number self._peer...
[ { "name": "v0", "input_types": [ "bytes" ], "output_type": "str", "code": "def v0(v1: bytes) -> str:\n return binascii.hexlify(v1).decode('ascii')", "dependencies": [] } ]
[ "binascii" ]
[ "import binascii" ]
8
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Tuple from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, BufferReadError, size_uint_var from . import event...
null
v0
[ "Any" ]
int
def v0(self, v1=False) -> int: v2 = int(v1) << 1 | int(not self._is_client) while v2 in self._streams or v2 in self._streams_finished: v2 += 4 return v2
[]
[]
[]
5
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from functools import partial from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Set, Tuple from .. import tls from ..buffer import ( UINT_VAR_MAX, UINT_VAR_MAX_...
null
v0
[]
Optional[events.QuicEvent]
def v0(self) -> Optional[events.QuicEvent]: try: return self._events.popleft() except IndexError: return None
[]
[]
[]
5
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Tuple from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, BufferReadError, size_uint_var from . import event...
null
v4
[ "int", "bytes", "bool" ]
None
def v4(self, v5: int, v6: bytes, v7: bool=False) -> None: if v0(v5) != self._is_client: if v5 not in self._streams: raise ValueError('Cannot send data on unknown peer-initiated stream') if v2(v5): raise ValueError('Cannot send data on peer-initiated unidirectional stream') ...
[ { "name": "v0", "input_types": [ "int" ], "output_type": "bool", "code": "def v0(v1: int) -> bool:\n return not v1 & 1", "dependencies": [] }, { "name": "v2", "input_types": [ "int" ], "output_type": "bool", "code": "def v2(v3: int) -> bool:\n return...
[]
[]
12
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Tuple from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, BufferReadError, size_uint_var from . import event...
null
v0
[ "float" ]
None
def v0(self, v1: float) -> None: assert self._is_client self._close_at = v1 + self._configuration.idle_timeout self._initialize(self._peer_cid.cid) self.tls.handle_message(b'', self._crypto_buffers) self._push_crypto_data()
[]
[]
[]
6
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from functools import partial from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Set, Tuple import time from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, Bu...
null
v0
[ "tls.Epoch" ]
None
def v0(self, v1: tls.Epoch) -> None: if not self._spaces[v1].discarded: self._logger.debug('Discarding epoch %s', v1) self._cryptos[v1].teardown() self._loss.discard_space(self._spaces[v1]) self._spaces[v1].discarded = True
[]
[]
[]
6
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from functools import partial from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Set, Tuple import time from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, Bu...
null
v0
[]
None
def v0(self) -> None: for (v1, v2) in self._crypto_buffers.items(): self._crypto_streams[v1].sender.write(v2.data) v2.seek(0)
[]
[]
[]
4
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from functools import partial from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Set, Tuple from .. import tls from ..buffer import ( UINT_VAR_MAX, UINT_VAR_MAX_...
null
v6
[ "v0" ]
None
def v6(self, v7: v0) -> None: self._logger.debug('%s -> %s', self._state, v7) self._state = v7
[]
[]
[]
3
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Tuple from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, BufferReadError, size_uint_var from . import event...
[ "class v0(Enum):\n v1 = 0\n v2 = 1\n v3 = 2\n v4 = 3\n v5 = 4" ]
v0
[ "bool" ]
None
def v0(self, v1: bool) -> None: if v1: v2 = self._remote_max_stream_data_uni v3 = self._remote_max_streams_uni v4 = self._streams_blocked_uni else: v2 = self._remote_max_stream_data_bidi_remote v3 = self._remote_max_streams_bidi v4 = self._streams_blocked_bidi ...
[]
[]
[]
15
import binascii import logging import os from collections import deque from dataclasses import dataclass from enum import Enum from typing import Any, Deque, Dict, FrozenSet, List, Optional, Sequence, Tuple from .. import tls from ..buffer import UINT_VAR_MAX, Buffer, BufferReadError, size_uint_var from . import event...
null
v0
[ "str" ]
'AssetsCallBuilder'
def v0(self, v1: str) -> 'AssetsCallBuilder': self._add_query_param('asset_issuer', v1) return self
[]
[]
[]
3
from typing import Union from ..call_builder.base_call_builder import BaseCallBuilder from ..client.base_async_client import BaseAsyncClient from ..client.base_sync_client import BaseSyncClient class AssetsCallBuilder(BaseCallBuilder): """ Creates a new :class:`AssetsCallBuilder` pointed to server defined by hor...
null
v0
[ "Dict[str, Any]" ]
Any
def v0(v1: Dict[str, Any], **v2): for (v3, v4) in v2.items(): if v4 is not None: v1.update({v3: v4})
[]
[]
[]
4
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
null
v5
[ "str", "str" ]
Dict[str, Any]
def v5(self, v6: str, v7: str=None) -> Dict[str, Any]: v8 = dict(FeatureGroupName=v6) v0(v8, NextToken=v7) return self.sagemaker_client.describe_feature_group(**v8)
[ { "name": "v0", "input_types": [ "Dict[str, Any]" ], "output_type": "Any", "code": "def v0(v1: Dict[str, Any], **v2):\n for (v3, v4) in v2.items():\n if v4 is not None:\n v1.update({v3: v4})", "dependencies": [] } ]
[]
[]
4
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
null
v0
[ "str", "str", "str", "str", "str" ]
Dict[str, str]
def v0(self, v1: str, v2: str, v3: str, v4: str, v5: str=None) -> Dict[str, str]: v6 = dict(QueryString=v3, QueryExecutionContext=dict(Catalog=v1, Database=v2)) v7 = dict(OutputLocation=v4) if v5: v7.update(EncryptionConfiguration=dict(EncryptionOption='SSE_KMS', KmsKey=v5)) v6.update(ResultConf...
[]
[]
[]
8
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
null
v0
[ "str" ]
Dict[str, Any]
def v0(self, v1: str) -> Dict[str, Any]: v2 = self.boto_session.client('athena', region_name=self.boto_region_name) return v2.get_query_execution(QueryExecutionId=v1)
[]
[]
[]
3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
null
v0
[ "str", "str", "str", "str" ]
Any
def v0(self, v1: str, v2: str, v3: str, v4: str): if self.s3_client is None: v5 = self.boto_session.client('s3', region_name=self.boto_region_name) else: v5 = self.s3_client v5.download_file(Bucket=v1, Key=f'{v2}/{v3}.csv', Filename=v4)
[]
[]
[]
6
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
null
v0
[ "str" ]
str
def v0(self, v1: str) -> str: (v2, v3) = (0, set()) for (v4, v5) in enumerate(v1): if v5 == '(': v2 += 1 elif v5 == ')': if v2 == 0: v3.add(v4) else: v2 -= 1 v6 = [] for (v4, v5) in enumerate(v1[::-1]): if v5 == ...
[]
[]
[]
17
# Time: O(n) # Space: O(n) # 1249 weekly contest 161 11/2/2019 # Given a string s of '(' , ')' and lowercase English characters. # # Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that # the resulting parentheses string is valid and return any valid string. # # Formally,...
null
v0
[ "str" ]
float
def v0(v1: str) -> float: (v2, v3, v4) = v1.split(':') v4 = v4.split('.')[0] return int(v2) + int(v3) / 60 + int(v4) / 3600
[]
[]
[]
4
import glob import json import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import math import os def get_hours(time_str : str) -> float: """Get hours from time.""" h, m, s = time_str.split(':') s = s.split('.')[0] return int(h) + int(m) / 60 + int(s) / 3600 d...
null
v0
[ "Optional[List[str]]" ]
pd.DataFrame
def v0(self, v1: Optional[List[str]]=None) -> pd.DataFrame: if self._index is None: with self._read_file() as v2: v3 = v2['entry'] self._index = pd.DataFrame({'index': v3['entry'][()]}) self._index['index'] = self._index['index'].str.decode('utf-8') self._inde...
[]
[ "pandas" ]
[ "import pandas as pd" ]
12
import abc import distutils import hashlib import pathlib import shutil import tarfile import tempfile import warnings from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Dict, Iterator, List, NoReturn, Optional, Tuple, Union import numpy as np import pandas as pd import h5py from qcelemental....
null
v0
[]
str
def v0(self) -> str: v1 = hashlib.md5() with open(self.db_file_path, 'rb') as v2: for v3 in iter(lambda : v2.read(4096), b''): v1.update(v3) return v1.hexdigest()
[]
[ "hashlib" ]
[ "import hashlib" ]
6
import hashlib import os import platform import re import sqlite3 import subprocess from typing import List, Optional, Tuple from classes import Runner, Commit, Config class Database: def __init__(self, config: Config, final_components_hash: str, bnchmrk_commit_...
null
v0
[ "chex.PRNGKey" ]
Tuple[testbed_base.Data, float]
def v0(self, v1: chex.PRNGKey) -> Tuple[testbed_base.Data, float]: v2 = self._test_sampler(v1, self._tau) return (v2, 0.0)
[]
[]
[]
3
# pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # 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/...
null
v0
[ "Any", "dict" ]
Any
def v0(v1, v2: dict): v3 = plt.Normalize(1, 4) v4 = plt.cm.viridis v5 = plt.figure(figsize=(9, 9)) v6 = v5.add_subplot(111) v7 = v6.scatter(v1[:, 0], v1[:, 1], s=40, cmap=v4, marker='o', linewidths=0.0) for (v8, v9) in v2.items(): v6.annotate(v8, (v1[v9][0], v1[v9][1])) plt.savefig('...
[]
[ "matplotlib" ]
[ "from matplotlib import pyplot as plt" ]
9
# TSNE is just for fun! in order to visualize the clusters import random import torch from MulticoreTSNE import MulticoreTSNE as TSNE from matplotlib import pyplot as plt from util import data_io def plot_tsned(X, ent2id: dict): norm = plt.Normalize(1, 4) cmap = plt.cm.viridis fig = plt.figure(figsiz...
null
v0
[ "Any" ]
Dict[str, str]
def v0(v1) -> Dict[str, str]: v2 = {'username': os.environ.get('ADMIN_USER'), 'password': os.environ.get('ADMIN_PASSWORD')} v3 = requests.post(v1 + 'login/access-token', data=v2) v4 = v3.json() v5 = v4['access_token'] v6 = {'Authorization': f'Bearer {v5}'} return v6
[]
[ "os", "requests" ]
[ "import os", "import requests" ]
7
import os from typing import Dict, Optional import requests from dotenv import load_dotenv from pydantic import BaseSettings, validator from pydantic.networks import AnyHttpUrl SUFFIX: str = "/v1/" def acceptance_superuser_headers(acc_backend_uri) -> Dict[str, str]: login_data = {"username": os.environ.get("ADM...
null
v0
[ "Callable" ]
Any
def v0(self, v1: Callable): v2 = self while v2.next_func is not None: v2 = v2.next_func v2.next_func = v1 return self
[]
[]
[]
6
from typing import Callable import abc class Middleware(abc.ABC): def __init__(self): self.next_func = None def __call__(self, *args, **kwargs): check_passed = self.check(*args, **kwargs) if check_passed and self.next_func: return self.next_func(*args, **kwargs) el...
null
v0
[ "dict", "Any", "bool" ]
None
def v0(self, v1: dict, v2: Any='ERROR', v3: bool=True) -> None: self.json_dict = v1 self.parse_base(v1, v2, v3) self.scrape_timestamp = datetime.datetime.now()
[]
[ "datetime" ]
[ "import datetime" ]
4
from __future__ import annotations from typing import Any import datetime from . import static_scraper from . import json_scraper class LandingPage(static_scraper.StaticHTMLScraper): """ Scraper for the landing page. Attribues --------- url : str Full URL to an existing In...
null
v3
[ "v0" ]
v0
def v3(self, v4: v0) -> v0: if not v4: return None v5 = None v6 = v4 v7 = v4.next while v7: v6.next = v5 v5 = v6 v6 = v7 v7 = v7.next v6.next = v5 return v6
[]
[]
[]
13
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def reverseList(self, head: ListNode) -> ListNode: if not head: return None prev = None curr = head nxt = head...
[ "class v0:\n\n def __init__(self, v1=0, v2=None):\n self.val = v1\n self.next = v2" ]
v0
[]
str
def v0() -> str: v1 = [random.choice(range(0, 256)) for v2 in range(0, 20)] return ''.join([f'{val:02x}' for v3 in v1])
[]
[ "random" ]
[ "import random" ]
3
import random from typing import Callable from decimal import Decimal from hummingbot.client.config.config_var import ConfigVar from hummingbot.client.settings import ( required_exchanges, DEXES, DEFAULT_KEY_FILE_PATH, DEFAULT_LOG_FILE_PATH, ) from hummingbot.client.config.config_validators import ( ...
null
v0
[ "list[list[int]]", "int", "int" ]
list[list[int]]
def v0(self, v1: list[list[int]], v2: int, v3: int) -> list[list[int]]: v4 = len(v1) * len(v1[0]) if v2 * v3 != v4: return v1 v5 = [[0 for v6 in range(v3)] for v6 in range(v2)] v7 = 0 v8 = 0 for v9 in v1: for v10 in v9: v5[v7][v8] = v10 v8 += 1 ...
[]
[]
[]
15
# https://leetcode.com/problems/reshape-the-matrix/ class Solution: def matrixReshape( self, mat: list[list[int]], r: int, c: int) -> list[list[int]]: size = len(mat) * len(mat[0]) if r * c != size: return mat reshaped_mat = [[0 for _ in range(c)] for _ in range(r)] ...
null
v0
[ "Any", "dt.datetime", "dt.datetime" ]
Any
def v0(self, v1, v2: dt.datetime, v3: dt.datetime=None): self.frametime_us = v1.frametime_us self.exposure_us = v1.exposure_us (self.output_roi_upper, self.output_roi_shape) = v1.output_roi self.gain = v1.gain_dB self.start = v2 self.end = v3
[]
[]
[]
7
# Copyright (c) 2020 LightOn, All Rights Reserved. # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this source code package. import datetime as dt import numpy as np from lightonml.internal import types from lightonml.internal.types import Roi, Tuple2D def from_...
null
v0
[ "Any" ]
int
def v0(v1) -> int: v2 = [] v3 = [] v4 = [] v5 = 0 with open(v1, 'r') as v6: v3 = [[int(x) for v7 in line.strip()] for v8 in v6.readlines()] v4 = [[0 for v9 in range(10)] for v2 in range(10)] v10 = [-1, -1, 0, 1, 1, 1, 0, -1] v11 = [0, 1, 1, 1, 0, -1, -1, -1] v...
[]
[]
[]
40
#! python3 # aoc_11.py # Advent of code: # https://adventofcode.com/2021/day/11 # https://adventofcode.com/2021/day/11#part2 # def part_one(input) -> int: rows = [] octo = [] flashed = [] flashes = 0 with open(input, 'r') as inp: #this works octo = ([[int(x) for x in line.strip()] fo...
null
v0
[ "List[Path]" ]
Any
def v0(v1: List[Path]): for v2 in v1: if not v2.exists(): v2.mkdir(mode=493)
[]
[]
[]
4
import datetime import os from pathlib import Path from typing import Any, List, Tuple import pkg_resources from ecostake.util.ssl_check import DEFAULT_PERMISSIONS_CERT_FILE, DEFAULT_PERMISSIONS_KEY_FILE from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.pri...
null
v0
[ "Union[np.ndarray, List[Union[int, float]], List[float], List[Union[str, float]]]" ]
List[str]
def v0(v1: Union[np.ndarray, List[Union[int, float]], List[float], List[Union[str, float]]]) -> List[str]: v1 = np.asarray(v1) with np.errstate(invalid='ignore'): if not is_numeric_dtype(v1) or not np.all(v1 >= 0) or (not np.all(v1 <= 1)): raise ValueError('percentiles should all be in the i...
[]
[ "numpy", "pandas" ]
[ "import numpy as np", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tsli...
19
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v0
[ "Union[np.ndarray, DatetimeArray, Index, DatetimeIndex]" ]
bool
def v0(v1: Union[np.ndarray, DatetimeArray, Index, DatetimeIndex]) -> bool: if not isinstance(v1, Index): v1 = v1.ravel() v1 = DatetimeIndex(v1) if v1.tz is not None: return False v2 = v1.asi8 v3 = v2 != iNaT v4 = 86400 * 1000000000.0 v5 = np.logical_and(v3, v2 % int(v4) != 0...
[]
[ "numpy", "pandas" ]
[ "import numpy as np", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTType", "from pandas._typing import Array...
13
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC import decimal from functools import partial from io import StringIO import math import re from shutil imp...
null
v0
[ "Union[NaTType, Timestamp]", "Optional[tzinfo]", "str" ]
str
def v0(v1: Union[NaTType, Timestamp], v2: Optional[tzinfo]=None, v3: str='NaT') -> str: if v1 is None or (is_scalar(v1) and isna(v1)): return v3 if v2 is not None or not isinstance(v1, Timestamp): if getattr(v1, 'tzinfo', None) is not None: v1 = Timestamp(v1).tz_convert(v2) e...
[]
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
9
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v0
[ "Union[NaTType, Timestamp]", "str", "None" ]
str
def v0(v1: Union[NaTType, Timestamp], v2: str='NaT', v3: None=None) -> str: if v1 is None or (is_scalar(v1) and isna(v1)): return v2 if not isinstance(v1, Timestamp): v1 = Timestamp(v1) if v3: return v1.strftime(v3) else: return v1._date_repr
[]
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
9
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v6
[ "Union[np.ndarray, DatetimeArray, DatetimeIndex]", "Optional[str]" ]
Optional[str]
def v6(v7: Union[np.ndarray, DatetimeArray, DatetimeIndex], v8: Optional[str]) -> Optional[str]: if isinstance(v7, np.ndarray) and v7.ndim > 1: v7 = v7.ravel() v9 = v0(v7) if v9: return v8 or '%Y-%m-%d' return v8
[ { "name": "v0", "input_types": [ "Union[np.ndarray, DatetimeArray, Index, DatetimeIndex]" ], "output_type": "bool", "code": "def v0(v1: Union[np.ndarray, DatetimeArray, Index, DatetimeIndex]) -> bool:\n v1 = v1.ravel()\n v1 = DatetimeIndex(v1)\n if v1.tz is not None:\n retu...
[ "numpy", "pandas" ]
[ "import numpy as np", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tsli...
7
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v3
[ "Union[np.ndarray, TimedeltaIndex, TimedeltaArray]", "str", "bool" ]
Callable
def v3(v4: Union[np.ndarray, TimedeltaIndex, TimedeltaArray], v5: str='NaT', v6: bool=False) -> Callable: v7 = v4.astype(np.int64) v8 = v7 != iNaT v9 = 86400 * 1000000000.0 v10 = np.logical_and(v8, v7 % v9 != 0).sum() == 0 if v10: v11 = None else: v11 = 'long' def v12(v13): ...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n if v1 is None or (is_scalar(v1) and isna(v1)):\n return nat_rep\n if not isinstance(v1, Timedelta):\n v1 = Timedelta(v1)\n v2 = v1._repr_base(format=format)\n if box:\n v...
[ "numpy", "pandas" ]
[ "import numpy as np", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tsli...
20
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v15
[ "List[str]", "str", "Optional[int]", "Optional[v0]" ]
List[str]
def v15(v16: List[str], v17: str='right', v18: Optional[int]=None, v19: Optional[v0]=None) -> List[str]: if len(v16) == 0 or v17 == 'all': return v16 if v19 is None: v19 = v11() v20 = max((v19.len(x) for v21 in v16)) if v18 is not None: v20 = max(v18, v20) v22 = get_option('d...
[ { "name": "v11", "input_types": [], "output_type": "v0", "code": "def v11() -> v0:\n v12 = get_option('display.unicode.east_asian_width')\n if v12:\n return EastAsianTextAdjustment()\n else:\n return v0()", "dependencies": [] }, { "name": "v13", "input_types": ...
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
20
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
[ "class v0:\n\n def __init__(self):\n self.encoding = get_option('display.encoding')\n\n def v1(self, v2: str) -> int:\n return v1(v2)\n\n def v3(self, v4: Any, v5: int, v6: str='right') -> List[str]:\n return v3(v4, v5, mode=v6)\n\n def v7(self, v8: int, *v9, **v10) -> str:\n ...
v7
[ "Union[np.ndarray, List[str]]", "str", "str" ]
List[str]
def v7(v8: Union[np.ndarray, List[str]], v9: str='.', v10: str='NaN') -> List[str]: v11 = v8 def v12(v13): return v13 != v10 and (not v13.endswith('inf')) def v14(v15): v16 = [x for v17 in v15 if v12(v17)] v18 = [v9 in v17 for v17 in v16] return len(v16) > 0 and all(v18) an...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = [x for v3 in v1 if _is_number(v3)]\n v4 = [decimal in v3 for v3 in v2]\n return len(v2) > 0 and all(v4) and all((v3.endswith('0') for v3 in v2)) and (not any(('e' in v3 or 'E' in v3 for v3 ...
[ "decimal" ]
[ "import decimal" ]
13
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v0
[ "Index" ]
bool
def v0(v1: Index) -> bool: if isinstance(v1, ABCMultiIndex): return com.any_not_none(*v1.names) else: return v1.name is not None
[]
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
5
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from datetime import tzinfo import decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_...
null
v0
[ "List[np.int32]", "Union[np.int32, int]" ]
List[int]
def v0(v1: List[np.int32], v2: Union[np.int32, int]) -> List[int]: v3 = 1 v4 = [] v5 = 0 v6 = len(v1) - 1 for (v7, v8) in enumerate(v1): v9 = v8 + v3 v5 += v9 if v6 == v7: v10 = v5 + 1 > v2 and v7 > 0 else: v10 = v5 + 2 > v2 and v7 > 0 ...
[]
[]
[]
17
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ import codecs from contextlib import contextmanager from datetime import tzinfo import decimal from functools import partial from io import StringIO import math import re from shutil import...
null
v0
[ "Any", "Union[bool, object, str]" ]
List[Dict[int, int]]
def v0(v1: Any, v2: Union[bool, object, str]='') -> List[Dict[int, int]]: if len(v1) == 0: return [] v3 = [True] * len(v1[0]) v4 = [] for v5 in v1: v6 = 0 v7 = {} for (v8, v9) in enumerate(v5): if v3[v8] and v9 == v2: pass else: ...
[]
[]
[]
18
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v0
[ "WriteBuffer[str]", "list[str]" ]
None
def v0(v1: WriteBuffer[str], v2: list[str]) -> None: if any((isinstance(x, str) for v3 in v2)): v2 = [str(v3) for v3 in v2] v1.write('\n'.join(v2))
[]
[]
[]
4
""" Internal module for formatting output data in csv, html, xml, and latex files. This module also applies to display formatting. """ from __future__ import annotations from contextlib import contextmanager from csv import ( QUOTE_NONE, QUOTE_NONNUMERIC, ) import decimal from functools import partial from io ...
null
v0
[]
str
def v0(self) -> str: v1 = self.series.name v2 = '' if getattr(self.series.index, 'freq', None) is not None: assert isinstance(self.series.index, (DatetimeIndex, PeriodIndex, TimedeltaIndex)) v2 += f'Freq: {self.series.index.freqstr}' if self.name is not False and v1 is not None: ...
[]
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTType", "from pandas._typing import ArrayLike, CompressionOptions...
27
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC import decimal from functools import partial from io import StringIO import math import re from shutil imp...
null
v26
[ "'DataFrame'" ]
List[str]
def v26(self, v27: 'DataFrame') -> List[str]: v28 = {k: cast(int, v) for (v29, v30) in self.col_space.items()} v31 = v27.index v32 = v27.columns v33 = self._get_formatter('__index__') if isinstance(v31, MultiIndex): v34 = v31.format(sparsify=self.sparsify, adjoin=False, names=self.show_row_i...
[ { "name": "v11", "input_types": [], "output_type": "v0", "code": "def v11() -> v0:\n v12 = get_option('display.unicode.east_asian_width')\n if v12:\n return EastAsianTextAdjustment()\n else:\n return v0()", "dependencies": [] }, { "name": "v13", "input_types": ...
[ "pandas", "typing" ]
[ "from typing import IO, TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, Union, cast", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_...
19
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
[ "class v0:\n\n def __init__(self):\n self.encoding = get_option('display.encoding')\n\n def v1(self, v2: str) -> int:\n return v1(v2)\n\n def v3(self, v4: Any, v5: int, v6: str='right') -> List[str]:\n return v3(v4, v5, mode=v6)\n\n def v7(self, v8: int, *v9, **v10) -> str:\n ...