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
v8
[ "str" ]
Tuple[List[str], List[str]]
async def v8(self, v9: str) -> Tuple[List[str], List[str]]: def v10(v11: LoggingTransaction) -> Tuple[List[str], List[str]]: (v12, v13) = self._get_media_mxcs_in_room_txn(v11, v9) v14 = [] v15 = [] for v16 in v12: v14.append('mxc://%s/%s' % (self.hs.hostname, v16)) ...
[ { "name": "v0", "input_types": [ "LoggingTransaction" ], "output_type": "Tuple[List[str], List[str]]", "code": "def v0(v1: LoggingTransaction) -> Tuple[List[str], List[str]]:\n (v2, v3) = self._get_media_mxcs_in_room_txn(v1, room_id)\n v4 = []\n v5 = []\n for v6 in v2:\n ...
[]
[]
12
# Copyright 2014-2016 OpenMarket Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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 # # U...
null
v3
[ "str", "str" ]
int
async def v3(self, v4: str, v5: str) -> int: def v6(v7: LoggingTransaction) -> int: v8 = self._get_media_ids_by_user_txn(v7, v4) return self._quarantine_media_txn(v7, v8, [], v5) return await self.db_pool.runInteraction('quarantine_media_by_user', v6)
[ { "name": "v0", "input_types": [ "LoggingTransaction" ], "output_type": "int", "code": "def v0(v1: LoggingTransaction) -> int:\n v2 = self._get_media_ids_by_user_txn(v1, user_id)\n return self._quarantine_media_txn(v1, v2, [], quarantined_by)", "dependencies": [] } ]
[]
[]
6
# Copyright 2014-2016 OpenMarket Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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 # # U...
null
v0
[ "Any", "str", "Any" ]
Any
def v0(self, v1, v2: str, v3=True): v4 = '\n SELECT media_id\n FROM local_media_repository\n WHERE user_id = ?\n ' if v3: v4 += 'AND quarantined_by IS NULL' v1.execute(v4, (v2,)) v5 = [row[0] for v6 in v1] return v5
[]
[]
[]
7
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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/li...
null
v0
[ "Any", "List[str]", "List[Tuple[str, str]]", "str" ]
int
def v0(self, v1, v2: List[str], v3: List[Tuple[str, str]], v4: str) -> int: v1.executemany('\n UPDATE local_media_repository\n SET quarantined_by = ?\n WHERE media_id = ? AND safe_from_quarantine = ?\n ', ((v4, media_id, False) for v5 in v2)) v6 = v1.rowcount if v1.rowcou...
[]
[]
[]
6
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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/li...
null
v8
[ "Optional[int]", "Optional[int]", "bool" ]
Dict[str, Dict[str, Optional[int]]]
async def v8(self, v9: Optional[int], v10: Optional[int], v11: bool=False) -> Dict[str, Dict[str, Optional[int]]]: def v12(v13: LoggingTransaction) -> Dict[str, Dict[str, Optional[int]]]: v14 = [] v15 = [] if v9 is not None: v14.append('max_lifetime > ?') v15.append(...
[ { "name": "v0", "input_types": [ "LoggingTransaction" ], "output_type": "Dict[str, Dict[str, Optional[int]]]", "code": "def v0(v1: LoggingTransaction) -> Dict[str, Dict[str, Optional[int]]]:\n v2 = []\n v3 = []\n if min_ms is not None:\n v2.append('max_lifetime > ?')\n ...
[]
[]
30
# Copyright 2014-2016 OpenMarket Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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 # # U...
null
v0
[ "str", "str" ]
None
async def v0(self, v1: str, v2: str) -> None: await self.db_pool.simple_upsert(table='blocked_rooms', keyvalues={'room_id': v1}, values={}, insertion_values={'user_id': v2}, desc='block_room') await self.db_pool.runInteraction('block_room_invalidation', self._invalidate_cache_and_stream, self.is_room_blocked, (...
[]
[]
[]
3
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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/li...
null
v0
[ "wx.TreeEvent" ]
Any
def v0(self, v1: wx.TreeEvent): (v2, v3) = self.ft_filetree.GetItemData(v1.GetItem()) if v2.endswith('/'): self.GetGrandParent().open_filesystem_page(self.ft_filetree.GetItemText(v1.GetItem()), self.rom.filenames[v2]) else: pass
[]
[]
[]
6
import PIL.Image import numpy as np import sounddevice as sd import wx import wx.stc import utility.gdstextscript from formats.filesystem import * from formats.gds import GDS from formats.event import Event from formats.graphics.ani import AniSprite, AniSubSprite from formats.graphics.bg import BGImage from formats.pl...
null
v59
[ "v0", "List[Dict]" ]
Any
def v59(v60: v0, v61: List[Dict]): if v60.mp_config['enabled']: v62 = v60.pool.map(v56, v61) else: v62 = [v56(each_component) for v63 in v61] for v63 in v62: v60.current_components[v63.component_id] = v63
[ { "name": "v56", "input_types": [ "dict" ], "output_type": "Any", "code": "def v56(v57: dict):\n v58 = v57['component'](**v57['params'])\n v58.component_id = v58.component_id + '_' + str(binascii.hexlify(os.urandom(4)))[2:-1] if 'component_id' not in v57 else v57['component_id']\n ...
[ "binascii", "os" ]
[ "import os", "import binascii" ]
7
import os import binascii from typing import List, Optional, Dict, Union from numpy import ndarray from opics.sparam_ops import connect_s from opics.components import componentModel from opics.globals import F import multiprocessing as mp def solve_tasks( data: List, ): """ Simulates a connection, either ...
[ "class v0:\n\n def __init__(self, v1: Optional[str]=None, v2: Optional[ndarray]=None, v3: Dict={'enabled': False, 'proc_count': 0, 'close_pool': False}) -> None:\n self.f = v2\n if self.f is None:\n self.f = F\n self.network_id = v1 if v1 else str(binascii.hexlify(os.urandom(4)))[...
v0
[ "dict" ]
Any
def v0(v1: dict): v2 = v1['component'](**v1['params']) v2.component_id = v2.component_id + '_' + str(binascii.hexlify(os.urandom(4)))[2:-1] if 'component_id' not in v1 else v1['component_id'] return v2
[]
[ "binascii", "os" ]
[ "import os", "import binascii" ]
4
import os import binascii from typing import List, Optional, Dict, Union from numpy import ndarray from opics.sparam_ops import connect_s from opics.components import componentModel from opics.globals import F import multiprocessing as mp def solve_tasks( data: List, ): """ Simulates a connection, either ...
null
v0
[ "int", "List[List[int]]" ]
List[int]
def v0(self, v1: int, v2: List[List[int]]) -> List[int]: v3 = self.current_components.keys() v4 = [each_comp_id for v5 in v3 if v1 in v2[v5]] if len(v4) == 1: v4 += v4 v6 = [] for v7 in v4: v6 += [i for (v8, v9) in enumerate(v2[v7]) if v9 == v1] return [v4[0], v6[0], v4[1], v6[1]...
[]
[]
[]
9
import os import binascii from typing import List, Optional, Dict, Union from numpy import ndarray from opics.sparam_ops import connect_s from opics.components import componentModel from opics.globals import F import multiprocessing as mp def solve_tasks( data: List, ): """ Simulates a connection, either ...
null
v0
[ "int", "bool" ]
Any
def v0(self, v1: int=0, v2: bool=True): if not self.mp_config['enabled']: self.mp_config['enabled'] = True self.mp_config['proc_count'] = v1 self.mp_config['close_pool'] = v2 if self.mp_config['proc_count'] == 0: self.pool = mp.Pool() else: self.pool =...
[]
[ "multiprocessing" ]
[ "import multiprocessing as mp" ]
10
import os import binascii from typing import List, Optional, Dict, Union from numpy import ndarray from opics.sparam_ops import connect_s from opics.components import componentModel from opics.globals import F import multiprocessing as mp def solve_tasks( data: List, ): """ Simulates a connection, either ...
null
v0
[ "int" ]
None
def v0(self, v1: int=0) -> None: self._orientation = v1 self.setFrameShape(self.HLine if v1 == 1 else self.VLine)
[]
[]
[]
3
"""QLine module.""" # -*- coding: utf-8 -*- from PyQt5 import QtWidgets # type: ignore from typing import Optional class QLine(QtWidgets.QFrame): """QLine class.""" _object_name: Optional[str] _orientation: int def __init__(self, parent) -> None: """Inicialize.""" super().__init__(...
null
v0
[ "ndarray" ]
Any
def v0(v1: ndarray): if not v1.size: return False v2 = iter(v1) v3 = next(v2) for v4 in v2: if v3 < v4: v3 = v4 else: return False return True
[]
[]
[]
11
"""Functions for rebinning histogram-like distributions.""" # TODO: DVP: implement propagation in result the indexes computed on shrink # for reuse in FMesh.shrink for equivalent grids or alike from typing import Tuple import collections.abc import gc import itertools import platform import numpy as np from numpy ...
null
v5
[ "np.ndarray", "np.ndarray", "Any", "Any", "Any", "Any" ]
Tuple[np.ndarray, np.ndarray]
def v5(v6: np.ndarray, v7: np.ndarray, v8=None, v9=None, v10=None, v11=False) -> Tuple[np.ndarray, np.ndarray]: if v8 is None and v9 is None: return (v7, v6) if v10 is None: v10 = 0 assert v6.shape[v10] == v7.size - 1 assert v11 or v0(v7) if v8 is None: v8 = v7[0] if v9 i...
[ { "name": "v0", "input_types": [ "ndarray" ], "output_type": "Any", "code": "def v0(v1: ndarray):\n if not v1.size:\n return False\n v2 = iter(v1)\n v3 = next(v2)\n for v4 in v2:\n if v3 < v4:\n v3 = v4\n else:\n return False\n retu...
[ "numpy" ]
[ "import numpy as np", "from numpy import ndarray" ]
30
"""Functions for rebinning histogram-like distributions.""" # TODO: DVP: implement propagation in result the indexes computed on shrink # for reuse in FMesh.shrink for equivalent grids or alike from typing import Tuple import collections.abc import gc import itertools import platform import numpy as np from numpy ...
null
v8
[ "'List[int]'" ]
'List[List[int]]'
def v8(self, v9: 'List[int]') -> 'List[List[int]]': v10 = [] v11 = [] v12 = [0] * len(v9) def v13(v14, v15, v16, v17, v18): v19 = set() if len(v17) == len(v15): return v16.append(deepcopy(v17)) for v20 in range(len(v15)): if v18[v20] == 0 and v15[v20] not...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3, v4, v5):\n v6 = set()\n if len(v4) == len(v2):\n return v3.append(deepcopy(v4))\n for v7 in range(len(v2)):\n if v5[v7] == ...
[ "copy" ]
[ "from copy import deepcopy" ]
19
from copy import deepcopy class Solution: def permuteUnique(self, nums: 'List[int]') -> 'List[List[int]]': ans = [] tmp = [] m = [0] * len(nums) def recursive(i, nums, ans, tmp, m): s = set() if len(tmp) == len(nums): return ans.append(deepcop...
null
v5
[ "v0" ]
bool
def v5(v6: v0) -> bool: v7 = sum((letter == v6.char for v8 in v6.word)) return v6.num1 <= v7 <= v6.num2
[]
[]
[]
3
import re from functools import partial from typing import NamedTuple from aoc.utils import load_data, profiler class Entry(NamedTuple): num1: int num2: int char: str word: str def parse_entry(pattern: re.Pattern, entry: str) -> Entry: num1, num2, char, word = pattern.findall(entry)[0] retu...
[ "class v0(NamedTuple):\n v1: int\n v2: int\n v3: str\n v4: str" ]
v0
[ "List[int]", "bool" ]
Generator[Any, None, None]
def v0(v1: List[int], v2: bool) -> Generator[Any, None, None]: for v3 in v1: if v3 == 5 and v2: raise RuntimeError('Oh no, a batch_fn error has occurred!') yield (v3 * 100)
[]
[]
[]
5
import random from concurrent.futures import Future from typing import Any, Generator, List, Tuple import pytest from vcap.batch_executor import BatchExecutor, _Request @pytest.fixture() def batch_executor(): """To use this fixture, replace batch_executor.batch_fn with your own batch function.""" def b...
null
v0
[ "Tensor", "Any", "int" ]
List[Tensor]
def v0(v1: Tensor, v2: Any, v3: int) -> List[Tensor]: v4 = [torch.zeros_like(v1) for v5 in range(v3)] torch.distributed.all_gather(v4, v1, v2) return v4
[]
[ "torch" ]
[ "import torch", "import torch.nn.functional as F", "from torch import Tensor" ]
4
# 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
v6
[ "Tensor", "Optional[Any]" ]
List[Tensor]
def v6(v7: Tensor, v8: Optional[Any]=None) -> List[Tensor]: if v8 is None: v8 = torch.distributed.group.WORLD v7 = v7.contiguous() v9 = torch.distributed.get_world_size(v8) torch.distributed.barrier(group=v8) if v7.ndim == 0: return v0(v7, v8, v9) v10 = torch.tensor(v7.shape, dev...
[ { "name": "v0", "input_types": [ "Tensor", "Any", "int" ], "output_type": "List[Tensor]", "code": "def v0(v1: Tensor, v2: Any, v3: int) -> List[Tensor]:\n v4 = [torch.zeros_like(v1) for v5 in range(v3)]\n torch.distributed.all_gather(v4, v1, v2)\n return v4", "depe...
[ "torch" ]
[ "import torch", "import torch.nn.functional as F", "from torch import Tensor" ]
27
# 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
[]
bool
def v0(self) -> bool: self.view() return 0
[]
[]
[]
3
from tkinter import Label , Button , Frame , StringVar , Radiobutton from tkinter.constants import TOP , RIGHT , YES from typing import Any import webbrowser as wb from random import randint as rd from typing import TypedDict class State(TypedDict): text: str error : str class Home(): ''' initi...
null
v0
[]
bool
def v0(self) -> bool: v1 = self.choix.get() v2: str = 'config/url/' v3: str = ['Serie', 'Film', 'Manga', 'Torrent'] for v4 in v3: if v4 == v1: self.State['text'] = v4 self.source_file = v2 + v4 + '.url' break try: with open(self.source_file, 'r') a...
[]
[ "random" ]
[ "from random import randint as rd" ]
18
from tkinter import Label , Button , Frame , StringVar , Radiobutton from tkinter.constants import TOP , RIGHT , YES from typing import Any import webbrowser as wb from random import randint as rd from typing import TypedDict class State(TypedDict): text: str error : str class Home(): ''' initi...
null
v3
[]
bool
def v3(self) -> bool: v4 = v0(self.TitleFrame, text='Best Of Web', font=('Courrier', 20), bg=self.BackgroundColor, fg=self.TextColor) v4.pack() v5 = v0(self.TitleFrame, text='Le Meilleur Du Web En Un Clique', font=('Courrier', 9), bg=self.BackgroundColor, fg=self.TextColor) v5.pack() return 0
[ { "name": "v0", "input_types": [ "str" ], "output_type": "bool", "code": "def v0(self, v1: str) -> bool:\n v2 = v0(self.ChoiseFrame, text=v1, font=('Italic', 13), bg=self.BackgroundColor, fg=self.TextColor)\n v2.pack()\n return 0", "dependencies": [] } ]
[]
[]
6
from tkinter import Label , Button , Frame , StringVar , Radiobutton from tkinter.constants import TOP , RIGHT , YES from typing import Any import webbrowser as wb from random import randint as rd from typing import TypedDict class State(TypedDict): text: str error : str class Home(): ''' initi...
null
v0
[ "np.ndarray" ]
np.ndarray
def v0(self, v1: np.ndarray) -> np.ndarray: v2 = v1.size v3 = np.zeros([v2, v2]) for v4 in range(v2): for v5 in range(v2): if self.is_c2 and v4 > v5: v3[v4, v5] = v3[v5, v4] else: try: v3[v4, v5] = self.partial_second_deriva...
[]
[ "numpy" ]
[ "import numpy as np" ]
13
"""Base class implementations for objective functions.""" from abc import ABC, abstractmethod import numpy as np class Function(ABC): """Base class for functions to be optimized using iterative methods. Example: ```python # This is an example for how to build your own Function. class Sum(Functi...
null
v0
[ "str" ]
Any
def v0(v1: str): v2 = [(['miliseconds', 'ms'], 0.001), (['seconds', 's'], 1), (['minutes', 'm'], 60)] for (v3, v4) in v2: if any([v1.endswith(suffix) for v5 in v3]): return int(int(''.join(filter(str.isdigit, v1))) * v4)
[]
[]
[]
5
from elasticsearch_dsl.aggs import AggBase def add_requests_aggs(agg: AggBase): return agg \ .metric('percentiles', 'percentiles', field="stats.response_times", percents=[ 50, 80, 95 ]) \ .metric('requests_count', 'sum', field="stats.num_requests") \ .metric('max_time', 'max', field="stats.max_response...
null
v1
[ "v0" ]
v0
def v1(self, v2: v0) -> v0: try: return v1(v2, self.precision) except TypeError: return complex(v1(v2.real, self.precision), v1(v2.imag, self.precision))
[]
[]
[]
5
from __future__ import annotations # Error Messages error = { 1: "Matrix parameters must be of type array (list, tuple)", 2: "Matrix rows must all have equal length", 3: "Operation requires a square matrix", 4: "Parameter must be of type math (Matrix, int, float, complex)", 5: "Operation requires m...
[ "v0 = (int, float, complex)" ]
v22
[ "str", "str", "str" ]
None
def v22(v23: str, v24: str, v25: str) -> None: v26 = v15(v23, v24, v25) v0(v23, v24, v25, v26['key'], v26['key_id'])
[ { "name": "v0", "input_types": [ "str", "str", "str", "str", "str" ], "output_type": "None", "code": "def v0(v1: str, v2: str, v3: str, v4: str, v5: str) -> None:\n log.debug('Creating Github repository secret.')\n v6 = encrypt_sync_secret(v4, v3)\n v7 = {'...
[ "base64", "json", "requests" ]
[ "import requests", "import json", "from base64 import b64encode" ]
3
import os import sys import logging import requests import json from base64 import b64encode from nacl import encoding, public from pathlib import Path from cryptography.fernet import Fernet from distutils.dir_util import copy_tree from subprocess import Popen, PIPE from github import Github, GithubException from git i...
null
v0
[ "str", "str", "Union[str, bool]" ]
dict
def v0(v1: str, v2: str, v3: Union[str, bool]) -> dict: v4 = f'https://api.github.com/repos/{v1}/{v2}/actions/secrets/public-key' v5 = {'Authorization': f'token {v3}'} v6 = requests.get(v4, headers=v5) return v6.json()
[]
[ "requests" ]
[ "import requests" ]
5
import json import logging import os import sys from base64 import b64encode from distutils.dir_util import copy_tree from pathlib import Path from subprocess import PIPE, Popen from typing import Any, Dict, Optional, Set, Tuple, Union import requests from cryptography.fernet import Fernet from git import Repo, exc fr...
null
v4
[ "dict" ]
None
def v4(v5: dict) -> None: for (v6, v7) in v5.items(): if not isinstance(v7, list): print(f'[bold red]{v6.capitalize()}: {v7}') else: print(f'[bold red]{v6.upper()}: ') v8 = [val if not isinstance(val, dict) and (not isinstance(val, set)) else v0(val) for v9 in v7]...
[ { "name": "v0", "input_types": [ "dict" ], "output_type": "str", "code": "def v0(v1: dict) -> str:\n return '\\n'.join((f' {section.capitalize()}: {description}' for (v2, v3) in v1.items()))", "dependencies": [] } ]
[]
[]
8
import os import sys import logging import requests import json from base64 import b64encode from nacl import encoding, public from pathlib import Path from cryptography.fernet import Fernet from distutils.dir_util import copy_tree from subprocess import Popen, PIPE from github import Github, GithubException from git i...
null
v0
[ "str", "Optional[Any]" ]
Any
def v0(self, v1: str, v2: Optional[Any]='__raise_exception__') -> Any: if v1 not in self.metadata.keys(): if v2 == '__raise_exception__': raise Exception(f"No metadata value '{v1}' for project '{self.project_name}' available. This is a bug in the packaging of this app.") else: ...
[]
[]
[]
8
# -*- coding: utf-8 -*- import copy import importlib import json import logging import os import sys import types from datetime import datetime from types import ModuleType from typing import ( Any, Callable, Coroutine, Dict, Mapping, MutableMapping, Optional, Set, Type, Union, ...
null
v0
[]
str
def v0(self) -> str: for v1 in self.get_pkg_defaults().keys(): if v1.endswith('RESOURCES_FOLDER'): return self.get_pkg_defaults()[v1] raise Exception(f"Can't determine resources folder for '{self.project_name}'.")
[]
[]
[]
5
# -*- coding: utf-8 -*- import copy import importlib import json import logging import os import sys import types from datetime import datetime from types import ModuleType from typing import ( Any, Callable, Coroutine, Dict, Mapping, MutableMapping, Optional, Set, Type, Union, ...
null
v0
[ "Any", "Optional[Type]" ]
None
def v0(self, v1: Any, v2: Optional[Type]=None) -> None: if v2 is not None: if not isinstance(v1, v2) and (not issubclass(v1.__class__, v2)): raise Exception(f"Can't register singleton for class '{v2}': object to register does not sub-class this type.") v3 = v2 else: v3 = v1._...
[]
[]
[]
10
# -*- coding: utf-8 -*- import copy import importlib import json import logging import os import sys import types from datetime import datetime from types import ModuleType from typing import ( Any, Callable, Coroutine, Dict, Mapping, MutableMapping, Optional, Set, Type, Union, ...
null
v0
[]
Dict[str, Any]
def v0(self) -> Dict[str, Any]: v1 = self.find_build_properties() v2: Set[str] = v1['hidden_imports'] v3: Dict[str, MutableMapping[str, Mapping[str, str]]] = {} for (v4, v5) in v1['entry_points'].items(): for (v6, v7) in v5.items(): if v6 in v3.setdefault(v4, {}).keys(): ...
[]
[ "datetime" ]
[ "from datetime import datetime" ]
25
# -*- coding: utf-8 -*- import copy import importlib import json import logging import os import sys import types from datetime import datetime from types import ModuleType from typing import ( Any, Callable, Coroutine, Dict, Mapping, MutableMapping, Optional, Set, Type, Union, ...
null
v4
[ "Callable[..., Coroutine]" ]
Callable
def v4(v5: Callable[..., Coroutine]) -> Callable: @wraps(v5) async def v6(*v7: Any, **v8: Any) -> HTTPResponse: with tempfile.TemporaryDirectory() as v9: return await v5(*v7, temporary_directory=Path(v9), **v8) return v6
[ { "name": "v0", "input_types": [], "output_type": "HTTPResponse", "code": "@wraps(f)\nasync def v0(*v1: Any, **v2: Any) -> HTTPResponse:\n with tempfile.TemporaryDirectory() as v3:\n return await f(*v1, temporary_directory=Path(v3), **v2)", "dependencies": [] } ]
[ "pathlib", "tempfile" ]
[ "import tempfile", "from pathlib import Path" ]
7
import asyncio import concurrent.futures import logging import multiprocessing import os import tempfile import traceback from collections import defaultdict from functools import reduce, wraps from inspect import isawaitable from pathlib import Path from http import HTTPStatus from typing import ( Any, Callabl...
null
v6
[ "List[bool]", "int" ]
int
def v6(v7: List[bool], v8: int) -> int: def v9(v10, v11): (v12, v13) = v10 v14 = (v12 + v13) // 2 return (v14 + 1, v13) if v11 else (v12, v14) (v15, v16) = ft.reduce(v9, v7, (0, v8)) assert v15 == v16 return v15
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n (v3, v4) = v1\n v5 = (v3 + v4) // 2\n return (v5 + 1, v4) if v2 else (v3, v5)", "dependencies": [] } ]
[ "functools" ]
[ "import functools as ft" ]
9
import functools as ft from typing import Callable, IO, Iterable, List def parse(input_file: IO) -> Iterable[List[bool]]: yield from ([x in ['B', 'R'] for x in line.strip()] for line in input_file) def bisect(binary_coordinates: List[bool], upper_bound: int) -> int: def reducer(acc, x): lower, uppe...
null
v10
[ "IO", "Any" ]
Any
def v10(v11: IO, v12=False): v13 = list(v4(v11)) v14 = set(range(v0(v13, min), v0(v13, max) + 1)) - set((v8(row) for v15 in v13)) assert len(v14) == 1 return next(iter(v14))
[ { "name": "v0", "input_types": [ "Iterable[List[bool]]", "Callable[[Iterable[int]], int]" ], "output_type": "int", "code": "def v0(v1: Iterable[List[bool]], v2: Callable[[Iterable[int]], int]) -> int:\n return v2((to_index(row) for v3 in v1))", "dependencies": [ "v8" ...
[]
[]
5
import functools as ft from typing import Callable, IO, Iterable, List def parse(input_file: IO) -> Iterable[List[bool]]: yield from ([x in ['B', 'R'] for x in line.strip()] for line in input_file) def bisect(binary_coordinates: List[bool], upper_bound: int) -> int: def reducer(acc, x): lower, uppe...
null
v0
[ "Tensor", "Tensor" ]
Any
def v0(v1: Tensor, v2: Tensor, **v3): v1 = v1.cpu() v4 = np.argmax(v1, axis=1) return np.mean(v4.numpy() == v2.detach().cpu().numpy())
[]
[ "numpy" ]
[ "import numpy as np" ]
4
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor", "bool" ]
Any
def v0(v1: Tensor, v2: Tensor, v3: bool=True, **v4): if v3: v1 = v1.sigmoid() v1 = v1.cpu() v2 = v2.cpu() v5 = np.argmax(v1, axis=1) v6 = np.argmax(v2, axis=1) return np.mean(v5.numpy() == v6.numpy())
[]
[ "numpy" ]
[ "import numpy as np" ]
8
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor", "float", "bool" ]
Any
def v0(v1: Tensor, v2: Tensor, v3: float=CLASSIFICATION_THRESHOLD, v4: bool=True, **v5): if v4: v1 = v1.sigmoid() return ((v1 > v3) == v2.bool()).float().mean().item()
[]
[]
[]
4
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor", "float", "float", "float", "bool" ]
Any
def v0(v1: Tensor, v2: Tensor, v3: float=0.3, v4: float=2, v5: float=1e-09, v6: bool=True, **v7): v8 = v4 ** 2 if v6: v1 = v1.sigmoid() v1 = (v1 > v3).float() v2 = v2.float() v9 = (v1 * v2).sum(dim=1) v10 = v9 / (v1.sum(dim=1) + v5) v11 = v9 / (v2.sum(dim=1) + v5) v12 = v10 * v11...
[]
[]
[]
11
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor", "float", "float", "float", "bool" ]
Any
def v0(v1: Tensor, v2: Tensor, v3: float=0.3, v4: float=2, v5: float=1e-09, v6: bool=True, **v7): v8 = v4 ** 2 if v6: v1 = v1.sigmoid() v1 = (v1 > v3).float() v2 = v2.float() v9 = (v1 * v2).sum(dim=1) v10 = v9 / (v1.sum(dim=1) + v5) v11 = v9 / (v2.sum(dim=1) + v5) v12 = v10 * v11...
[]
[]
[]
14
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor" ]
Any
def v0(v1: Tensor, v2: Tensor, **v3): v4 = dict() v5 = dict() v6 = dict() v2 = v2.detach().cpu().numpy() v1 = v1.detach().cpu().numpy() (v4['micro'], v5['micro'], v7) = roc_curve(v2.ravel(), v1.ravel()) v6['micro'] = auc(v4['micro'], v5['micro']) return v6['micro']
[]
[ "sklearn" ]
[ "from sklearn.metrics import roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix" ]
9
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor", "bool", "float", "Any" ]
Any
def v0(v1: Tensor, v2: Tensor, v3: bool=True, v4: float=CLASSIFICATION_THRESHOLD, v5=None, **v6): if v3: v1 = v1.sigmoid() v1 = (v1 > v4).float() return hamming_loss(v2, v1, sample_weight=v5)
[]
[ "sklearn" ]
[ "from sklearn.metrics import roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix" ]
5
import numpy as np from torch import Tensor from sklearn.metrics import ( roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix as sklearn_confusion_matrix, ) import pdb import logging logger = logging.getLogger() CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range ...
null
v0
[ "Tensor", "Tensor", "bool", "float", "bool", "Any" ]
Any
def v0(v1: Tensor, v2: Tensor, v3: bool=True, v4: float=CLASSIFICATION_THRESHOLD, v5: bool=True, v6=None): if v3: v1 = v1.sigmoid() v1 = v1.cpu() v2 = v2.cpu() v1 = (v1 > v4).float() return accuracy_score(v2, v1, normalize=v5, sample_weight=v6)
[]
[ "sklearn" ]
[ "from sklearn.metrics import roc_curve, auc, hamming_loss, accuracy_score" ]
7
import numpy as np from torch import Tensor from sklearn.metrics import roc_curve, auc, hamming_loss, accuracy_score import pdb CLASSIFICATION_THRESHOLD: float = 0.5 # Best keep it in [0.0, 1.0] range def accuracy(y_pred: Tensor, y_true: Tensor): y_pred = y_pred.cpu() outputs = np.argmax(y_pred, axis=1) ...
null
v3
[ "Path" ]
None
def v3(self, v4: Path) -> None: def v5(v6: Path) -> Path: v7 = Path().home() v6 = os.path.expandvars(v6) v6 = Path(os.path.normpath(v6)) v6 = v6.expanduser() if v6.is_relative_to(v7): return v6 if v6.is_absolute(): v6 = v6.relative_to(v6.ancho...
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "Path", "code": "def v0(v1: Path) -> Path:\n v2 = Path().home()\n v1 = os.path.expandvars(v1)\n v1 = Path(os.path.normpath(v1))\n v1 = v1.expanduser()\n if v1.is_relative_to(v2):\n return v1\n if v1.is_absol...
[ "os", "pathlib" ]
[ "import os", "from pathlib import Path" ]
16
# -*- coding: utf-8 -*- # Copyright (c) 2022 José Lorenzo Nieto Corral <a.k.a. jlnc> <a.k.a. JoseLo> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without li...
null
v0
[ "Path" ]
Path
def v0(v1: Path) -> Path: v2 = Path().home() v1 = os.path.expandvars(v1) v1 = Path(os.path.normpath(v1)) v1 = v1.expanduser() if v1.is_relative_to(v2): return v1 if v1.is_absolute(): v1 = v1.relative_to(v1.anchor) v1 = v2.joinpath(v1) return v1
[]
[ "os", "pathlib" ]
[ "import os", "from pathlib import Path" ]
11
# -*- coding: utf-8 -*- # Copyright (c) 2022 José Lorenzo Nieto Corral <a.k.a. jlnc> <a.k.a. JoseLo> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without li...
null
v0
[ "int", "int", "List[int]", "Type[nn.Module]", "bool" ]
List[nn.Module]
def v0(v1: int, v2: int, v3: List[int], v4: Type[nn.Module]=nn.ReLU, v5: bool=False) -> List[nn.Module]: if len(v3) > 0: v6 = [nn.Linear(v1, v3[0]), v4()] else: v6 = [] for v7 in range(len(v3) - 1): v6.append(nn.Linear(v3[v7], v3[v7 + 1])) v6.append(v4()) if v2 > 0: ...
[]
[ "torch" ]
[ "import torch as th", "from torch import nn" ]
14
from itertools import zip_longest from typing import Dict, List, Tuple, Type, Union import gym import torch as th from torch import nn from stable_baselines3.common.preprocessing import get_flattened_obs_dim, is_image_space from stable_baselines3.common.utils import get_device from stable_baselines3.common.type_alias...
null
v0
[ "Union[List[int], Dict[str, List[int]]]" ]
Tuple[List[int], List[int]]
def v0(v1: Union[List[int], Dict[str, List[int]]]) -> Tuple[List[int], List[int]]: if isinstance(v1, list): (v2, v3) = (v1, v1) else: assert isinstance(v1, dict), 'Error: the net_arch can only contain be a list of ints or a dict' assert 'pi' in v1, "Error: no key 'pi' was provided in net...
[]
[]
[]
9
from itertools import zip_longest from typing import Dict, List, Tuple, Type, Union import gym import torch as th from torch import nn from stable_baselines3.common.preprocessing import get_flattened_obs_dim, is_image_space from stable_baselines3.common.utils import get_device from stable_baselines3.common.type_alias...
null
v0
[ "torch.Tensor" ]
Tuple[torch.Tensor, torch.Tensor]
def v0(self, v1: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]: v2 = self.fc(v1) return (self.policy_net(v2), self.value_net(v2))
[]
[]
[]
3
from collections import OrderedDict from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple, Type, Union import gym import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from stable_baselines3 import PPO from stable_baselines3.common.policies import ActorCritic...
null
v0
[ "List[str]" ]
int
def v0(self, v1: List[str]) -> int: v2 = ['.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-', '-.--', '--..'] v3 = [chr(i) for v4 in range(97, 123)] v5 = {} for (v6, v7) in zip(v3, v2): ...
[]
[]
[]
13
from typing import List class Solution: def uniqueMorseRepresentations(self, words: List[str]) -> int: morse = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] alphabets = [chr(i) for i...
null
v8
[]
int
def v8() -> int: print('Running `ptr` integration tests (aka run itself)', file=sys.stderr) v9 = Path(gettempdir()) / 'ptr_ci_stats' v10 = ['python', 'ptr.py', '-d', '--print-cov', '--run-disabled', '--error-on-warnings', '--stats-file', str(v9)] if 'VIRTUAL_ENV' in environ: v10.extend(['--venv'...
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "int", "code": "def v0(v1: Path) -> int:\n v2 = 0\n if not v1.exists():\n print('{} stats file does not exist'.format(v1))\n return 68\n try:\n with v1.open('r') as v3:\n v4 = json.load(v3)\n...
[ "json", "os", "pathlib", "subprocess", "sys", "tempfile" ]
[ "import json", "import sys", "from os import environ", "from pathlib import Path", "from subprocess import PIPE, run", "from tempfile import gettempdir" ]
8
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # coding=utf8 """ ptr CI run script - Will either run unittests via 'python setup.py test' OR run pt...
null
v12
[ "bool" ]
int
def v12(v13: bool=False) -> int: v14 = run(('python', '-V'), check=True, stdout=PIPE, universal_newlines=True) print('Using {}'.format(v14.stdout), file=sys.stderr) if v13: print('- Environment:', file=sys.stderr) for v15 in sorted(environ.keys()): print('{}: {}'.format(v15, envi...
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "int", "code": "def v0(v1: Path) -> int:\n v2 = 0\n if not v1.exists():\n print('{} stats file does not exist'.format(v1))\n return 68\n try:\n with v1.open('r') as v3:\n v4 = json.load(v3)\n...
[ "json", "os", "pathlib", "subprocess", "sys", "tempfile" ]
[ "import json", "import sys", "from os import environ", "from pathlib import Path", "from subprocess import PIPE, run", "from tempfile import gettempdir" ]
11
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # coding=utf8 """ ptr CI run script - Will either run unittests via 'python setup.py test' OR run pt...
null
v0
[]
list
def v0() -> list: v1 = [] v2 = '' print("Please enter all sequences that you'd like to add. Undo with 'u', finish with 'e':") while v2.lower() != 'e': v2 = input() if v2.lower() == 'u': v3 = v1[-1] v1 = v1[:-1] print('"{}" Removed'.format(v3)) ...
[]
[]
[]
13
#!/usr/bin/env python # # Copyright (C) 2018 Constantin A. # # 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 ...
null
v0
[ "list" ]
list
def v0(v1: list) -> list: v2 = [] print('Please enter the type of change and (maybe) a small comment.') print("The Default types are:\n\n n - new\n\n n* - new*\n\n g - goo\n\n a - alt\n\n Shortcuts will simply be replaced. If you don't want them to be replaced, place a '\\' in fron...
[]
[]
[]
16
#!/usr/bin/env python # # Copyright (C) 2018 Constantin A. # # 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 ...
null
v0
[ "list" ]
bool
def v0(v1: list) -> bool: print('Please review the sequences before overwriting the CHANGES.md-file:') for v2 in v1: print('U+{0}: {1} \t-\t "{2}"'.format(*v2)) v3 = '' while not v3.lower() in ('n', 'y'): v3 = input('Are you sure you want to add these? [y/n]: ') return v3.lower() == ...
[]
[]
[]
8
#!/usr/bin/env python # # Copyright (C) 2018 Constantin A. # # 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 ...
null
v9
[ "str" ]
list
def v9(v10: str) -> list: with open(v10) as v11: if not '#' in v11.read(128): v11.seek(0) return v11.readlines() else: v11.seek(0) return v0(v11)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "list", "code": "def v0(v1) -> list:\n v2 = []\n for v3 in v1:\n v3 = v3.split('#')[0].strip()\n v3 = v3.split(';')[0].strip()\n if len(v3):\n v4 = v3.split(' ')\n v4 = [c.strip() for ...
[]
[]
8
#!/usr/bin/env python # # Copyright (C) 2018 Constantin A. # # 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 ...
null
v0
[ "Any" ]
list
def v0(v1) -> list: v2 = [] for v3 in v1: v3 = v3.split('#')[0].strip() v3 = v3.split(';')[0].strip() if len(v3): v4 = v3.split(' ') v4 = [c.strip() for v5 in v4 if len(v5.strip())] if len(v4) == 1: v6 = v4[0].split('..') ...
[]
[]
[]
19
#!/usr/bin/env python # # Copyright (C) 2018 Constantin A. # # 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 ...
null
v0
[ "Any" ]
Dict[int, List[Tuple[int, str]]]
def v0(v1) -> Dict[int, List[Tuple[int, str]]]: v2 = defaultdict(int) v3 = defaultdict(int) for v4 in v1.values(): for v5 in v4: v2[v5] += 1 v3[v5.count('1')] += 1 v6 = defaultdict(list) for (v5, v7) in v2.items(): v8 = v3[v5.count('1')] v6[v5.count('1...
[]
[ "collections" ]
[ "from collections import defaultdict" ]
12
# Author: Jose # Python 3.8.1 from typing import Tuple, Dict, List from collections import defaultdict import sys import data.PKDataset def rag_dataset_pattern_extractor(pattern_length=8) -> Dict[int, List[Tuple[int, str]]]: """ Gets the rag dataset onset patterns with their occurrence proportion. The patte...
null
v33
[ "Any", "Any" ]
List[str]
def v33(v34, v35=8) -> List[str]: (v36, v36, v36, v37) = v16(v34) v38 = [] for v39 in v37.values(): v40 = [line[0] if line[1] != -1 else (-line[0][0], -line[0][1]) for v41 in v39] try: v42 = v0(v40, v35) except ValueError: raise v38.append(v42) ret...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "str", "code": "def v0(v1, v2=8) -> str:\n v3 = [abs(note[0]) for v4 in v1]\n v5 = [abs(v4[1]) for v4 in v1]\n v6 = [False if v4[0] >= 0 else True for v4 in v1]\n for v7 in v5:\n if v2 % v7 != 0:\n ...
[]
[]
11
# Author: Jose # Python 3.8.1 from typing import Tuple, Dict, List from collections import defaultdict import sys import data.PKDataset def rag_dataset_pattern_extractor(pattern_length=8) -> Dict[int, List[Tuple[int, str]]]: """ Gets the rag dataset onset patterns with their occurrence proportion. The patte...
null
v0
[ "Any", "Any" ]
str
def v0(v1, v2=8) -> str: v3 = [abs(note[0]) for v4 in v1] v5 = [abs(v4[1]) for v4 in v1] v6 = [False if v4[0] >= 0 else True for v4 in v1] for v7 in v5: if v2 % v7 != 0: raise ValueError('Onsets cannot be evenly divided.') v8 = 0 for v9 in range(len(v3)): v8 += v2 / v...
[]
[]
[]
23
# Author: Jose # Python 3.8.1 from typing import Tuple, Dict, List from collections import defaultdict import sys import data.PKDataset def rag_dataset_pattern_extractor(pattern_length=8) -> Dict[int, List[Tuple[int, str]]]: """ Gets the rag dataset onset patterns with their occurrence proportion. The patte...
null
v21
[ "Any" ]
Dict[int, List[List[int]]]
def v21(v22) -> Dict[int, List[List[int]]]: (v23, v23, v23, v24) = v4(v22) v25 = defaultdict(list) for (v26, v27) in v24.items(): for v28 in v27: v29 = v28[2] if not v25[v26]: v25[v26].append(v29) elif v29 != v25[v26][-1]: v25[v26]....
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "List[int]", "code": "def v0(v1) -> List[int]:\n v2 = []\n for v3 in v1.split('[')[1:]:\n v2.append(int(v3.replace(']', '')))\n return v2", "dependencies": [] }, { "name": "v4", "input_types": [ ...
[ "collections" ]
[ "from collections import defaultdict" ]
11
# Author: Jose # Python 3.8.1 from typing import Tuple, Dict, List from collections import defaultdict import sys import data.PKDataset def rag_dataset_pattern_extractor(pattern_length=8) -> Dict[int, List[Tuple[int, str]]]: """ Gets the rag dataset onset patterns with their occurrence proportion. The patte...
null
v4
[ "Any" ]
Tuple[int, int, int, Dict[int, List]]
def v4(v5) -> Tuple[int, int, int, Dict[int, List]]: with open(v5) as v6: v7 = v0(v6.readline()) v8 = v7[0] v9 = v7[1] v10 = v7[2] v11 = {} v12 = None for v13 in v6: if v13.startswith('=end'): continue elif v13.startswit...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "List[int]", "code": "def v0(v1) -> List[int]:\n v2 = []\n for v3 in v1.split('[')[1:]:\n v2.append(int(v3.replace(']', '')))\n return v2", "dependencies": [] } ]
[]
[]
51
# Author: Jose # Python 3.8.1 from typing import Tuple, Dict, List from collections import defaultdict import sys import data.PKDataset def rag_dataset_pattern_extractor(pattern_length=8) -> Dict[int, List[Tuple[int, str]]]: """ Gets the rag dataset onset patterns with their occurrence proportion. The patte...
null
v0
[ "Any" ]
List[int]
def v0(v1) -> List[int]: v2 = [] for v3 in v1.split('[')[1:]: v2.append(int(v3.replace(']', ''))) return v2
[]
[]
[]
5
# Author: Jose # Python 3.8.1 from typing import Tuple, Dict, List from collections import defaultdict import sys import data.PKDataset def rag_dataset_pattern_extractor(pattern_length=8) -> Dict[int, List[Tuple[int, str]]]: """ Gets the rag dataset onset patterns with their occurrence proportion. The patte...
null
v0
[ "Any" ]
List[bool]
def v0(self, v1) -> List[bool]: v2 = [] for v3 in v1: v2.append(bool(self.check_channel_followed(v3))) return v2
[]
[]
[]
5
from typing import Union, Optional, List from . import base_util from ..util import u_logger as log import discord class Subscription: def __init__(self, sub_id, followed_channels=None): """ :param sub_id: The ID of the subscription. :param followed_channels: The channels subscribed/follo...
null
v0
[ "List[List[int]]", "List[List[int]]" ]
List[List[int]]
def v0(self, v1: List[List[int]], v2: List[List[int]]) -> List[List[int]]: v3 = v4 = 0 v5 = [] while v3 < len(v1) and v4 < len(v2): v6 = max(v1[v3][0], v2[v4][0]) v7 = min(v1[v3][1], v2[v4][1]) if v6 <= v7: v5.append([v6, v7]) if v1[v3][1] > v2[v4][1]: ...
[]
[]
[]
16
""" 986 interval list intersections medium You are given two lists of closed intervals, firstList and secondList, where firstList[i] = [starti, endi] and secondList[j] = [startj, endj]. Each list of intervals is pairwise disjoint and in sorted order. Return the intersection of these two interval lists. A closed in...
null
v0
[ "requests.Response" ]
Optional[Mapping[str, Any]]
def v0(self, v1: requests.Response) -> Optional[Mapping[str, Any]]: v2 = urlparse(v1.request.url) v3 = dict(parse_qsl(v2.query)) v4 = int(v3.get('entriesPerPage', self.page_size)) v5 = int(v3.get('pageNumber', 0)) v6 = v1.json() if v1.status_code == requests.codes.ok and len(v6) == v4: r...
[]
[ "requests", "urllib" ]
[ "from urllib.parse import parse_qsl, urlparse", "import requests", "from requests.auth import AuthBase" ]
8
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # import json import os from abc import ABC, abstractmethod from typing import Any, Iterable, Mapping, MutableMapping, Optional, Union from urllib.parse import parse_qsl, urlparse import pendulum import requests import vcr from airbyte_cdk.sources.streams.htt...
null
v0
[ "Mapping[str, Any]", "Mapping[str, any]", "Mapping[str, Any]" ]
MutableMapping[str, Any]
def v0(self, v1: Mapping[str, Any], v2: Mapping[str, any]=None, v3: Mapping[str, Any]=None) -> MutableMapping[str, Any]: v4 = {'entriesPerPage': self.page_size, 'pageNumber': 1, 'loadCompositeParents': 'true', 'loadVariationParents': 'true', 'dataRequirements': '[0,1,2,3,4,5,6,7,8]', 'searchTypes': '[0,1,2]'} i...
[]
[]
[]
5
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # import json import os from abc import ABC, abstractmethod from typing import Any, Iterable, Mapping, MutableMapping, Optional, Union from urllib.parse import parse_qsl, urlparse import pendulum import requests import vcr from airbyte_cdk.sources.streams.htt...
null
v0
[ "requests.Response" ]
Iterable[Mapping]
def v0(self, v1: requests.Response, **v2) -> Iterable[Mapping]: for v3 in self.paged_result(v1)['Data']: yield v3
[]
[]
[]
3
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # import json import os from abc import ABC, abstractmethod from typing import Any, Iterable, Mapping, MutableMapping, Optional, Union from urllib.parse import parse_qsl, urlparse import pendulum import requests import vcr from airbyte_cdk.sources.streams.htt...
null
v0
[ "requests.Response" ]
Optional[float]
def v0(self, v1: requests.Response) -> Optional[float]: v2 = v1.headers.get('Retry-After') if v2: return int(v2) return None
[]
[]
[]
5
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # from abc import ABC, abstractmethod from datetime import datetime from typing import Any, Iterable, Mapping, MutableMapping, Optional from urllib.parse import parse_qs, urlparse import pendulum as pendulum import requests from airbyte_cdk.sources.streams.h...
null
v0
[ "MutableMapping[str, Any]", "Mapping[str, Any]" ]
Mapping[str, Any]
def v0(self, v1: MutableMapping[str, Any], v2: Mapping[str, Any]) -> Mapping[str, Any]: v3 = v1.get(self.cursor_field, self.epoch_start) v4 = v2.get(self.cursor_field, self.epoch_start) return {self.cursor_field: max(v4, v3)}
[]
[]
[]
4
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # from abc import ABC from typing import Any, Iterable, Mapping, MutableMapping, Optional, Union from urllib.parse import parse_qsl, urlparse import pendulum import requests from airbyte_cdk.sources.streams.http import HttpStream from airbyte_cdk.sources.str...
null
v2
[ "int" ]
v0
def v2(self, v3: int) -> v0: v4 = self.node v5 = 0 v6 = None while v4.next is not None: if v3 == v5: v6 = v4 v4 = v4.next v5 += 1 v4.next = v6 return self.node
[]
[]
[]
11
#!/usr/bin/python3 from typing import List from math import pow class ListNode: def __init__(self, x): self.val = x self.next = None class ListNodeInitialize: def __init__(self, arr: List[int]): if len(arr) == 0: self.node = None else: nodes: List[Li...
[ "class v0:\n\n def __init__(self, v1):\n self.val = v1\n self.next = None" ]
v2
[ "v0" ]
List
def v2(self, v3: v0) -> List: v4 = [] if v3: while v3.next: v4.append(v3.val) v3 = v3.next v4.append(v3.val) return v4
[]
[]
[]
8
#!/usr/bin/python3 from typing import List from math import pow class ListNode: def __init__(self, x): self.val = x self.next = None class ListNodeInitialize: def __init__(self, arr: List[int]): if len(arr) == 0: self.node = None else: nodes: List[Li...
[ "class v0:\n\n def __init__(self, v1):\n self.val = v1\n self.next = None" ]
v0
[ "List[Dict]", "str", "dict" ]
Any
def v0(v1: List[Dict], v2: str, v3: dict): v4 = dict() for v5 in v1[0]: v6 = [state_dict[v5] for v7 in v1] v4[v5] = sum(v6) / len(v6) v3['state_dict'] = v4 torch.save(v3, v2) return v4
[]
[ "torch" ]
[ "import torch" ]
8
import pytz import datetime import os import functools import logging import pandas as pd import pickle import collections import torch import warnings from typing import Optional, List, Any, Dict, Tuple, Union from nptyping import NDArray from omegaconf import OmegaConf, DictConfig from autogluon.core.metrics import g...
null
v0
[ "object" ]
str
def v0(self, v1: object) -> str: if self.config.culture_info is None: return str(v1) return self.config.culture_info.format(v1)
[]
[]
[]
4
from abc import abstractmethod from typing import List, Dict, Pattern, Optional from collections import namedtuple from decimal import Decimal, getcontext import copy import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.culture import Culture from recognizers_text.extractor import Ex...
null
v0
[ "str" ]
str
def v0(self, v1: str) -> str: if v1 is None or not v1.strip(): return v1 for (v2, v3) in self.config.unit_map_chs.items(): v1 = v1.replace(v2, v3) return v1
[]
[]
[]
6
from typing import List, Dict, Pattern, Optional from collections import namedtuple from decimal import Decimal, getcontext import copy import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.culture import Culture from recognizers_text.extractor import ExtractResult from recognizers_te...
null
v0
[ "str" ]
float
def v0(self, v1: str) -> float: v2: float = 0 v3: float = 0.1 for v4 in v1: v2 += v3 * self.config.zero_to_nine_map_chs[v4] v3 *= 0.1 return v2
[]
[]
[]
7
from typing import List, Dict, Pattern, Optional from collections import namedtuple from decimal import Decimal, getcontext import copy import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.culture import Culture from recognizers_text.extractor import ExtractResult from recognizers_te...
null
v0
[ "bool" ]
Any
def v0(self, v1: bool): if self.repo.bare: raise Exception('Given directory {} does not contain valid GIT repository.'.format(self.repo.working_dir)) if not self.branch(self.gitflow.develop): raise Exception('Given repository {} does not contain expected {} branch'.format(self.repo.working_dir, ...
[]
[]
[]
11
import os from abc import ABC, abstractmethod from typing import Optional from git import Repo, Remote, RemoteReference, Commit, Head from git.util import IterableList from gitflow_linter import Gitflow class Repository: def __init__(self, repo: Repo, gitflow: Gitflow, should_fetch=False, allow_dirty=False): ...
null
v0
[ "str" ]
'BasePlugin'
def v0(self, v1: str) -> 'BasePlugin': self.config.set_key('use_' + v1, True, True) v2 = self.get(v1) if v2: return v2 return self.load_plugin(v1)
[]
[]
[]
6
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: self.config.set_key('use_' + v1, False, True) v2 = self.get(v1) if not v2: return self.plugins.pop(v1) v2.close() self.logger.info(f'closed {v1}')
[]
[]
[]
8
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "str" ]
Optional['BasePlugin']
def v0(self, v1: str) -> Optional['BasePlugin']: v2 = self.get(v1) return self.disable(v1) if v2 else self.enable(v1)
[]
[]
[]
3
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "str" ]
'BasePlugin'
def v0(self, v1: str) -> 'BasePlugin': if v1 not in self.plugins: self.load_plugin(v1) return self.plugins[v1]
[]
[]
[]
4
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "Iterable[int]", "'HW_PluginBase'" ]
Any
def v0(self, v1: Iterable[int], *, v2: 'HW_PluginBase'): for v3 in v1: self._recognised_vendor[v3] = v2
[]
[]
[]
3
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "Any" ]
Optional['HardwareClientBase']
def v0(self, v1) -> Optional['HardwareClientBase']: with self.lock: for (v2, (v3, v4)) in self.clients.items(): if v4 == v1: return v2 return None
[]
[]
[]
6
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "Any", "bool" ]
Optional['HardwareClientBase']
def v0(self, v1, *, v2: bool=True) -> Optional['HardwareClientBase']: if v2: self.scan_devices() return self._client_by_id(v1)
[]
[]
[]
4
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v0
[ "'HW_PluginBase'", "Any", "'HardwareHandlerBase'", "Sequence['Device']" ]
Optional['HardwareClientBase']
def v0(self, v1: 'HW_PluginBase', v2, v3: 'HardwareHandlerBase', v4: Sequence['Device']) -> Optional['HardwareClientBase']: v5 = self.xpub_id(v2) v6 = self._client_by_id(v5) if v6: if type(v6.plugin) != type(v1): return v6.handler = v3 return v6 for v7 in v4: ...
[]
[]
[]
11
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
null
v1
[ "str" ]
Optional[v0]
def v1(self: v0, v2: str, *v3: Any, **v4: Any) -> Optional[v0]: v5 = self.data.query(v2, *v3, **v4) if v5.shape[0] == 0: return None return self.__class__(v5)
[]
[]
[]
5
import warnings from functools import lru_cache from pathlib import Path from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union, ) import pandas as pd import pyproj from shapely.geometry import Point, base, mapping from shapely.ops i...
[ "v0 = TypeVar('T', bound='DataFrameMixin')" ]
v19
[ "str", "List[str]", "str", "bool" ]
Union[str, None]
def v19(v20: str, v21: List[str], v22: str, v23: bool=False) -> Union[str, None]: v6(v21, v22) for v24 in v21: v25 = os.path.join(v14(), v12(v24)) if any([f == v20 for v26 in os.listdir(v25)]): return os.path.join(v25, v20) return None
[ { "name": "v0", "input_types": [], "output_type": "Any", "code": "def v0():\n\n def v1(v2, v3, v4):\n os.chmod(v3, stat.S_IWRITE)\n os.remove(v3)\n v5 = os.path.join(typer.get_app_dir('rhasspy_skills'), 'repo')\n if os.path.isdir(v5):\n pass\n shutil.rmtree(v5, o...
[ "os", "shutil", "stat" ]
[ "import os", "import shutil", "import stat" ]
7
import io import json import os import shutil import stat import sys import tarfile import traceback from pathlib import Path from typing import Any, Dict, List, Optional, Union from urllib.parse import urljoin import httpx import typer from click.exceptions import Abort from git import Repo from pydantic import Valid...
null
v0
[ "str" ]
bytes
def v0(v1: str) -> bytes: with io.BytesIO() as v2: with tarfile.open(fileobj=v2, mode='w') as v3: v3.add(v1, arcname='') return v2.getvalue()
[]
[ "io", "tarfile" ]
[ "import io", "import tarfile" ]
5
import io import json import os import shutil import stat import sys import tarfile import traceback from pathlib import Path from typing import Any, Dict, List, Optional, Union from urllib.parse import urljoin import httpx import typer from click.exceptions import Abort from git import Repo from pydantic import Valid...
null
v0
[ "Union[str, List[str]]", "Tuple[int, int]", "Union[str, List[str]]", "int", "int", "bool", "bool", "float", "int", "CountVectorizer" ]
Union[List[Tuple[str, float]], List[List[Tuple[str, float]]]]
def v0(self, v1: Union[str, List[str]], v2: Tuple[int, int]=(1, 1), v3: Union[str, List[str]]='english', v4: int=5, v5: int=1, v6: bool=False, v7: bool=False, v8: float=0.5, v9: int=20, v10: CountVectorizer=None) -> Union[List[Tuple[str, float]], List[List[Tuple[str, float]]]]: if isinstance(v1, str): retur...
[]
[ "warnings" ]
[ "import warnings" ]
6
import warnings warnings.filterwarnings("ignore", category=FutureWarning) import numpy as np from tqdm import tqdm from typing import List, Union, Tuple from sentence_transformers import SentenceTransformer from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectoriz...
null
v0
[ "List[str]", "Tuple[int, int]", "str", "int", "int", "CountVectorizer" ]
List[List[Tuple[str, float]]]
def v0(self, v1: List[str], v2: Tuple[int, int]=(1, 1), v3: str='english', v4: int=5, v5: int=1, v6: CountVectorizer=None) -> List[List[Tuple[str, float]]]: if v6: v7 = v6.fit(v1) else: v7 = CountVectorizer(ngram_range=v2, stop_words=v3, min_df=v5).fit(v1) v8 = v7.get_feature_names() v9 ...
[]
[ "numpy", "sklearn", "tqdm" ]
[ "import numpy as np", "from tqdm import tqdm", "from sklearn.metrics.pairwise import cosine_similarity", "from sklearn.feature_extraction.text import CountVectorizer" ]
20
import warnings warnings.filterwarnings("ignore", category=FutureWarning) import numpy as np from tqdm import tqdm from typing import List, Union, Tuple from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectorizer # KeyBERT from keybert._mmr import mmr from keyber...
null
v0
[ "Any", "Any" ]
str
def v0(v1, v2=None) -> str: v3 = '' if v1: v3 = f'{v1} | ' else: return '' if v2: v3 = f'{v2} :' + v3 return v3
[]
[]
[]
9
""" Current file was autogeneratd by the search_template and the `create_googler_plugins.py` script. In case you find a bug please submit a patch to the aforementioned directories and file instead. """ """Opensubtitles: Search suggestions for Opensubtitles.""" import json import os import shutil import subprocess imp...
null
v0
[ "float" ]
str
def v0(v1: float) -> str: v2 = int(v1 // (24 * 3600)) v3 = int(v1 % (24 * 3600) / 3600) v4 = int(v1 % 3600 / 60) v5 = int(v1 % 60) v6 = '' if v2: v6 += f'{v2} day' + 's' * (v2 != 1) + ' ' if v3 or (v2 and (not v3)): v6 += f'{v3} hour' + 's' * (v3 != 1) + ' ' v6 += f'{v4} ...
[]
[]
[]
13
# -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Module handling auxiliary functions for the framework""" import contextlib import logging import os import pathlib import re import tarfile import typing import zipfile import requests from requests.adapters im...
null
v3
[ "str", "typing.Tuple[str, ...]" ]
typing.List[str]
def v3(v4: str, v5: typing.Tuple[str, ...]=()) -> typing.List[str]: def v6(v7): for v8 in ignore_patterns: if re.match(v8, v7): return True return False if not os.path.exists(v4): return [] v9: typing.Tuple[str, ...] = ('CVS', '.git', '.svn') + v5 v10...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n for v2 in ignore_patterns:\n if re.match(v2, v1):\n return True\n return False", "dependencies": [] } ]
[ "os", "re" ]
[ "import os", "import re" ]
18
# -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Module handling auxiliary functions for the framework""" import contextlib import logging import os import pathlib import re import tarfile import typing import zipfile import requests from requests.adapters im...
null
v3
[]
typing.Dict[str, str]
def v3() -> typing.Dict[str, str]: v4: typing.Dict[str, str] = {} for v5 in ('http_proxy', 'https_proxy', 'ftp_proxy', 'no_proxy'): v6 = os.getenv(v5) if os.getenv(v5) else os.getenv(v5.upper()) if v6: v7 = v0(v6) v4[v5] = v7 v4[v5.upper()] = v7 return v4
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n if not isinstance(v1, str):\n return v1\n v1 = requests.utils.unquote(v1)\n v2 = '\\n ^(?:\\n [\\\\x09\\\\x0A\\\\x0D\\\\x20-\\\\x7E] # ASCII\\n ...
[ "os", "re", "requests" ]
[ "import os", "import re", "import requests", "from requests.adapters import HTTPAdapter", "from requests.packages.urllib3.util.retry import Retry" ]
9
# -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Module handling auxiliary functions for the framework""" import contextlib import logging import os import pathlib import re import tarfile import typing import zipfile import requests from requests.adapters im...
null
v0
[ "str", "str" ]
Any
def v0(v1: str, v2: str): if v1.endswith('tgz'): with tarfile.open(v1, 'r') as v3: v3.extractall(v2) elif v1.endswith('zip'): with zipfile.ZipFile(v1, 'r') as v4: v4.extractall(v2)
[]
[ "tarfile", "zipfile" ]
[ "import tarfile", "import zipfile" ]
7
# -*- coding: utf-8 -*- # Copyright (C) 2019-2020 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Module handling auxiliary functions for the framework""" import contextlib import logging import os import pathlib import re import tarfile import typing import zipfile import requests from requests.adapters im...
null
v0
[ "'ClusterAttributesSerializer'" ]
Any
def v0(self, v1: 'ClusterAttributesSerializer'): if not self.is_cluster_reachable(v1): return None v2 = v1.cluster.context self.local.run(f'HOME={self.home} kubectl config use-context {v2}') v3 = self.local.run(f'HOME={self.home} kubectl cluster-info | head -n 1').stdout.strip() if 'is runni...
[]
[]
[]
8
import os import time import uuid import yaml import invoke from typing import NamedTuple, TYPE_CHECKING from fabric2 import Result from konverge.instance import logging, crayons, InstanceClone, FabricWrapper from konverge.utils import LOCAL, semver_has_patch_suffix from konverge.settings import BASE_PATH, WORKDIR, C...
null
v0
[ "'ClusterAttributesSerializer'" ]
Any
def v0(self, v1: 'ClusterAttributesSerializer'): if not self.cluster_exists(v1): return False v2 = self.local.run(f'HOME={self.home} kubectl cluster-info; echo $?', hide=True) v2 = v2.stdout.split()[-1].strip() return v2 == '0'
[]
[]
[]
6
import os import time import uuid import yaml import invoke from typing import NamedTuple, TYPE_CHECKING from fabric2 import Result from konverge.instance import logging, crayons, InstanceClone, FabricWrapper from konverge.utils import LOCAL, semver_has_patch_suffix from konverge.settings import BASE_PATH, WORKDIR, C...
null
v0
[ "'ClusterAttributesSerializer'" ]
Any
def v0(self, v1: 'ClusterAttributesSerializer'): if not self.is_cluster_reachable(v1): return [] v2 = v1.cluster.context self.local.run(f'HOME={self.home} kubectl config use-context {v2}') v3 = self.local.run(f"HOME={self.home} kubectl get nodes -o jsonpath='{{.items[*].metadata.name}}'", hide=T...
[]
[]
[]
7
import os import time import uuid import yaml import invoke from typing import NamedTuple, TYPE_CHECKING from fabric2 import Result from konverge.instance import logging, crayons, InstanceClone, FabricWrapper from konverge.utils import LOCAL, semver_has_patch_suffix from konverge.settings import BASE_PATH, WORKDIR, C...
null
v2
[ "Union[int, Tuple[int, ...]]" ]
np.ndarray
def v2(self, v3: Union[int, Tuple[int, ...]]) -> np.ndarray: if isinstance(v3, int): assert not self.grouped assert 0 <= v3 v4 = v3 elif isinstance(v3, tuple): assert self.grouped (v5, v6) = v3 assert 0 <= v5 assert 0 <= v6 v4 = self.group_struct[v...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "np.ndarray", "code": "def v0(v1: str) -> np.ndarray:\n if not (v1.endswith('.nii') or v1.endswith('.nii.gz')):\n raise ValueError(f'Nifti file path must end with .nii or .nii.gz, got {v1}.')\n return np.asarray(nib.load...
[ "numpy", "os" ]
[ "import os", "import numpy as np" ]
21
import os from typing import List, Tuple, Union import nibabel as nib import numpy as np from deepreg.dataset.loader.interface import FileLoader from deepreg.dataset.util import get_sorted_file_paths_in_dir_with_suffix from deepreg.registry import REGISTRY DATA_FILE_SUFFIX = ["nii.gz", "nii"] def load_nifti_file(f...
null
v0
[ "dt.Frame", "np.array" ]
Any
def v0(self, v1: dt.Frame, v2: np.array=None, **v3): self.is_train = True v4 = self.fit(v1, v2).transform(v1, is_fit=True) del self.is_train return v4
[]
[]
[]
5
"""Auto ARIMA transformer is a time series transformer that predicts target using ARIMA models.""" # For more information about the python ARIMA package # please visit https://www.alkaline-ml.com/pmdarima/index.html import importlib import numpy as np import pandas as pd import datatable as dt from sklearn.preprocess...
null
v0
[ "dt.Frame", "np.array" ]
Any
def v0(self, v1: dt.Frame, v2: np.array=None): print('auto arima - update history') v1 = v1.to_pandas() v3 = v1[self.tgc].copy() v3['y'] = np.array(v2) v4 = list(np.setdiff1d(self.tgc, self.time_column)) if len(v4) > 0: v5 = v3.groupby(v4) else: v5 = [([None], v3)] for (v...
[]
[ "numpy" ]
[ "import numpy as np" ]
20
"""Parallel Auto ARIMA transformer is a time series transformer that predicts target using ARIMA models. In this implementation, Time Group Models are fitted in parallel""" # For more information about the python ARIMA package # please visit https://www.alkaline-ml.com/pmdarima/index.html # Please note that depending...
null