name
stringclasses
484 values
input_types
listlengths
0
49
output_type
stringlengths
1
180
code
stringlengths
35
97.8k
dependencies
listlengths
0
6
lib_used
listlengths
0
13
imports
listlengths
0
44
line_count
int64
3
192
full_code
stringlengths
51
1M
input_type_defs
listlengths
1
11
v4
[ "int" ]
None
def v4(v5: int) -> None: def v6(v7: int) -> None: v2(v7) v6(v5)
[ { "name": "v0", "input_types": [ "int" ], "output_type": "None", "code": "def v0(v1: int) -> None:\n some_sink(v1)", "dependencies": [ "v2" ] }, { "name": "v2", "input_types": [ "int" ], "output_type": "None", "code": "def v2(v3: int) -> None:...
[]
[]
5
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # flake8: noqa from builtins import _test_sink, _test_source def foo(): def inner(): x = _test_source() _test_sink(x) ...
null
v0
[ "Any" ]
int
async def v0(self, v1) -> int: v2 = self.replicas.service_inboxes(v1) v3 = self.service_replicas_outbox(v1) return v3 + v2
[]
[]
[]
4
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "int" ]
int
async def v0(self, v1: int) -> int: v2 = await self.nodestack.service(v1) await self.processNodeInBox() return v2
[]
[]
[]
4
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "int" ]
int
async def v0(self, v1: int) -> int: v2 = await self.clientstack.service(v1) await self.processClientInBox() return v2
[]
[]
[]
4
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "Any" ]
int
async def v0(self, v1) -> int: if not self.isReady(): return 0 v2 = self.serviceViewChangerOutBox(v1) v3 = await self.serviceViewChangerInbox(v1) v4 = self.view_changer._serviceActions() return v2 + v3 + v4
[]
[]
[]
7
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "Any" ]
int
async def v0(self, v1) -> int: if not self.isReady(): return 0 v2 = self._service_observable_out_box(v1) v3 = await self._observable.serviceQueues(v1) return v2 + v3
[]
[]
[]
6
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "Any" ]
int
async def v0(self, v1) -> int: if not self.isReady(): return 0 return await self._observer.serviceQueues(v1)
[]
[]
[]
4
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "int" ]
int
async def v0(self, v1: int=None) -> int: v2 = 0 while self.msgsToViewChanger and (not v1 or v2 < v1): v2 += 1 v3 = self.msgsToViewChanger.popleft() self.view_changer.inBox.append(v3) await self.view_changer.serviceQueues(v1) return v2
[]
[]
[]
8
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "int", "Any" ]
Any
def v0(self, v1: int, v2: Any): v3 = self.postRecvTxnFromCatchup(v1, v2) if v3: v3.updateState([v2], isCommitted=True) v4 = self.getState(v1) v4.commit(rootHash=v4.headHash) self.updateSeqNoMap([v2]) self._clear_req_key_for_txn(v1, v2)
[]
[]
[]
8
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "Any", "int", "Any" ]
Any
def v0(self, v1, v2: int, v3): v4 = [] for v5 in v1: v4.append(self.requests[v5].finalised) self.apply_reqs(v4, v2, v3)
[]
[]
[]
5
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "Any", "int", "Any" ]
Any
def v0(self, v1, v2: int, v3): for v4 in v1: self.applyReq(v4, v2) v5 = self.stateRootHash(v3, isCommitted=False) self.onBatchCreated(v3, v5)
[]
[]
[]
5
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "Any" ]
bool
def v0(self, v1) -> bool: v2 = self.get_req_handler(txn_type=v1) return v2 and v2.is_query(v1)
[]
[]
[]
3
import json import os import time from binascii import unhexlify from collections import deque from contextlib import closing from functools import partial from typing import Dict, Any, Mapping, Iterable, List, Optional, Set, Tuple, Callable from crypto.bls.bls_key_manager import LoadBLSKeyError from intervaltree impo...
null
v0
[ "List[int]" ]
Any
def v0(v1: List[int]): v2: int = 0 for v3 in v1: v2 = v2 ^ v3 v1.append(v2) return v1
[]
[]
[]
6
from typing import List import datetime from .utils import get_h_m_s # Header is a message header byte CMD_HEADER: int = 0x9A def add_bcc(cmd: List[int]): """Compute BCC (= Block Checking Charactor) and append to command sequence. Returns: list of binary data with BCC code. """ check: in...
null
v0
[ "bytes" ]
dict
def v0(self, v1: bytes) -> dict: self.validate_response(v1) v2 = int.from_bytes(v1[2:6], 'little') v3 = [int.from_bytes(v1[6:8], 'little', signed=True), int.from_bytes(v1[8:10], 'little', signed=True), int.from_bytes(v1[10:12], 'little', signed=True), int.from_bytes(v1[12:14], 'little', signed=True)] v4...
[]
[]
[]
8
from typing import List import datetime from .utils import get_h_m_s # Header is a message header byte CMD_HEADER: int = 0x9A def add_bcc(cmd: List[int]): """Compute BCC (= Block Checking Charactor) and append to command sequence. Returns: list of binary data with BCC code. """ check: in...
null
v24
[ "np.ndarray", "float" ]
Any
def v24(v25: np.ndarray, v26: float=0.5): v27 = v25 > v26 v28 = label(v27) v29 = [] for v30 in regionprops(v28): v31 = v0(v30) if len(v31) > 2: v29.append(geom.Polygon(v31).simplify(10).boundary) return [np.array(v30, dtype=np.uint)[:, [1, 0]].tolist() for v30 in v29]
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = v1.coords\n v3 = np.amax(v2, axis=0)\n v4 = np.zeros((v3[0] + 2, v3[1] + 2))\n v5 = v2[:, 1]\n v6 = v2[:, 0]\n v4[tuple([v6, v5])] = 1\n v7 = 0\n while True:\n v8 = [v...
[ "numpy", "shapely", "skimage" ]
[ "import numpy as np", "import shapely.geometry as geom", "from shapely.ops import nearest_points, unary_union", "from skimage import draw, filters", "from skimage.graph import MCP_Connect", "from skimage.filters import apply_hysteresis_threshold, sobel", "from skimage.measure import approximate_polygon,...
9
# -*- coding: utf-8 -*- # # Copyright 2019 Benjamin Kiessling # # 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 ...
null
v86
[ "PIL.Image.Image", "Sequence[Sequence[Tuple[int, int]]]", "Sequence[Sequence[Tuple[int, int]]]", "np.array", "Tuple[int, int]" ]
Any
def v86(v87: PIL.Image.Image=None, v88: Sequence[Sequence[Tuple[int, int]]]=None, v89: Sequence[Sequence[Tuple[int, int]]]=None, v90: np.array=None, v91: Tuple[int, int]=None): if v91 is not None and (v91[0] > 0 or v91[1] > 0): (v92, v93) = v87.size (v94, v95) = v91 if v94 == 0: ...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3, v4=150):\n v5 = 99999\n (v6, v7) = draw.polygon(v2[:, 1], v2[:, 0])\n (v8, v9) = (int(v2[:, 0].min()), int(v2[:, 0].max()))\n (v10, v11) = (int(v2[...
[ "numpy", "scipy", "shapely", "skimage" ]
[ "import numpy as np", "import shapely.geometry as geom", "from scipy.stats import linregress", "from scipy.ndimage import maximum_filter", "from scipy.ndimage.filters import gaussian_filter", "from scipy.ndimage.morphology import distance_transform_cdt", "from scipy.spatial.distance import cdist, pdist,...
168
# -*- coding: utf-8 -*- # # Copyright 2019 Benjamin Kiessling # # 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 ...
null
v0
[ "Sequence[Tuple[List, List]]", "Union[float, Tuple[float, float]]" ]
Sequence[Tuple[List, List]]
def v0(v1: Sequence[Tuple[List, List]], v2: Union[float, Tuple[float, float]]) -> Sequence[Tuple[List, List]]: if isinstance(v2, float): v2 = (v2, v2) v3 = [] for v4 in v1: v3.append((np.array(v4) * v2).astype('uint').tolist()) return v3
[]
[ "numpy" ]
[ "import numpy as np" ]
7
# -*- coding: utf-8 -*- # # Copyright 2019 Benjamin Kiessling # # 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 ...
null
v0
[ "Sequence[Tuple[List, List]]", "Union[float, Tuple[float, float]]" ]
Sequence[Tuple[List, List]]
def v0(v1: Sequence[Tuple[List, List]], v2: Union[float, Tuple[float, float]]) -> Sequence[Tuple[List, List]]: if isinstance(v2, float): v2 = (v2, v2) v3 = [] for v4 in v1: (v5, v6) = v4 v3.append(((np.array(v5) * v2).astype('int').tolist(), (np.array(v6) * v2).astype('int').tolist()...
[]
[ "numpy" ]
[ "import numpy as np" ]
8
# -*- coding: utf-8 -*- # # Copyright 2019 Benjamin Kiessling # # 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 ...
null
v6
[ "typing.Union[np.ndarray, io.IOBase, str, pathlib.Path]", "Any" ]
np.ndarray
def v6(v7: typing.Union[np.ndarray, io.IOBase, str, pathlib.Path], v8=False) -> np.ndarray: if isinstance(v7, np.ndarray): v9 = np.copy(v7) assert v9.dtype == np.uint8, f'ndarray dtype error: {v9.dtype}' else: v10 = pathlib.Path(v7).suffix.lower() if isinstance(v7, (str, pathlib.Path)) e...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = np.load(str(v1))\n if isinstance(v2, np.lib.npyio.NpzFile):\n if len(v2.files) != 1:\n raise ValueError(f'Image load failed: \"{v1}\" has multiple keys. ({v2.files})')\n ...
[ "numpy", "pathlib", "warnings" ]
[ "import pathlib", "import warnings", "import numpy as np" ]
21
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v6
[ "typing.Union[np.ndarray, io.IOBase, str, pathlib.Path]" ]
typing.Tuple[int, int]
def v6(v7: typing.Union[np.ndarray, io.IOBase, str, pathlib.Path]) -> typing.Tuple[int, int]: if isinstance(v7, np.ndarray): v8 = v7 assert v8.dtype == np.uint8, f'ndarray dtype error: {v8.dtype}' return v8.shape[:2] else: v9 = pathlib.Path(v7).suffix.lower() if isinstance(v7, (s...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = np.load(str(v1))\n if isinstance(v2, np.lib.npyio.NpzFile):\n if len(v2.files) != 1:\n raise ValueError(f'Image load failed: \"{v1}\" has multiple keys. ({v2.files})')\n ...
[ "numpy", "pathlib", "warnings" ]
[ "import pathlib", "import warnings", "import numpy as np" ]
13
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v13
[ "np.ndarray", "float", "Any", "Any", "Any" ]
np.ndarray
def v13(v14: np.ndarray, v15: float, v16=True, v17='lanczos', v18='edge') -> np.ndarray: v19 = {'nearest': cv2.INTER_NEAREST, 'bilinear': cv2.INTER_LINEAR, 'bicubic': cv2.INTER_CUBIC, 'lanczos': cv2.INTER_LANCZOS4}[v17] v20 = {'edge': cv2.BORDER_REPLICATE, 'reflect': cv2.BORDER_REFLECT_101, 'wrap': cv2.BORDER_W...
[ { "name": "v0", "input_types": [ "int", "int", "float", "bool" ], "output_type": "typing.Tuple[np.ndarray, int, int]", "code": "def v0(v1: int, v2: int, v3: float, v4: bool=False) -> typing.Tuple[np.ndarray, int, int]:\n v5 = (v1 // 2, v2 // 2)\n v6 = cv2.getRotatio...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
11
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "int", "int", "float", "bool" ]
typing.Tuple[np.ndarray, int, int]
def v0(v1: int, v2: int, v3: float, v4: bool=False) -> typing.Tuple[np.ndarray, int, int]: v5 = (v1 // 2, v2 // 2) v6 = cv2.getRotationMatrix2D(center=v5, angle=v3, scale=1.0) if v4: v7 = np.abs(v6[0, 0]) v8 = np.abs(v6[0, 1]) v9 = int(np.ceil(v2 * v8 + v1 * v7)) v10 = int(np...
[]
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
12
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v9
[ "np.ndarray", "int", "int", "Any" ]
np.ndarray
def v9(v10: np.ndarray, v11: int, v12: int, v13='edge') -> np.ndarray: assert v11 >= 0 assert v12 >= 0 v14 = max(0, (v11 - v10.shape[1]) // 2) v15 = max(0, (v12 - v10.shape[0]) // 2) v16 = v11 - v10.shape[1] - v14 v17 = v12 - v10.shape[0] - v15 v10 = v0(v10, v14, v15, v16, v17, v13) asse...
[ { "name": "v0", "input_types": [ "np.ndarray", "int", "int", "int", "int", "Any" ], "output_type": "Any", "code": "def v0(v1: np.ndarray, v2: int, v3: int, v4: int, v5: int, v6='edge'):\n assert v2 >= 0 and v3 >= 0 and (v4 >= 0) and (v5 >= 0)\n assert v6...
[ "numpy" ]
[ "import numpy as np" ]
10
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "np.ndarray", "int", "int", "int", "int", "Any" ]
Any
def v0(v1: np.ndarray, v2: int, v3: int, v4: int, v5: int, v6='edge'): assert v2 >= 0 and v3 >= 0 and (v4 >= 0) and (v5 >= 0) assert v6 in ('edge', 'zero', 'half', 'one', 'reflect', 'wrap', 'mean') v7 = {} if v6 == 'zero': v8 = 'constant' elif v6 == 'half': v8 = 'constant' v7...
[]
[ "numpy" ]
[ "import numpy as np" ]
19
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v34
[ "np.ndarray", "int", "Any", "Any" ]
np.ndarray
def v34(v35: np.ndarray, v36: int, v37=True, v38='lanczos') -> np.ndarray: (v39, v40) = v35.shape[:2] if not v37 and max(v40, v39) <= v36: return v35 if v40 >= v39: return v20(v35, v36, v39 * v36 // v40, interp=v38) else: return v20(v35, v40 * v36 // v39, v36, interp=v38)
[ { "name": "v0", "input_types": [ "np.ndarray" ], "output_type": "np.ndarray", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1: np.ndarray) -> np.ndarray:\n if v1.ndim == 2:\n return np.expand_dims(v1, axis=-1)\n assert v1.ndim == 3, str(v1.shape)\n return v1", ...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
8
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "np.ndarray", "np.random.RandomState", "float" ]
np.ndarray
def v2(v3: np.ndarray, v4: np.random.RandomState, v5: float) -> np.ndarray: v3 = v3 + v4.normal(0, v5, size=v3.shape).astype(np.float32) return v0(v3)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1):\n return np.minimum(np.maximum(v1, 0), 255).astype(np.uint8)", "dependencies": [] } ]
[ "numpy" ]
[ "import numpy as np" ]
3
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "np.ndarray", "float" ]
np.ndarray
def v2(v3: np.ndarray, v4: float) -> np.ndarray: v3 = cv2.GaussianBlur(v3, (5, 5), v4) v3 = v0(v3) return v3
[ { "name": "v0", "input_types": [ "np.ndarray" ], "output_type": "np.ndarray", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1: np.ndarray) -> np.ndarray:\n if v1.ndim == 2:\n return np.expand_dims(v1, axis=-1)\n assert v1.ndim == 3, str(v1.shape)\n return v1", ...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
4
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v7
[ "np.ndarray", "float", "Any" ]
np.ndarray
def v7(v8: np.ndarray, v9: float, v10=2.0) -> np.ndarray: v8 = v3(v8) v11 = v0(v8, v9) v8 = v8.astype(np.float32) v8 = v8 + (v8 - v11) * v10 return v5(v8)
[ { "name": "v0", "input_types": [ "np.ndarray", "float" ], "output_type": "np.ndarray", "code": "def v0(v1: np.ndarray, v2: float) -> np.ndarray:\n v1 = cv2.GaussianBlur(v1, (5, 5), v2)\n v1 = ensure_channel_dim(v1)\n return v1", "dependencies": [ "v3" ] }, ...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
6
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "np.ndarray", "int" ]
np.ndarray
def v2(v3: np.ndarray, v4: int) -> np.ndarray: v3 = cv2.medianBlur(v3, v4) v3 = v0(v3) return v3
[ { "name": "v0", "input_types": [ "np.ndarray" ], "output_type": "np.ndarray", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1: np.ndarray) -> np.ndarray:\n if v1.ndim == 2:\n return np.expand_dims(v1, axis=-1)\n assert v1.ndim == 3, str(v1.shape)\n return v1", ...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
4
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "np.ndarray" ]
np.ndarray
def v2(v3: np.ndarray) -> np.ndarray: v3 = v3.astype(np.float32) v4 = np.mean(v3, axis=-1, keepdims=True) v5 = np.expand_dims(cv2.equalizeHist(v4.astype(np.uint8)), axis=-1) v3 = v3 + (v5 - v4) return v0(v3)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1):\n return np.minimum(np.maximum(v1, 0), 255).astype(np.uint8)", "dependencies": [] } ]
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
6
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "np.ndarray", "Any" ]
np.ndarray
def v2(v3: np.ndarray, v4=255) -> np.ndarray: v3 = v3.astype(np.float32) v5 = np.mean(v3, axis=-1) (v6, v7) = (v5.min(), v5.max()) if v6 < v7: v3 = (v3 - v6) * (v4 / (v7 - v6)) return v0(v3)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1):\n return np.minimum(np.maximum(v1, 0), 255).astype(np.uint8)", "dependencies": [] } ]
[ "numpy" ]
[ "import numpy as np" ]
7
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "np.ndarray", "Any" ]
np.ndarray
def v2(v3: np.ndarray, v4) -> np.ndarray: assert v4 in range(1, 8) v5 = np.float32(2 ** v4 / 255) return v0(np.round(v3.astype(np.float32) * v5) / v5)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1):\n return np.minimum(np.maximum(v1, 0), 255).astype(np.uint8)", "dependencies": [] } ]
[ "numpy" ]
[ "import numpy as np" ]
4
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v43
[ "np.ndarray", "int", "int", "bool", "bool", "float", "float", "float", "float", "float", "float", "float", "str", "str" ]
np.ndarray
def v43(v44: np.ndarray, v45: int, v46: int, v47: bool=False, v48: bool=False, v49: float=0, v50: float=1.0, v51: float=1.0, v52: float=0.5, v53: float=0.5, v54: float=0.0, v55: float=0.0, v56: str='lanczos', v57: str='edge') -> np.ndarray: v58 = v0(v44.shape[1], v44.shape[0], v45, v46, flip_h=v47, flip_v=v48, degr...
[ { "name": "v0", "input_types": [ "int", "int", "int", "int", "bool", "bool", "float", "float", "float", "float", "float", "float", "float" ], "output_type": "np.ndarray", "code": "def v0(v1: int, v2: int, v3: int, v4: ...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
4
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "int", "int", "int", "int", "bool", "bool", "float", "float", "float", "float", "float", "float", "float" ]
np.ndarray
def v0(v1: int, v2: int, v3: int, v4: int, v5: bool=False, v6: bool=False, v7: float=0, v8: float=1.0, v9: float=1.0, v10: float=0.5, v11: float=0.5, v12: float=0.0, v13: float=0.0) -> np.ndarray: v14 = np.array([[0, 0], [1, 0], [1, 1], [0, 1]], dtype=np.float32) v15 = np.array([[0, 0], [1, 0], [1, 1], [0, 1]],...
[]
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
23
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v5
[ "np.ndarray", "int", "int", "np.ndarray", "str", "str" ]
np.ndarray
def v5(v6: np.ndarray, v7: int, v8: int, v9: np.ndarray, v10: str='lanczos', v11: str='edge') -> np.ndarray: v12 = {'nearest': cv2.INTER_NEAREST, 'bilinear': cv2.INTER_LINEAR, 'bicubic': cv2.INTER_CUBIC, 'lanczos': cv2.INTER_LANCZOS4}[v10] (v13, v14) = {'edge': (cv2.BORDER_REPLICATE, None), 'reflect': (cv2.BORD...
[ { "name": "v0", "input_types": [ "np.ndarray" ], "output_type": "np.ndarray", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1: np.ndarray) -> np.ndarray:\n if v1.ndim == 2:\n return np.expand_dims(v1, axis=-1)\n assert v1.ndim == 3, str(v1.shape)\n return v1", ...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
19
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "np.ndarray", "np.ndarray" ]
np.ndarray
def v0(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: v1 = np.asarray(v1) return cv2.perspectiveTransform(v1.reshape((-1, 1, 2)).astype(np.float32), v2).reshape(v1.shape)
[]
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
3
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v2
[ "Any", "np.random.RandomState", "Any", "Any", "Any", "Any", "Any", "Any", "Any" ]
Any
def v2(v3, v4: np.random.RandomState, v5=None, v6=0.02, v7=0.4, v8=1 / 3, v9=3, v10=None, v11=30): if v5 is not None: v12 = v5[:, :2] v13 = v5[:, 2:] v14 = v5[:, (0, 3)] v15 = v5[:, (1, 2)] v16 = (v12 + v13) / 2 for v17 in range(v11): v18 = v3.shape[0] * v3.shape[...
[ { "name": "v0", "input_types": [ "np.ndarray" ], "output_type": "np.ndarray", "code": "@numba.njit(fastmath=True, nogil=True)\ndef v0(v1: np.ndarray) -> np.ndarray:\n if v1.ndim == 2:\n return np.expand_dims(v1, axis=-1)\n assert v1.ndim == 3, str(v1.shape)\n return v1", ...
[ "numpy" ]
[ "import numpy as np" ]
36
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v8
[ "v0", "v0", "str", "Any" ]
v0
def v8(v9: v0, v10: v0, v11: str='beta', v12=0.2) -> v0: if v11 == 'beta': v13 = np.float32(np.abs(random.betavariate(v12, v12) - 0.5) + 0.5) elif v11 == 'uniform': v13 = np.float32(random.uniform(0.5, 1)) elif v11 == 'uniform_ex': v13 = np.float32(random.uniform(0.5, np.sqrt(2))) ...
[ { "name": "v1", "input_types": [ "Any", "Any", "np.float32" ], "output_type": "Any", "code": "def v1(v2, v3, v4: np.float32):\n if v2 is None:\n assert v3 is None\n return None\n elif isinstance(v2, tuple):\n assert isinstance(v3, tuple)\n asse...
[ "numpy", "random" ]
[ "import random", "import numpy as np" ]
11
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
[ "v0 = typing.TypeVar('T')" ]
v7
[ "typing.Tuple[np.ndarray, np.ndarray]", "typing.Tuple[np.ndarray, np.ndarray]", "float" ]
typing.Tuple[np.ndarray, np.ndarray]
def v7(v8: typing.Tuple[np.ndarray, np.ndarray], v9: typing.Tuple[np.ndarray, np.ndarray], v10: float=1.0) -> typing.Tuple[np.ndarray, np.ndarray]: (v11, v12) = v8 (v13, v14) = v9 assert v11.shape == v13.shape v15 = random.betavariate(v10, v10) (v16, v17) = v11.shape[:2] v18 = np.sqrt(1.0 - v15)...
[ { "name": "v0", "input_types": [ "Any", "Any", "np.float32" ], "output_type": "Any", "code": "def v0(v1, v2, v3: np.float32):\n if v1 is None:\n assert v2 is None\n return None\n elif isinstance(v1, tuple):\n assert isinstance(v2, tuple)\n asse...
[ "numpy", "random" ]
[ "import random", "import numpy as np" ]
19
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "np.ndarray", "np.ndarray", "bool" ]
np.ndarray
def v0(v1: np.ndarray, v2: np.ndarray, v3: bool=False) -> np.ndarray: v4 = len(v2) + (1 if v3 else 0) v5 = np.zeros((v1.shape[0], v1.shape[1], v4), np.float32) for (v6, v7) in enumerate(v2): v5[np.all(v1 == v7, axis=-1), v6] = 1 if v3: v5[:, :, -1] = 1 - v5[:, :, :-1].sum(axis=-1) re...
[]
[ "numpy" ]
[ "import numpy as np" ]
8
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "np.ndarray", "np.ndarray", "int" ]
np.ndarray
def v0(v1: np.ndarray, v2: np.ndarray, v3: int=None) -> np.ndarray: if v3 is None: v3 = len(v2) v4 = np.empty(v1.shape[:2], dtype=np.int32) v4[:] = v3 for (v5, v6) in enumerate(v2): v4[np.all(v1 == v6, axis=-1)] = v5 return v4
[]
[ "numpy" ]
[ "import numpy as np" ]
8
"""主にnumpy配列(rows×cols×channels(RGB))の画像処理関連。 uint8のRGBで0~255として扱うのを前提とする。 あとグレースケールの場合もrows×cols×1の配列で扱う。 """ import io import pathlib import random import typing import warnings import cv2 import numba import numpy as np import PIL.Image import PIL.ImageOps def load( path_or_array: typing.Union[np.ndarray, io...
null
v0
[ "Any", "int" ]
list
def v0(v1, v2: int) -> list: v3 = [{'$project': {'_id': 1}}, {'$sample': {'size': v2}}] return [s['_id'] for v4 in v1.aggregate(v3)]
[]
[]
[]
3
import json import pandas as pd from mongoengine import QuerySet import os from src.db.connection import connect_to_mongo from src.db.schemes import Tweets def query_set_to_df(input_data: QuerySet) -> pd.DataFrame: """Transforms a mongoengine QuerySet into a DataFrame :param input_data: The query set that ...
null
v2
[ "int" ]
Callable[[Callable], Callable]
def v2(v3: int) -> Callable[[Callable], Callable]: def v4(v5): v5.__oneflow_test_case_num_nodes_required__ = v3 return v5 return v4
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v1.__oneflow_test_case_num_nodes_required__ = num_nodes\n return v1", "dependencies": [] } ]
[]
[]
6
""" Copyright 2020 The OneFlow Authors. 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/LICENSE-2.0 Unless required by applicable law or agr...
null
v10
[ "Any", "Any" ]
bytes
def v10(v11, v12) -> bytes: v11 = zlib.compress(v11) return v11[0:8] + v5(v11[8:], v12)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = hashlib.sha256()\n v2.update(v1)\n v3 = v2.digest()\n while v3:\n for v4 in v3:\n yield v4\n v2.update(v3)\n v3 = v2.digest()", "dependencies": [] }...
[ "hashlib", "zlib" ]
[ "import zlib", "import hashlib" ]
3
#!/usr/bin/env python3 import zlib import hashlib def encrypt(data, key) -> bytes: data = zlib.compress(data) return data[0:8] + xor_strings(data[8:], key) def decrypt(data, key) -> bytes: res = xor_strings(data[8:], key) return zlib.decompress(data[0:8] + res) def xor_strings(data, key) -> bytes: ...
null
v10
[ "Any", "Any" ]
bytes
def v10(v11, v12) -> bytes: v13 = v5(v11[8:], v12) return zlib.decompress(v11[0:8] + v13)
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = hashlib.sha256()\n v2.update(v1)\n v3 = v2.digest()\n while v3:\n for v4 in v3:\n yield v4\n v2.update(v3)\n v3 = v2.digest()", "dependencies": [] }...
[ "hashlib", "zlib" ]
[ "import zlib", "import hashlib" ]
3
#!/usr/bin/env python3 import zlib import hashlib def encrypt(data, key) -> bytes: data = zlib.compress(data) return data[0:8] + xor_strings(data[8:], key) def decrypt(data, key) -> bytes: res = xor_strings(data[8:], key) return zlib.decompress(data[0:8] + res) def xor_strings(data, key) -> bytes: ...
null
v0
[ "int" ]
int
def v0(self, v1: int) -> int: if v1 == 1: return 5 v2 = [1, 1, 1, 1, 1] v3 = 5 while v1 > 1: v4 = [v3] for v5 in range(4): v4.append(v4[-1] - v2[v5]) v3 = sum(v4) v2 = v4 v1 -= 1 return v3
[]
[]
[]
13
class Solution: def countVowelStringsMath(self, n: int) -> int: """ Mathematical approach Space : O(1) Time : O(1) """ return (n + 1) * (n + 2) * (n + 3) * (n + 4) // 24 def countVowelStringsDP(self, n: int) -> int: """ DP approach Sp...
null
v0
[ "Optional[Union[str, Path, UUID]]", "Any" ]
Union[List, Dict[str, str]]
def v0(self, v1: Optional[Union[str, Path, UUID]]=None, v2=False) -> Union[List, Dict[str, str]]: if not v1: return [x['name'] for v3 in self.alyx.rest('dataset-types', 'list')] v4 = self.alyx.rest('datasets', 'list', session=v1, exists=True) if not v2: v4 = sorted([Path(dset['collection'])....
[]
[ "pathlib" ]
[ "from pathlib import Path, PurePath" ]
7
import abc import concurrent.futures import json import logging import os import fnmatch import re from functools import wraps from pathlib import Path, PurePath from typing import Any, Sequence, Union, Optional, List, Dict from uuid import UUID import requests import tqdm import pandas as pd import numpy as np impor...
null
v13
[ "Mapping[str, Any]", "Any", "Any" ]
Dict[str, Any]
def v13(v14: Mapping[str, Any], v15, v16=None) -> Dict[str, Any]: v17 = list(v14.keys()) v18 = OrderedDict() v19 = OrderedDict() for v20 in v17: v21 = v14[v20] if not torch.is_tensor(v21): v18[v20] = torch.tensor(v21, dtype=torch.double) elif v21.device.type != v15.ty...
[ { "name": "v0", "input_types": [ "OrderedDict" ], "output_type": "Any", "code": "def v0(v1: OrderedDict):\n if len(v1) == 0:\n return v1\n v2 = torch.cat([t.view(-1) for v3 in v1.values()]).to(device=device)\n all_reduce(v2, group=group)\n v4 = torch.split(v2, [v3.numel(...
[ "collections", "torch" ]
[ "from collections import OrderedDict", "import torch", "import torch.distributed as dist" ]
31
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import pickle import random import socket import struct import subprocess import warnings from collections import Ord...
null
v0
[]
int
def v0(self) -> int: while self._last_updated: self._step()
[]
[]
[]
3
import enum from typing import List, Tuple import utils class Seat(enum.Enum): EMPTY = "L" OCCUPIED = "#" FLOOR = "." class Map: MAX_OCCUPIED = 4 def __init__(self, seats: List[str]): self._width = len(seats[0]) self._height = len(seats) self._seats = ...
null
v0
[ "str" ]
Optional['joueur.base_game_object.BaseGameObject']
def v0(self, v1: str) -> Optional['joueur.base_game_object.BaseGameObject']: if v1 in self.game_objects: return self.game_objects[v1]
[]
[]
[]
3
from typing import Optional from joueur.delta_mergeable import DeltaMergeable # @class BaseGame: the basics of any game class BaseGame(DeltaMergeable): def __init__(self): DeltaMergeable.__init__(self) def get_game_object(self, id: str) -> Optional['joueur.base_game_object.BaseGameObject']: "...
null
v0
[ "Any", "float", "float" ]
torch.FloatTensor
def v0(v1, v2: float=0, v3: float=1) -> torch.FloatTensor: v4 = (v1.detach() - v2).clamp(max=0) v5 = (v1.detach() - v3).clamp(min=0) return v1 - v5 - v4
[]
[]
[]
4
import torch import torch.distributed as dist import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import time import torch.utils.checkpoint as checkpoint import sparse import sys import os import socket import util import construct_model def hard_aggregate(V, V_up, lower=True): '...
null
v0
[]
None
def v0(self) -> None: self._finished = True self._sub.close() self._client.close()
[]
[]
[]
4
import logging from time import sleep from typing import Tuple import redis from ding.framework.message_queue.mq import MQ from ding.utils import MQ_REGISTRY @MQ_REGISTRY.register("redis") class RedisMQ(MQ): def __init__(self, redis_host: str, redis_port: int, **kwargs) -> None: """ Overview: ...
null
v0
[ "Path", "str" ]
np.ndarray
def v0(v1: Path, v2: str) -> np.ndarray: v3 = next(v1.glob('*' + v2 + '_B4*')) v4 = next(v1.glob('*' + v2 + '_B3*')) v5 = next(v1.glob('*' + v2 + '_B2*')) v6 = np.stack([np.array(load_img(v3, color_mode='grayscale')), np.array(load_img(v4, color_mode='grayscale')), np.array(load_img(v5, color_mode='gray...
[]
[ "numpy", "tensorflow" ]
[ "import numpy as np", "import tensorflow as tf", "from tensorflow import keras", "from tensorflow.keras.preprocessing.image import load_img" ]
6
""" Get evaluation metrics for given model on L8CCA dataset. If you plan on using this implementation, please cite our work: @INPROCEEDINGS{Grabowski2021IGARSS, author={Grabowski, Bartosz and Ziaja, Maciej and Kawulok, Michal and Nalepa, Jakub}, booktitle={IGARSS 2021 - 2021 IEEE International Geoscience and Remote Se...
null
v0
[ "argparse.ArgumentParser" ]
None
def v0(v1: argparse.ArgumentParser) -> None: v1.add_argument('-a', '--abspath', action='store_true', default=False, help='print absolute paths (default: relative to sourcedir)') v1.add_argument('--begin', help='begin from this image (relative to sourcedir)') v1.add_argument('--end', help='end to this image ...
[]
[]
[]
6
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import json import argparse from typing import Any, Dict from . import utils def get_argparser_args() -> Dict[str, Any]: return { "description": "Just prints sliced filelist", } def configure_argparse(parser: argparse.ArgumentPars...
null
v0
[ "str", "str" ]
None
def v0(self, v1: str, v2: str=None) -> None: if len(self._parameters) == 0 and len(self._modules) == 0: raise RuntimeError('既没有_modules 也没有 _parameters你save个啥?哈批.') if len(self._parameters) == 0: v3 = {} for (v4, v5) in self._modules.items(): v3[v4] = v5._parameters w...
[]
[ "pickle" ]
[ "import pickle" ]
14
import inspect from typing import Iterator from collections import OrderedDict import pickle from ..autograd.tensor import Tensor from ..autograd.parameter import Parameter from ..exception import ShapeError, LengthError class Module: def __init__(self,): self._modules = OrderedDict() self._param...
null
v0
[ "Any" ]
str
def v0(self, v1) -> str: v2 = f"{v1.label[0]} ({str(v1).replace('icd10.', '')}" v2 = self.split_label(v2) return v2 + ')'
[]
[]
[]
4
import os.path from textwrap import wrap import matplotlib.pyplot as plt import networkx as nx from matplotlib.pyplot import margins from modules.onto import * class GraphBuilder: def __init__(self, ontology): self.ontology = ontology @staticmethod def split_label(disease_name: str) -> str: ...
null
v0
[]
pd.DataFrame
def v0(self) -> pd.DataFrame: v1 = self.df_work - self.df_test1 if not self.normalizer: return v1 else: return self.normalizer.normalizer_df(v1)
[]
[]
[]
6
import pandas as pd import matplotlib.pyplot as plt from utils.aioLogger import aioLogger from utils.aioError import aioPreprocessError from preprocess.dfNormalizer import dfNormalizer from pathlib import Path from config.aioConfig import heightWeightConfig class heightWeightSubtractTest1: """this class...
null
v0
[ "str" ]
str
def v0(self, v1: str) -> str: for v2 in range(len(v1) // 2): if v1[v2] != 'a': return v1[:v2] + 'a' + v1[v2 + 1:] return v1[:-1] + 'b' if v1[:-1] else ''
[]
[]
[]
5
# @l2g 1328 python3 # [1328] Break a Palindrome # Difficulty: Medium # https://leetcode.com/problems/break-a-palindrome # # Given a palindromic string of lowercase English letters palindrome, # replace exactly one character with any lowercase English letter so that the resulting string is not a palindrome and that it i...
null
v19
[ "xr.DataArray", "xr.DataArray", "Any", "float" ]
Any
def v19(v20: xr.DataArray, v21: xr.DataArray, v22, v23: float): v24 = 5 v25: int = int(v24 / (v20.range[1] - v20.range[0])) v26 = np.round(v22 / (v20.range[1] - v20.range[0])).astype(int) v27 = xr.apply_ufunc(v0, v20, v20.shift(ping_time=1), v20.shift(ping_time=-1), v26, v26.shift(ping_time=1), v26.shif...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any", "Any", "Any", "Any", "Any", "Any", "float", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3, v4, v5, v6, v7, v8, v9: float, v10):\n if v7 < 0:\n return -1\n v1...
[ "numpy", "xarray" ]
[ "import numpy as np", "import xarray as xr" ]
7
# -*- coding: utf-8 -*- """ A simple threshold-based bottom detection. Copyright (c) 2021, Contributors to the CRIMAC project. Licensed under the MIT license. """ import numpy as np import xarray as xr from bottomdetection import bottom_utils from bottomdetection.parameters import Parameters def detect_bottom(zarr...
null
v0
[ "float" ]
float
def v0(v1: float) -> float: if v1 < 5: return 0.01 elif 5 <= v1 < 10: return 0.02 elif 10 <= v1 < 50: return 0.03 elif 50 <= v1 < 100: return 0.05 else: return 0.1
[]
[]
[]
11
#!/usr/bin/env python # -*- coding: utf-8 -*- """ My personal swing trading entry formula """ import argparse import datetime import config_loader as cl import output as op from pricing import get_last_price_data, PricePayloadKeys from stock import Stock from trade import Trade try: import holiday...
null
v0
[]
None
def v0(self) -> None: if 'secrets_backends' not in self._changes: self._changes['secrets_backends'] = {} self._changes.yaml_set_comment_before_after_key('secrets_backends', before='Secrets backends. Each key is the mount to a secrets engine.')
[]
[]
[]
4
import os from copy import deepcopy from typing import Dict, Optional, List from ruamel import yaml from ruamel.yaml.comments import CommentedMap class ManifestItem: def __init__(self, data: Dict): self.data = data def convert(self) -> Optional[Dict]: raise NotImplementedError() class Root...
null
v3
[ "str", "v0" ]
None
def v3(self, v4: str, v5: v0) -> None: v6 = v5.convert() if not v6: return if 'auth_methods' not in self._changes: self._changes['auth_methods'] = {} v4 = v4.strip('/') v7 = self._changes['auth_methods'].get(v4, {}) v7.update(v6) self._changes['auth_methods'][v4] = v7
[]
[]
[]
10
import os from copy import deepcopy from typing import Dict, Optional, List from ruamel import yaml from ruamel.yaml.comments import CommentedMap class ManifestItem: def __init__(self, data: Dict): self.data = data def convert(self) -> Optional[Dict]: raise NotImplementedError() class Root...
[ "class v0:\n\n def __init__(self, v1: Dict):\n self.data = v1\n\n def v2(self) -> Optional[Dict]:\n raise NotImplementedError()" ]
v0
[ "str" ]
None
def v0(self, v1: str) -> None: v1 = v1.strip('/') if 'secrets_backends' in self._changes and v1 in self._changes['secrets_backends']: del self._changes['secrets_backends'][v1]
[]
[]
[]
4
import os from copy import deepcopy from typing import Dict, Optional, List from ruamel import yaml from ruamel.yaml.comments import CommentedMap class ManifestItem: def __init__(self, data: Dict): self.data = data def convert(self) -> Optional[Dict]: raise NotImplementedError() class Root...
null
v0
[]
None
def v0(self) -> None: if 'auth_methods' not in self._changes: self._changes['auth_methods'] = {} self._changes.yaml_set_comment_before_after_key('auth_methods', before='Authentication methods. Each key is the name of the auth method.')
[]
[]
[]
4
import os from copy import deepcopy from typing import Dict, Optional, List from ruamel import yaml from ruamel.yaml.comments import CommentedMap class ManifestItem: def __init__(self, data: Dict): self.data = data def convert(self) -> Optional[Dict]: raise NotImplementedError() class Root...
null
v0
[]
None
def v0(self) -> None: with open(self.path, 'w') as v1: v1.write(self.yaml())
[]
[]
[]
3
import os from copy import deepcopy from typing import Dict, Optional, List from ruamel import yaml from ruamel.yaml.comments import CommentedMap class ManifestItem: def __init__(self, data: Dict): self.data = data def convert(self) -> Optional[Dict]: raise NotImplementedError() class Root...
null
v0
[ "Dict[str, str]", "str" ]
bool
def v0(v1: Dict[str, str], v2: str) -> bool: if len(v2) > 0: return True for v3 in v1: if 'reward =' not in v1[v3] and 'reward=' not in v1[v3]: return False return True
[]
[]
[]
7
from typing import Dict def validate_rewards(action_rewards: Dict[str, str], external_reward_funcs: str) -> bool: if len(external_reward_funcs) > 0: return True for action_name in action_rewards: if "reward =" not in action_rewards[action_name] and "reward=" not in action_rewards[action_name]...
null
v0
[]
str
def v0() -> str: if platform.system() == 'Linux': return '-manylinux1_x86_64' return '-macosx_10_11_x86_64'
[]
[ "platform" ]
[ "import platform" ]
4
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Path" ]
None
def v0(v1: Path) -> None: v2 = v1.absolute() / 'stdlib' if not v2.is_dir(): raise ValueError("The provided typeshed directory is not in the expected format: It does not contain a 'stdlib' directory.")
[]
[]
[]
4
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "str" ]
None
def v0(v1: str) -> None: v2 = re.compile('^[0-9]+\\.[0-9]+\\.[0-9]+$') if not v2.match(v1): raise ValueError('Invalid version format.')
[]
[ "re" ]
[ "import re" ]
4
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Path" ]
Path
def v0(v1: Path) -> Path: v2 = v1 / 'tools/sapp' if not v2.is_dir(): v2 = v1.parent / 'sapp' return v2
[]
[]
[]
5
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Path" ]
None
def v0(v1: Path) -> None: v1.mkdir() (v1 / '__init__.py').touch()
[]
[]
[]
3
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "List[str]", "Path", "Path", "List[str]" ]
None
def v0(v1: List[str], v2: Path, v3: Path, v4: List[str]) -> None: v5 = ['rsync'] v5.extend(v4) v5.extend(['--filter=' + filter_string for v6 in v1]) v5.append(str(v2)) v5.append(str(v3)) subprocess.run(v5)
[]
[ "subprocess" ]
[ "import subprocess" ]
7
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v7
[ "Path", "Path" ]
None
def v7(v8: Path, v9: Path) -> None: v10 = ['+ */'] v0(v10, v8 / 'stubs' / 'taint', v9, ['-avm']) v0(v10, v8 / 'stubs' / 'third_party_taint', v9, ['-avm'])
[ { "name": "v0", "input_types": [ "List[str]", "Path", "Path", "List[str]" ], "output_type": "None", "code": "def v0(v1: List[str], v2: Path, v3: Path, v4: List[str]) -> None:\n v5 = ['rsync']\n v5.extend(v4)\n v5.extend(['--filter=' + filter_string for v6 in v1])...
[ "subprocess" ]
[ "import subprocess" ]
4
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v7
[ "Path", "Path" ]
None
def v7(v8: Path, v9: Path) -> None: v10 = v8 / 'typeshed' v0(['+ */', '-! *.pyi'], v9 / 'stdlib', v10, ['-avm']) v0(['+ */', '-! *.pyi'], v9 / 'third_party', v10, ['-avm']) v0([], v10, v8, ['--recursive', '--copy-links', '--prune-empty-dirs', '--verbose', "--chmod='+w'", "--include='stdlib/***'", "--inc...
[ { "name": "v0", "input_types": [ "List[str]", "Path", "Path", "List[str]" ], "output_type": "None", "code": "def v0(v1: List[str], v2: Path, v3: Path, v4: List[str]) -> None:\n v5 = ['rsync']\n v5.extend(v4)\n v5.extend(['--filter=' + filter_string for v6 in v1])...
[ "subprocess" ]
[ "import subprocess" ]
5
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Path", "Path" ]
None
def v0(v1: Path, v2: Path) -> None: (v2 / 'bin').mkdir() shutil.copy(v1 / 'source' / '_build/default/main.exe', v2 / 'bin/pyre.bin')
[]
[ "shutil" ]
[ "import shutil" ]
3
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Path", "Path" ]
None
def v0(v1: Path, v2: Path) -> None: shutil.copy(v1 / 'README.md', v2) shutil.copy(v1 / 'LICENSE', v2)
[]
[ "shutil" ]
[ "import shutil" ]
3
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Path" ]
None
def v0(v1: Path) -> None: v2 = v1 / 'setup.cfg' v2.touch() v2.write_text('[metadata]\nlicense_file = LICENSE')
[]
[]
[]
4
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v10
[ "Path", "str", "Path" ]
None
def v10(v11: Path, v12: str, v13: Path) -> None: v14 = v0(v11, v12) (v13 / 'setup.py').write_text(v14)
[ { "name": "v0", "input_types": [ "Path", "str" ], "output_type": "str", "code": "def v0(v1: Path, v2: str) -> str:\n v3 = v1 / 'scripts/pypi/setup.py'\n v4 = v3.read_text()\n v5 = (sapp_directory(v1) / 'requirements.json').read_text()\n v6 = json.dumps(RUNTIME_DEPENDENCIE...
[ "json" ]
[ "import json" ]
3
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v1
[ "Path", "Path" ]
Tuple[Path, Path]
def v1(v2: Path, v3: Path) -> Tuple[Path, Path]: v4 = v3 / 'dist' v5 = list(v4.glob('**/*.whl')) v6 = list(v4.glob('**/*.tar.gz')) if not len(v5) == 1 and (not len(v6) == 1): raise ValueError('Unexpected files found in {}/dist.'.format(v3)) (v6, v5) = (v6[0], v5[0]) v7 = v2 / 'scripts' /...
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n if platform.system() == 'Linux':\n return '-manylinux1_x86_64'\n return '-macosx_10_11_x86_64'", "dependencies": [] } ]
[ "platform", "shutil" ]
[ "import platform", "import shutil" ]
15
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import platform import re import shutil import subprocess import tempfile from pathlib import Path from typing import Li...
null
v0
[ "Optional[Dict]" ]
Union[int, str]
def v0(self, v1: Optional[Dict]=None) -> Union[int, str]: try: v1 = v1 or {} v2 = (self.monty_decode, self.use_document_model) (self.monty_decode, self.use_document_model) = (False, False) v3 = self._query_resource(criteria=v1, num_chunks=1, chunk_size=1) (self.monty_decode, ...
[]
[]
[]
10
# coding: utf-8 """ This module provides classes to interface with the Materials Project REST API v3 to enable the creation of data structures and pymatgen objects using Materials Project data. """ import itertools import json import platform import sys import warnings from concurrent.futures import FIRST_COMPLETED, T...
null
v0
[ "Any", "Any" ]
None
def v0(v1, v2) -> None: os.chdir(v2) v3 = subprocess.Popen(v1, shell=True) v3.wait()
[]
[ "os", "subprocess" ]
[ "import subprocess", "import os" ]
4
import sys import subprocess import os import click from pearun.exceptions import PearunException, UnspecifiedCommandException, PearunfileException from pearun.pearunfile import Pearunfile __all__ = ['main'] def _execute_command(command, cwd) -> None: """ Runs specified command :param command: command ...
null
v0
[]
None
def v0(self) -> None: assert self.buffer.initialized, 'Tried to start logger before buffer was initialized' while True: v1 = self.queue.get() if v1 is None: break self.log(v1) self.end()
[]
[]
[]
8
""" threedb.result_logging.base_logger ================================== Implements an abstract class for logging results. """ from multiprocessing import Process, Queue from typing import Any, Dict, Optional from threedb.utils import CyclicBuffer from abc import abstractmethod, ABC class BaseLogger(Process, ABC): ...
null
v22
[ "List[Dict[str, Any]]" ]
Any
def v22(v23: List[Dict[str, Any]]): v24 = [] for v25 in v23: if v25['id'] != '*' and (not v25['attribute']): v24.append(v25) if not v24: return for (v26, v27) in groupby(v24, key=lambda resource: (v25['system'], v25['type'])): v0(v26[0], v26[1], list(v27))
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3):\n v4 = list({resource['id'] for v5 in v3})\n v6 = fetch_auth_attributes(system_id=v1, resource_type_id=v2, ids=v4, raise_api_exception=False)\n for v5 in v3:\n ...
[ "itertools", "logging" ]
[ "import logging", "from itertools import groupby" ]
9
# -*- coding: utf-8 -*- """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with th...
null
v18
[ "list[ArrayLike]", "bool" ]
list[Block]
def v18(v19: list[ArrayLike], v20: bool) -> list[Block]: v21 = list(enumerate(v19)) if not v20: v22 = v14(v21, dtype=None) return v22 v23 = itertools.groupby(v21, v0) v22 = [] for ((v24, v24, v25), v26) in v23: v27 = get_block_type(None, v25) if isinstance(v25, np.dty...
[ { "name": "v0", "input_types": [ "tuple[int, ArrayLike]" ], "output_type": "tuple[int, bool, DtypeObj]", "code": "def v0(v1: tuple[int, ArrayLike]) -> tuple[int, bool, DtypeObj]:\n v2 = v1[1].dtype\n if is_1d_only_ea_dtype(v2):\n v3 = id(v2)\n else:\n v3 = 0\n ret...
[ "itertools", "numpy", "pandas" ]
[ "import itertools", "import numpy as np", "from pandas._libs import internals as libinternals, lib", "from pandas._libs.internals import BlockPlacement", "from pandas._typing import ArrayLike, DtypeObj, Shape, npt, type_t", "from pandas.errors import PerformanceWarning", "from pandas.util._validators im...
25
from __future__ import annotations import itertools from typing import ( Any, Callable, Hashable, Sequence, TypeVar, cast, ) import warnings import numpy as np from pandas._libs import ( internals as libinternals, lib, ) from pandas._libs.internals import BlockPlacement from pandas._t...
null
v0
[ "Any", "DtypeObj | None" ]
list[Block]
def v0(v1, v2: DtypeObj | None) -> list[Block]: if v2 is not None: return [new_block(ensure_block_shape(x[1].astype(v2, copy=False), ndim=2), placement=x[0], ndim=2) for v3 in v1] return [new_block(ensure_block_shape(v3[1], ndim=2), placement=v3[0], ndim=2) for v3 in v1]
[]
[ "pandas" ]
[ "from pandas._libs import internals as libinternals, lib", "from pandas._libs.internals import BlockPlacement", "from pandas._typing import ArrayLike, DtypeObj, Shape, npt, type_t", "from pandas.errors import PerformanceWarning", "from pandas.util._validators import validate_bool_kwarg", "from pandas.core...
4
from __future__ import annotations import itertools from typing import ( Any, Callable, Hashable, Sequence, TypeVar, cast, ) import warnings import numpy as np from pandas._libs import ( internals as libinternals, lib, ) from pandas._libs.internals import BlockPlacement from pandas._t...
null
v0
[ "list[int]" ]
int
def v0(self, v1: list[int]) -> int: v2 = len(v1) v3 = False v4 = False for v5 in range(v2): v6 = abs(v1[v5]) if v6 == v2: v4 = True elif v1[v6] == 0: v3 = True else: v1[v6] *= -1 if not v4: return v2 for v5 in range(v2):...
[]
[]
[]
18
# https://leetcode.com/problems/missing-number/ class Solution: def missingNumber(self, nums: list[int]) -> int: n = len(nums) zero_got_negated = False nth_num_got_negated = False for i in range(n): num = abs(nums[i]) if num == n: nth_num_got_...
null
v0
[]
None
def v0(self) -> None: super().setUp() self.permission_test_model = {'meeting/1': {'name': 'name_meeting1', 'is_active_in_organization_id': 1}, 'mediafile/17': {'is_directory': False, 'mimetype': 'font/woff', 'meeting_id': 1}}
[]
[]
[]
3
from openslides_backend.permissions.permissions import Permissions from tests.system.action.base import BaseActionTestCase class MeetingSetFontActionTest(BaseActionTestCase): def setUp(self) -> None: super().setUp() self.permission_test_model = { "meeting/1": {"name": "name_meeting1", ...
null
v0
[]
None
def v0(self) -> None: self.set_models({'meeting/222': {'name': 'name_meeting222', 'is_active_in_organization_id': 1}, 'mediafile/17': {'is_directory': False, 'mimetype': 'font/woff', 'meeting_id': 222}}) v1 = self.request('meeting.set_font', {'id': 222, 'mediafile_id': 17, 'place': 'web_header'}) self.asser...
[]
[]
[]
6
from openslides_backend.permissions.permissions import Permissions from tests.system.action.base import BaseActionTestCase class MeetingSetFontActionTest(BaseActionTestCase): def setUp(self) -> None: super().setUp() self.permission_test_model = { "meeting/1": {"name": "name_meeting1", ...
null
v0
[]
None
def v0(self) -> None: self.set_models({'meeting/222': {'name': 'name_meeting222', 'is_active_in_organization_id': 1}, 'mediafile/17': {'is_directory': False, 'mimetype': 'text/plain', 'meeting_id': 222}}) v1 = self.request('meeting.set_font', {'id': 222, 'mediafile_id': 17, 'place': 'web_header'}) self.asse...
[]
[]
[]
5
from openslides_backend.permissions.permissions import Permissions from tests.system.action.base import BaseActionTestCase class MeetingSetFontActionTest(BaseActionTestCase): def setUp(self) -> None: super().setUp() self.permission_test_model = { "meeting/1": {"name": "name_meeting1", ...
null
v2
[]
Tuple[np.ndarray, np.ndarray]
def v2() -> Tuple[np.ndarray, np.ndarray]: v3 = np.linspace(start=-10.0, stop=10.0, num=1000).reshape(-1, 1) v4 = v0(v3) return (v3, v4)
[ { "name": "v0", "input_types": [ "float" ], "output_type": "float", "code": "def v0(v1: float) -> float:\n return v1 ** 2 + v1 + 10", "dependencies": [] } ]
[ "numpy" ]
[ "import numpy as np" ]
4
from typing import Tuple import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import mean_squared_error from tensorflow.keras.layers import Activation from tensorflow.keras.layers import Dense from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import RMSprop def f(x: f...
null
v0
[]
Sequential
def v0() -> Sequential: v1 = Sequential() v1.add(Dense(units=12)) v1.add(Activation('relu')) v1.add(Dense(units=1)) return v1
[]
[ "tensorflow" ]
[ "from tensorflow.keras.layers import Activation", "from tensorflow.keras.layers import Dense", "from tensorflow.keras.models import Sequential", "from tensorflow.keras.optimizers import RMSprop" ]
6
from typing import Tuple import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import mean_squared_error from tensorflow.keras.layers import Activation from tensorflow.keras.layers import Dense from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import RMSprop def f(x: f...
null
v7
[]
None
def v7() -> None: (v8, v9) = v4() v10 = v0() v10.compile(optimizer=RMSprop(learning_rate=0.01), loss='mse') v10.fit(v8, v9, epochs=20) v11 = v10.predict(v8).flatten() (v12, v13) = v10.layers[0].get_weights() print(f'Weights: {v12[0][0]}') v14 = np.linspace(start=-5, stop=5, num=200) ...
[ { "name": "v0", "input_types": [], "output_type": "Sequential", "code": "def v0() -> Sequential:\n v1 = Sequential()\n v1.add(Dense(units=12))\n v1.add(Activation('relu'))\n v1.add(Dense(units=1))\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [ ...
[ "matplotlib", "numpy", "sklearn", "tensorflow" ]
[ "import matplotlib.pyplot as plt", "import numpy as np", "from sklearn.metrics import mean_squared_error", "from tensorflow.keras.layers import Activation", "from tensorflow.keras.layers import Dense", "from tensorflow.keras.models import Sequential", "from tensorflow.keras.optimizers import RMSprop" ]
24
from typing import Tuple import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import mean_squared_error from tensorflow.keras.layers import Activation from tensorflow.keras.layers import Dense from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import RMSprop def f(x: f...
null
v0
[ "str" ]
Any
def v0(self, v1: str): with self.lock: self.active.append(v1)
[]
[]
[]
3
import json import threading import time from datetime import datetime, timedelta from typing import List from uuid import uuid4 from acquisition.core.bugsbunny import spin from acquisition.utils.common import datetime_to_utc, now from acquisition.utils.logs import log # pyright: reportMissingImports=false ...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: if v1 and isinstance(v1, str): return v1 else: return ''
[]
[]
[]
5
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import warnings import numpy as np import re from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.base import BaseEstimator, TransformerMixin import json import pandas as pd from scipy.spatial.distanc...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: if v1 and len(v1) > 10: return v1[:10] else: return ''
[]
[]
[]
5
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import warnings import numpy as np import re from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.base import BaseEstimator, TransformerMixin import json import pandas as pd from scipy.spatial.distanc...
null
v0
[]
argparse.Namespace
def v0() -> argparse.Namespace: v1 = argparse.ArgumentParser(description='Play a game of four wins with 2 Bots.') v1.add_argument('-b1', '--bot_1', help='The name of the first bot', type=str, required='-p' not in sys.argv) v1.add_argument('-b2', '--bot_2', help='The name of the second bot', type=str, requir...
[]
[ "argparse", "sys" ]
[ "import argparse", "import sys" ]
10
import argparse import sys from bots import bot_manager from tournamentmasters.command_tournament_master import CommandTournamentMaster try: from PyQt5.QtWidgets import QApplication from interface.mainwindow import MainWindow except ImportError: QApplication = None MainWindow = None print("Graphic...
null
v0
[ "object" ]
str
def v0(v1: object) -> str: if isinstance(v1, (date, datetime)): return v1.isoformat() elif isinstance(v1, decimal.Decimal): return str(v1) elif isinstance(v1, uuid.UUID): return str(v1) raise TypeError("Object of type '{}' is not JSON serializable".format(type(v1)))
[]
[ "datetime", "decimal", "uuid" ]
[ "from datetime import date, datetime", "import decimal", "import uuid" ]
8
# -*- coding: utf-8 -*- from datetime import date, datetime import decimal import uuid __version__ = '1.5.0' __all__ = ['__version__', 'encoder'] def encoder(o: object) -> str: """ Perform some additional encoding for types JSON doesn't support natively. We don't try to respect any ECMA specification he...
null
v0
[ "List[int]" ]
int
def v0(v1: List[int]) -> int: v2 = float('-inf') v3 = 0 v4 = 0 for v5 in range(0, len(v1)): if v1[v5 - v4] != v2: v2 = v1[v5 - v4] v3 += 1 else: del v1[v3] v4 += 1
[]
[]
[]
11
""" Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Example 1: Given nums = [1,1,2], Your function should return len...
null
v0
[ "List[int]" ]
int
def v0(v1: List[int]) -> int: v2 = 0 for v3 in range(0, len(v1)): if v1[v2] != v1[v3]: v2 += 1 v1[v2] = v1[v3]
[]
[]
[]
6
""" Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Example 1: Given nums = [1,1,2], Your function should return len...
null
v5
[ "Any", "Any", "Optional[v0[v3, v4]]", "List[Any]", "int" ]
None
def v5(v6: Any, v7: Any=None, v8: Optional[v0[v3, v4]]=v8, v9: List[Any]=v9, v10: int=v10) -> None: nonlocal j v9[j] = (v6, v7) v11 = v11 + 1 or 0
[]
[]
[]
4
from __future__ import annotations from typing import (Any, Generic, TypeVar, Optional, Tuple, Callable, List, Iterator, Iterable) from .array import fill from .list import (FSharpList, cons, empty as empty_1, fold as fold_1, is_empty as is_empty_1, tail, head, of_array_with_tail, singleton) from .option import (value ...
[ "class v0(Generic[Key, Value]):\n\n def __init__(self, v1: Any, v2: Any=None) -> None:\n self.k = v1\n self.v = v2", "v3 = TypeVar('a_')", "v4 = TypeVar('b_')" ]