name
stringclasses
844 values
input_types
listlengths
0
100
output_type
stringlengths
1
419
code
stringlengths
34
233k
dependencies
listlengths
0
6
lib_used
listlengths
0
11
imports
listlengths
0
66
line_count
int64
3
199
full_code
stringlengths
39
1.01M
input_type_defs
listlengths
1
12
v0
[ "str" ]
Union[bool, None]
def v0(self, v1: str) -> Union[bool, None]: if 'instance' in self._view_records[v1]: v2 = self._view_records[v1]['instance'] if v2.hidden: return True if hasattr(v2, 'before_hide') and v2.before_hide() == False: return False v2.home_widget.master.forget(v2.hom...
[]
[]
[]
12
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "tk.Menu" ]
int
def v0(self, v1: tk.Menu) -> int: for v2 in range(len(self._menubar.winfo_children())): if v1 == self._menubar.winfo_children()[v2]: return v2 raise RuntimeError("Couldn't find menu")
[]
[]
[]
5
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "Any" ]
None
def v0(self, v1) -> None: if v1.delta > 0: self._change_font_size(1) else: self._change_font_size(-1)
[]
[]
[]
5
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
None
def v0(self) -> None: v1 = self.get_option('view.editor_font_size') if self.winfo_screenwidth() < 1024: v2 = 10 v3 = 12 v4 = 14 elif self.winfo_screenwidth() < 1280: v2 = 12 v3 = 14 v4 = 18 else: v2 = 12 v3 = 16 v4 = 20 v5 = {10...
[]
[ "re" ]
[ "import re" ]
25
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "int" ]
None
def v0(self, v1: int) -> None: if v1 != 0: v2 = self.get_option('view.editor_font_size') v2 += v1 self.set_option('view.editor_font_size', self._guard_font_size(v2)) v3 = self.get_option('view.io_font_size') v3 += v1 self.set_option('view.io_font_size', self._guard_fo...
[]
[]
[]
9
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "int" ]
int
def v0(self, v1: int) -> int: v2 = 4 v3 = 200 if v1 < v2: return v2 elif v1 > v3: return v3 else: return v1
[]
[]
[]
9
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
None
def v0(self) -> None: v1 = self.get_variable('view.full_screen') v1.set(not v1.get()) self.attributes('-fullscreen', v1.get())
[]
[]
[]
4
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
None
def v0(self) -> None: if self._maximized_view is not None: self._unmaximize_view() else: self._maximize_view()
[]
[]
[]
5
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "str", "str" ]
Union[str, int]
def v0(self, v1: str, v2: str) -> Union[str, int]: v3 = self.get_menu(v1) if v3.index('end') == None: return 'end' v4 = self._menu_item_specs[v1, v2] v5 = False for v6 in range(0, v3.index('end') + 1): v7 = v3.entryconfigure(v6) if 'label' in v7: v8 = v3.entrycget...
[]
[]
[]
24
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "Any", "Any", "Any" ]
None
def v0(self, v1, v2, v3) -> None: sys.last_type = v1 sys.last_value = v2 sys.last_traceback = v3 if isinstance(v2, KeyboardInterrupt): return self.report_exception()
[]
[ "sys" ]
[ "import sys" ]
7
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "bytearray" ]
None
def v0(self, v1: bytearray) -> None: (v2, v3) = self.deserialize_float_prop(v1) self._float_properties[v2] = v3
[]
[]
[]
3
from mlagents.envs.side_channel.side_channel import SideChannel, SideChannelType import struct from typing import Tuple, Optional, List class FloatPropertiesChannel(SideChannel): """ This is the SideChannel for float properties shared with Unity. You can modify the float properties of an environment with ...
null
v0
[ "str", "float" ]
None
def v0(self, v1: str, v2: float) -> None: self._float_properties[v1] = v2 super().queue_message_to_send(self.serialize_float_prop(v1, v2))
[]
[]
[]
3
from mlagents.envs.side_channel.side_channel import SideChannel, SideChannelType import struct from typing import Tuple, Optional, List class FloatPropertiesChannel(SideChannel): """ This is the SideChannel for float properties shared with Unity. You can modify the float properties of an environment with ...
null
v3
[ "Optional[v0]" ]
Optional[v0]
def v3(self, v4: Optional[v0]) -> Optional[v0]: if not v4: return None v5 = v4 v6 = None while v5: v7 = v5.next v5.next = v6 v6 = v5 v5 = v7 return v6
[]
[]
[]
11
# Definition for singly-linked list. from typing import Optional class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head: return None c...
[ "class v0:\n\n def __init__(self, v1=0, v2=None):\n self.val = v1\n self.next = v2" ]
v0
[ "str" ]
'Boolean'
def v0(v1: str) -> 'Boolean': if v1.endswith('.svg') or not v1.startswith('https://'): return False return True
[]
[]
[]
4
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException from six.moves.urllib.parse import urlencode, quote from bs4 impor...
null
v0
[ "int", "str" ]
bool
def v0(self, v1: int, v2: str) -> bool: if v2 not in self.last_printed or v1 - self.last_printed[v2] >= 10: self.last_printed[v2] = v1 return True return False
[]
[]
[]
5
''' 359. Logger Rate Limiter. Design a logger system that receives a stream of messages along with their timestamps. Each unique message should only be printed at most every 10 seconds (i.e. a message printed at timestamp t will prevent other identical messages from being printed until timestamp t + 10). All message...
null
v0
[ "bool" ]
Iterable[Tuple[str, Any]]
def v0(self, *, v1: bool=False) -> Iterable[Tuple[str, Any]]: v2 = self.to_dict(omit_none=False, with_aliases=v1) v3 = set(self._connection_keys()) v4: List[str] = [] if v1: v4 = [k for (v5, v6) in self._ALIASES.items() if v6 in v3] for v7 in itertools.chain(self._connection_keys(), v4): ...
[]
[ "itertools" ]
[ "import itertools" ]
9
import abc import itertools from dataclasses import dataclass, field from typing import ( Any, ClassVar, Dict, Tuple, Iterable, Optional, NewType, List, Type ) from typing_extensions import Protocol from hologram import JsonSchemaMixin from hologram.helpers import ( StrEnum, register_pattern, ExtensibleJsonSch...
null
v22
[ "int", "int" ]
v0
def v22(self, v23: int, /, v24: int) -> v0: (v25, v26) = self for v27 in range(v23 % 4): (v25, v26) = (v24 - 1 - v26, v25) return type(self)(v25, v26)
[]
[]
[]
5
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. from __future__ import annotations import dataclasses import itertools import operator import functools import math from typing import (Optional, Tuple, Union, Container, Hashable, Iterator, Iterabl...
[ "@dataclasses.dataclass(frozen=True)\nclass v0:\n v1: int\n v2: int\n v3 = lambda self: iter((self.x, self.y))\n\n def v4(self, v5: v0) -> int:\n \"\"\"Get Levenshtein distance between two vectors\"\"\"\n return sum(map(abs, map(operator.sub, self, v5)))\n\n def v6(self) -> v0:\n ...
v22
[ "int" ]
Iterator[v0]
def v22(self, /, v23: int) -> Iterator[v0]: (v24, v25) = self yield self for v26 in range(3): (v24, v25) = (v23 - 1 - v25, v24) yield type(self)(v24, v25)
[]
[]
[]
6
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. from __future__ import annotations import dataclasses import itertools import operator import functools import math from typing import (Optional, Tuple, Union, Container, Hashable, Iterator, Iterabl...
[ "@dataclasses.dataclass(frozen=True)\nclass v0:\n v1: int\n v2: int\n v3 = lambda self: iter((self.x, self.y))\n\n def v4(self, v5: v0) -> int:\n \"\"\"Get Levenshtein distance between two vectors\"\"\"\n return sum(map(abs, map(operator.sub, self, v5)))\n\n def v6(self) -> v0:\n ...
v38
[ "v32", "Optional[int]" ]
Iterator[v0]
def v38(self, v39: v32, v40: Optional[int]=None) -> Iterator[v0]: v41 = self if v40 is None: while True: yield v41 v41 += v39 else: while 0 <= min(v41) <= max(v41) <= v40 - 1: yield v41 v41 += v39
[]
[]
[]
10
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. from __future__ import annotations import dataclasses import itertools import operator import functools import math from typing import (Optional, Tuple, Union, Container, Hashable, Iterator, Iterabl...
[ "class v0(Vector):\n\n @staticmethod\n def v1(v2: Union[base._BaseGrid, int], /):\n v3: int = v2 if isinstance(v2, int) else v2.board_size\n for (v4, v5) in itertools.product(range(v3), repeat=2):\n yield v0(v5, v4)\n\n def v6(self, v7: Union[v0, Translation]):\n if isinstan...
v32
[ "v0", "v0" ]
bool
def v32(self, v33: v0, v34: v0) -> bool: v35: Translation = v34 - v33 if self.x: return np.sign(v35.x) == self.x and abs(v35.x) >= abs(v35.y) else: assert self.y return np.sign(v35.y) == self.y and abs(v35.y) >= abs(v35.x)
[]
[ "numpy" ]
[ "import numpy as np" ]
7
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. from __future__ import annotations import dataclasses import itertools import operator import functools import math from typing import (Optional, Tuple, Union, Container, Hashable, Iterator, Iterabl...
[ "class v0(Vector):\n\n @staticmethod\n def v1(v2: Union[base._BaseGrid, int], /):\n v3: int = v2 if isinstance(v2, int) else v2.board_size\n for (v4, v5) in itertools.product(range(v3), repeat=2):\n yield v0(v5, v4)\n\n def v6(self, v7: Union[v0, Translation]):\n if isinstan...
v0
[ "dict" ]
str
def v0(v1: dict) -> str: v2 = hashlib.blake2s(digest_size=5) for (v3, v4) in sorted(v1.items()): v2.update(str(v3).encode()) v2.update(str(v4).encode()) return v2.hexdigest()
[]
[ "hashlib" ]
[ "import hashlib" ]
6
"""Provide functionality for TTS.""" from __future__ import annotations import asyncio import functools as ft import hashlib from http import HTTPStatus import io import logging import mimetypes import os from pathlib import Path import re from typing import TYPE_CHECKING, Optional, cast from aiohttp import web impor...
null
v1
[ "str", "str", "dict | None" ]
v0
async def v1(self, v2: str, v3: str, v4: dict | None=None) -> v0: if TYPE_CHECKING: assert self.hass return await self.hass.async_add_executor_job(ft.partial(self.get_tts_audio, v2, v3, options=v4))
[]
[ "functools", "typing" ]
[ "import functools as ft", "from typing import TYPE_CHECKING, Optional, cast" ]
4
"""Provide functionality for TTS.""" from __future__ import annotations import asyncio import functools as ft import hashlib from http import HTTPStatus import io import logging import mimetypes import os from pathlib import Path import re from typing import TYPE_CHECKING, Optional, cast from aiohttp import web impor...
[ "v0 = tuple[Optional[str], Optional[bytes]]" ]
v0
[]
List[str]
def v0() -> List[str]: v1 = Path().glob('src/python/**/register.py') v2 = {str(register_py.parent).replace('src/python/', '').replace('/', '.') for v3 in v1} assert len(v2) > 10 v4 = {'pants.core', 'pants.backend.project_info'} return sorted(v2 - v4)
[]
[ "pathlib" ]
[ "from pathlib import Path" ]
6
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pathlib import Path from typing import List import pytest from pants.testutil.pants_integration_test import run_pants def discover_backends() -> List[str]: register_pys = Path...
null
v7
[]
None
def v7() -> None: v8 = v2() v0(v8)
[ { "name": "v0", "input_types": [ "List[str]" ], "output_type": "None", "code": "def v0(v1: List[str]) -> None:\n run_pants(['--no-verify-config', 'help-all'], config={'GLOBAL': {'backend_packages': v1}}).assert_success(f'Failed to load: {v1}')", "dependencies": [] }, { "name...
[ "pathlib" ]
[ "from pathlib import Path" ]
3
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pathlib import Path from typing import List import pytest from pants.testutil.pants_integration_test import run_pants def discover_backends() -> List[str]: register_pys = Path...
null
v0
[ "qty.Pressure" ]
float
def v0(self, v1: qty.Pressure) -> float: self._balancing_valve.set_pressure_excess(v1) return self._balancing_valve.Kvr
[]
[]
[]
3
""" ## Modeling the components for piping network design """ from typing import List, Dict, Optional, Tuple, Type import threading import math from lib import quantities as qty from lib.pypeflow.core import Pipe, Fitting, BalancingValve, ControlValve from lib.pypeflow.core import PipeSchedule from lib.pypeflow.core imp...
null
v62
[ "v0", "str" ]
Any
def v62(self, v63: v0, v64: str): if v64.lower() == 'in' and v63 not in self._in: self._in.append(v63) if v64.lower() == 'out' and v63 not in self._out: self._out.append(v63)
[]
[]
[]
5
""" ## Modeling the components for piping network design """ from typing import List, Dict, Optional, Tuple, Type import threading import math from lib import quantities as qty from lib.pypeflow.core import Pipe, Fitting, BalancingValve, ControlValve from lib.pypeflow.core import PipeSchedule from lib.pypeflow.core imp...
[ "class v0:\n\n def __init__(self):\n self._id: str = ''\n self._start_node: Node = Node()\n self._end_node: Node = Node()\n self._pipe: Pipe = Pipe()\n self._fittings: Dict[str, Fitting] = {}\n self._balancing_valve: Optional[BalancingValve] = None\n self._control...
v62
[]
v0
def v62(self) -> v0: for v63 in self: if v63.real: return v63
[]
[]
[]
4
""" ## Modeling the components for piping network design """ from typing import List, Dict, Optional, Tuple, Type import threading import math from lib import quantities as qty from lib.pypeflow.core import Pipe, Fitting, BalancingValve, ControlValve from lib.pypeflow.core import PipeSchedule from lib.pypeflow.core imp...
[ "class v0:\n\n def __init__(self):\n self._id: str = ''\n self._start_node: Node = Node()\n self._end_node: Node = Node()\n self._pipe: Pipe = Pipe()\n self._fittings: Dict[str, Fitting] = {}\n self._balancing_valve: Optional[BalancingValve] = None\n self._control...
v62
[]
v0
def v62(self) -> v0: for v63 in reversed(self): if v63.real: return v63
[]
[]
[]
4
""" ## Modeling the components for piping network design """ from typing import List, Dict, Optional, Tuple, Type import threading import math from lib import quantities as qty from lib.pypeflow.core import Pipe, Fitting, BalancingValve, ControlValve from lib.pypeflow.core import PipeSchedule from lib.pypeflow.core imp...
[ "class v0:\n\n def __init__(self):\n self._id: str = ''\n self._start_node: Node = Node()\n self._end_node: Node = Node()\n self._pipe: Pipe = Pipe()\n self._fittings: Dict[str, Fitting] = {}\n self._balancing_valve: Optional[BalancingValve] = None\n self._control...
v0
[ "pd.DataFrame", "str", "str" ]
pd.DataFrame
def v0(self, v1: pd.DataFrame, v2: str, v3: str) -> pd.DataFrame: v4 = {c: c.replace(v3, f'idx_{v1.columns.get_loc(c)}') for v5 in v2} return v1.rename(index=str, columns=v4)
[]
[]
[]
3
from __future__ import annotations from typing import List, TYPE_CHECKING import pandas as pd from uuid import uuid4 from ..parsers import CoreScript from ..models import MorphActionModel if TYPE_CHECKING: from ..models import ColumnModel class BaseMorphAction: """Morphs differ from Actions in that they nor...
null
v0
[ "dict" ]
Any
def v0(self, v1: dict): assert len(v1) == 1, 'nested_bool condition only supports a single boolean operation (or/and).' if v1.get('and'): return {'bool': self._and_(v1['and'])} elif v1.get('or'): return {'bool': self._or_(v1['or'])} else: raise SyntaxError('No boolean operator pr...
[]
[]
[]
8
class FilterBuilder: not_clauses = ("neq", "nin", "missing") def handler(self, constraint, *args): fn_name = "_{0}_".format(constraint) fn = getattr(self, fn_name) return fn(*args) @staticmethod def is_nested_bool(field: str): if field.startswith("nested_bool"): ...
null
v0
[ "dict" ]
Any
def v0(self, v1: dict): (v2, v3) = (list(), list()) for (v4, v5) in v1.items(): assert isinstance(v5, dict), 'Invalid clause structure provided for inside {}'.format(v4) if self.is_nested_bool(v4): v2.append(self.handle_nested_bool(v5)) continue for (v6, v7) in v5...
[]
[]
[]
17
class FilterBuilder: not_clauses = ("neq", "nin", "missing") def handler(self, constraint, *args): fn_name = "_{0}_".format(constraint) fn = getattr(self, fn_name) return fn(*args) @staticmethod def is_nested_bool(field: str): if field.startswith("nested_bool"): ...
null
v0
[ "dict" ]
Any
def v0(self, v1: dict): if not v1: return {} (v2, v3) = self._bool_(v1) return {'must': v2, 'must_not': v3}
[]
[]
[]
5
class FilterBuilder: not_clauses = ("neq", "nin", "missing") def handler(self, constraint, *args): fn_name = "_{0}_".format(constraint) fn = getattr(self, fn_name) return fn(*args) @staticmethod def is_nested_bool(field: str): if field.startswith("nested_bool"): ...
null
v0
[ "dict" ]
Any
def v0(self, v1: dict): if not v1: return {} (v2, v3) = self._bool_(v1) v4 = {'should': v2, 'minimum_should_match': 1} if len(v3): v4['should'].append({'bool': {'must_not': v3}}) return v4
[]
[]
[]
8
class FilterBuilder: not_clauses = ("neq", "nin", "missing") def handler(self, constraint, *args): fn_name = "_{0}_".format(constraint) fn = getattr(self, fn_name) return fn(*args) @staticmethod def is_nested_bool(field: str): if field.startswith("nested_bool"): ...
null
v0
[ "tf.TensorShape" ]
Any
def v0(self, v1: tf.TensorShape): assert v1 is not None, 'input shape must be provided' v1 = tf.TensorShape(v1) self.input_shape = v1 self._initialize(v1)
[]
[ "tensorflow" ]
[ "import tensorflow as tf" ]
5
import tensorflow as tf import tensorflow_probability as tfp import numpy as np class Transform(tf.Module): def __init__(self, input_shape: tf.TensorShape=None, requires_init=False, has_constant_ldj=False, *args, **kwargs): self.input_shap...
null
v0
[ "tf.TensorShape", "Any" ]
Any
def v0(self, v1: tf.TensorShape, v2=None, **v3): if v2 is None: v2 = lambda shape: tf.random.uniform(v1) return [tf.Variable(v2((1, self.param_count(v1))), **v3)]
[]
[ "tensorflow" ]
[ "import tensorflow as tf" ]
4
import tensorflow as tf import tensorflow_probability as tfp import numpy as np class Transform(tf.Module): def __init__(self, input_shape: tf.TensorShape=None, requires_init=False, has_constant_ldj=False, *args, **kwargs): self.input_shap...
null
v0
[ "tf.TensorShape" ]
Any
def v0(self, v1: tf.TensorShape): v2 = v1[-1] return v2
[]
[]
[]
3
import tensorflow as tf import tensorflow_probability as tfp import numpy as np class Transform(tf.Module): def __init__(self, input_shape: tf.TensorShape=None, requires_init=False, has_constant_ldj=False, *args, **kwargs): self.input_shap...
null
v14
[]
Optional[str]
def v14() -> Optional[str]: v15 = v0() if v15 is not None: return v12(basename(v15)) else: return None
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Optional[str]", "code": "def v0(v1=False) -> Optional[str]:\n try:\n v2 = get_ipython()\n v3 = v2.ev('DWS_JUPYTER_INFO')\n return v3.notebook_path\n except Exception as e:\n if v1:\n prin...
[ "json", "os", "re", "requests", "urllib" ]
[ "import os", "import requests", "import json", "from urllib.parse import urljoin", "import re", "from os.path import join, basename, dirname, abspath, expanduser, curdir, exists" ]
6
""" Integration with Jupyter notebooks. This module provides a :class:`~LineageBuilder` subclass to simplify Lineage for Notebooks. It also provides a collection of IPython *magics* (macros) for working in Jupyter notebooks. """ import os import sys import ipykernel # type: ignore from IPython.core.getipython import g...
null
v0
[ "str" ]
float
def v0(v1: str) -> float: try: return os.path.getmtime(v1) except FileNotFoundError: return 0
[]
[ "os" ]
[ "import os" ]
5
#!/usr/bin/env python3 # # Copyright 2019 Miklos Vajna. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # """The wsgi module contains functionality specific to the web interface.""" import json import locale import os import subprocess import ...
null
v4
[ "str", "str" ]
Callable[[bool, areas.Relation], bool]
def v4(v5: str, v6: str) -> Callable[[bool, areas.Relation], bool]: def v7(v8: bool, v9: areas.Relation) -> bool: v10 = v9.get_config() return v10.get_refcounty() == v5 and v10.get_refsettlement() == v6 return v7
[ { "name": "v0", "input_types": [ "bool", "areas.Relation" ], "output_type": "bool", "code": "def v0(v1: bool, v2: areas.Relation) -> bool:\n v3 = v2.get_config()\n return v3.get_refcounty() == refcounty_filter and v3.get_refsettlement() == refsettlement_filter", "dependenci...
[]
[]
6
#!/usr/bin/env python3 # # Copyright 2019 Miklos Vajna. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # """The wsgi module contains functionality specific to the web interface.""" import json import locale import os import subprocess import ...
null
v9
[ "fb.PyTorchModel", "Tensor", "ep.Tensor" ]
Any
def v9(v10: fb.PyTorchModel, v11: Tensor, v12: ep.Tensor): v13 = v0(v10, v11, v12) return (v11[v13], v12[v13])
[ { "name": "v0", "input_types": [ "fb.PyTorchModel", "ep.Tensor", "ep.Tensor" ], "output_type": "Any", "code": "def v0(v1: fb.PyTorchModel, v2: ep.Tensor, v3: ep.Tensor):\n (v4, v5) = ep.astensor_(v2)\n (v6, v7) = ep.astensor_(v3)\n v8 = v1(v4).argmax(axis=-1)\n retu...
[]
[]
3
import eagerpy as ep import foolbox as fb from foolbox.attacks.gradient_descent_base import BaseGradientDescent from torch import Tensor from hiding_adversarial_attacks.config.attack.adversarial_attack_config import ( AdversarialAttackNames, ) def get_attack(attack_name: str) -> BaseGradientDescent: if attac...
null
v0
[]
None
def v0(self) -> None: while self.has_ended is False: try: while self.has_ended is False: self.content() except KeyboardInterrupt: if self.end_game() is True: self.has_ended = True break else: continue
[]
[]
[]
11
from casino.users.users import BaseUser class Game: """A skeleton for a game This class should inherited by another class which should extend the content method. You use this class by invoking the play method which repeats the content method in a loop. Attributes: has_ended: Checks if the ga...
null
v0
[ "bool" ]
bool
def v0(self, v1: bool=False) -> bool: v2 = False if v1 is True: v2 = True else: v3 = self.validate_input('Do you really want to quit?[y/n]', ('y', 'n')) if v3 == 'y': v2 = True elif v3 == 'n': v2 = False return v2
[]
[]
[]
11
from casino.users.users import BaseUser class Game: """A skeleton for a game This class should inherited by another class which should extend the content method. You use this class by invoking the play method which repeats the content method in a loop. Attributes: has_ended: Checks if the ga...
null
v0
[ "tf.Tensor", "tf.Tensor", "tf.Tensor" ]
Any
def v0(v1: tf.Tensor, v2: tf.Tensor, v3: tf.Tensor): v4 = tf.shape(v2)[0] v5 = tf.expand_dims(v4, axis=0) v5 = tf.expand_dims(v5, axis=0) v5 = tf.pad(v5, [[0, 0], [0, 3]]) v5 = tf.cast(v5, tf.float32) v6 = tf.constant([[0]], dtype=tf.int64) v2 = tf.pad(v2, [[0, 100 - 1 - v4], [0, 0]], mode='...
[]
[ "tensorflow" ]
[ "import tensorflow as tf" ]
12
import tensorflow as tf import numpy as np def normalized_images(image, config): """ Normalized images. torch_resnet is used on finetuning since the weights are based on the original paper training code from pytorch. tf_resnet is used when training from scratch with a resnet50 traine don tensorflow....
null
v0
[ "Any", "Any", "Any" ]
Iterable[Tuple[Any, Any]]
def v0(v1, v2, v3=None) -> Iterable[Tuple[Any, Any]]: v4 = [iter(v1)] * v2 return zip_longest(*v4, fillvalue=v3)
[]
[ "itertools" ]
[ "from itertools import zip_longest" ]
3
import json import tempfile from datetime import datetime, timedelta from enum import Enum from itertools import zip_longest from threading import Timer from typing import Any, List, Optional, Dict, Iterable, Tuple import sentry_sdk from telegram import ParseMode, TelegramError, Update, Message, ChatPermissions from t...
null
v0
[]
None
def v0(self) -> None: self.state['chats'] = [chat.serialize() for v1 in self.chats.values()] with open('state.json', 'w+') as v2: json.dump(self.state, v2)
[]
[ "json" ]
[ "import json" ]
4
import json import tempfile from datetime import datetime, timedelta from enum import Enum from itertools import zip_longest from threading import Timer from typing import Any, List, Optional, Dict, Iterable, Tuple import sentry_sdk from telegram import ParseMode, TelegramError, Update, Message, ChatPermissions from t...
null
v0
[ "Optional[str]", "bool", "bool" ]
Optional[str]
def v0(v1: Optional[str], v2: bool=True, v3: bool=False) -> Optional[str]: v1 = None if v3 and v1 in ('null', 'undefined') else v1 return unquote_plus(v1) if v2 and v1 else v1
[]
[ "urllib" ]
[ "from urllib.parse import unquote_plus" ]
3
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "str" ]
Any
def v0(v1: str): if isinstance(v1, (int, float)): return v1 if v1.isdigit(): return int(v1) try: return float(v1) except ValueError: return None
[]
[]
[]
9
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "timedelta" ]
str
def v0(v1: timedelta) -> str: if v1 < timedelta(0): return '-' + str(abs(v1)) else: return str(v1)
[]
[ "datetime" ]
[ "from datetime import date, datetime, time, timedelta" ]
5
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v4
[ "Any", "bool" ]
str
def v4(v5: Any, v6: bool=False) -> str: v7 = v0(v5) if v7 is not None: return v7 if isinstance(v5, (datetime, date, time, pd.Timestamp)): v5 = v5.isoformat() elif v6: return 'Unserializable [{}]'.format(type(v5)) else: raise TypeError('Unserializable object {} of type...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1: Any) -> Any:\n if isinstance(v1, memoryview):\n v1 = v1.tobytes()\n if isinstance(v1, np.int64):\n return int(v1)\n elif isinstance(v1, np.bool_):\n return bool(v1)\n elif i...
[ "datetime", "decimal", "numpy", "pandas", "uuid" ]
[ "import decimal", "import uuid", "from datetime import date, datetime, time, timedelta", "import numpy as np", "import pandas as pd" ]
11
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "Exception" ]
str
def v0(v1: Exception) -> str: v2 = '' if hasattr(v1, 'message'): if isinstance(v1.message, dict): v2 = v1.message.get('message') elif v1.message: v2 = v1.message return v2 or str(v1)
[]
[]
[]
8
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "str" ]
List[str]
def v0(v1: str) -> List[str]: with open(v1) as v2: v3 = v2.read().split('\n') if v3[-1] == '': v3.pop() return v3
[]
[]
[]
6
from os import path from typing import List from setuptools import setup, find_packages from tikup.tikup import getVersion def read_multiline_as_list(file_path: str) -> List[str]: with open(file_path) as file_handler: contents = file_handler.read().split("\n") if contents[-1] == "": ...
null
v0
[ "str", "Set[str]", "str", "Any" ]
Any
def v0(v1: str, v2: Set[str], v3: str, v4): for v5 in v4.get_foreign_keys(v1): if v5['referred_table'] == v3 and set(v5['referred_columns']) == v2: return v5['name']
[]
[]
[]
4
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "str" ]
List[str]
def v0(v1: str) -> List[str]: v2: List[str] = [] if isinstance(v1, str): if ',' in v1: v2 = v1.split(',') elif '\n' in v1: v2 = v1.split('\n') elif ';' in v1: v2 = v1.split(';') else: v2 = [v1] return [x.strip() for v3 in v2 if ...
[]
[]
[]
12
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "bytes", "Optional[bool]" ]
Union[bytes, str]
def v0(v1: bytes, v2: Optional[bool]=True) -> Union[bytes, str]: if isinstance(v1, bytes): v3 = zlib.decompress(v1) else: v3 = zlib.decompress(bytes(v1, 'utf-8')) return v3.decode('utf-8') if v2 else v3
[]
[ "zlib" ]
[ "import zlib" ]
6
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v7
[ "Dict[str, Any]" ]
None
def v7(v8: Dict[str, Any]) -> None: if 'extra_filters' in v8: if 'adhoc_filters' not in v8 or not isinstance(v8['adhoc_filters'], list): v8['adhoc_filters'] = [] v9 = {'__time_range': 'time_range', '__time_col': 'granularity_sqla', '__time_grain': 'time_grain_sqla', '__time_origin': 'dru...
[ { "name": "v0", "input_types": [ "Dict[str, Any]" ], "output_type": "str", "code": "def v0(v1: Dict[str, Any]) -> str:\n if 'expressionType' in v1:\n return '{}__{}'.format(v1['subject'], v1['operator'])\n else:\n return '{}__{}'.format(v1['col'], v1['op'])", "depen...
[ "uuid" ]
[ "import uuid" ]
34
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "Dict[str, Any]", "Dict[str, Any]" ]
None
def v0(v1: Dict[str, Any], v2: Dict[str, Any]) -> None: v3 = v1.get('url_params', {}) for (v4, v5) in v2.items(): if v4 in ('form_data', 'r'): continue v3[v4] = v5 v1['url_params'] = v3
[]
[]
[]
7
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = v1.split(' ') v3 = ['days', 'years', 'hours', 'day', 'year', 'weeks'] if len(v2) == 2 and v2[1] in v3: v1 += ' ago' return v1
[]
[]
[]
6
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "str", "str", "str", "str" ]
Iterator[str]
def v0(v1: str, v2: str=' ', v3: str='"', v4: str='\\"') -> Iterator[str]: v5 = 0 v6 = False v7 = 0 for (v8, v9) in enumerate(v1): v10 = v5 == 0 and (not v6) if v10 and v9 == v2: yield v1[v7:v8] v7 = v8 + len(v2) elif v9 == '(': v5 += 1 ...
[]
[]
[]
19
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[]
csc_matrix
def v0(self) -> csc_matrix: v1 = 1j * self._phi_operator() return sp.sparse.linalg.expm(v1)
[]
[ "scipy" ]
[ "import scipy as sp", "from scipy import sparse", "from scipy.sparse.csc import csc_matrix", "from scipy.sparse.dia import dia_matrix" ]
3
# cos2phi_qubit.py # # This file is part of scqubits. # # Copyright (c) 2019, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ###########################################...
null
v0
[]
csc_matrix
def v0(self) -> csc_matrix: v1 = -1j * 0.5 * self._exp_i_phi_operator() v1 += v1.conj().T return v1
[]
[]
[]
4
# cos2phi_qubit.py # # This file is part of scqubits. # # Copyright (c) 2019, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ###########################################...
null
v0
[]
csc_matrix
def v0(self) -> csc_matrix: v1 = np.arange(-self.ncut, self.ncut + 1) return dia_matrix((v1, [0]), shape=(self._dim_theta(), self._dim_theta())).tocsc()
[]
[ "numpy", "scipy" ]
[ "import numpy as np", "import scipy as sp", "from numpy import ndarray", "from scipy import sparse", "from scipy.sparse.csc import csc_matrix", "from scipy.sparse.dia import dia_matrix" ]
3
# cos2phi_qubit.py # # This file is part of scqubits. # # Copyright (c) 2019, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ###########################################...
null
v0
[]
csc_matrix
def v0(self) -> csc_matrix: v1 = 0.5 * sparse.dia_matrix((np.ones(self._dim_theta()), [1]), shape=(self._dim_theta(), self._dim_theta())).tocsc() v1 -= 0.5 * sparse.dia_matrix((np.ones(self._dim_theta()), [-1]), shape=(self._dim_theta(), self._dim_theta())).tocsc() return v1 * -1j
[]
[ "numpy", "scipy" ]
[ "import numpy as np", "import scipy as sp", "from numpy import ndarray", "from scipy import sparse", "from scipy.sparse.csc import csc_matrix", "from scipy.sparse.dia import dia_matrix" ]
4
# cos2phi_qubit.py # # This file is part of scqubits. # # Copyright (c) 2019, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ###########################################...
null
v0
[]
csc_matrix
def v0(self) -> csc_matrix: v1 = self._dim_theta() return sparse.eye(v1)
[]
[ "scipy" ]
[ "import scipy as sp", "from scipy import sparse", "from scipy.sparse.csc import csc_matrix", "from scipy.sparse.dia import dia_matrix" ]
3
# cos2phi_qubit.py # # This file is part of scqubits. # # Copyright (c) 2019, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ###########################################...
null
v0
[]
csc_matrix
def v0(self) -> csc_matrix: v1 = self._sin_phi_operator() * np.cos(self.flux * np.pi) + self._cos_phi_operator() * np.sin(self.flux * np.pi) v2 = 2 * self.EJ * self._kron3(v1, self._identity_zeta(), self._cos_theta_operator()) * np.pi v3 = self._cos_phi_operator() * np.cos(self.flux * np.pi) - self._sin_phi...
[]
[ "numpy" ]
[ "import numpy as np", "from numpy import ndarray" ]
6
# cos2phi_qubit.py # # This file is part of scqubits. # # Copyright (c) 2019, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ###########################################...
null
v0
[ "str", "str" ]
int
def v0(self, v1: str, v2: str) -> int: v3 = [[0 for v4 in range(len(v2) + 1)] for v4 in range(len(v1) + 1)] for v5 in range(len(v1) + 1): v3[v5][0] = 1 for v5 in range(1, len(v1) + 1): for v6 in range(1, len(v2) + 1): v3[v5][v6] = v3[v5 - 1][v6] + (v1[v5 - 1] == v2[v6 - 1]) * v3[...
[]
[]
[]
8
class Solution: def numDistinct(self, s: str, t: str) -> int: dp=[[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)] for i in range(len(s)+1): dp[i][0]=1 for i in range(1, len(s)+1): for j in range(1, len(t)+1): dp[i][j]=dp[i-1][j]+(s[i-1]==t[j-1])...
null
v0
[ "int | None", "str | None" ]
None
async def v0(self, v1: int | None=None, v2: str | None=None, **v3: Any) -> None: if v1 is not None: await self.async_set_percentage(v1) return await self._device.set_speed(self._default_on_speed)
[]
[]
[]
5
"""Support for deCONZ fans.""" from __future__ import annotations from typing import Any, Literal from pydeconz.light import ( FAN_SPEED_25_PERCENT, FAN_SPEED_50_PERCENT, FAN_SPEED_75_PERCENT, FAN_SPEED_100_PERCENT, FAN_SPEED_OFF, Fan, ) from homeassistant.components.fan import DOMAIN, FanEnt...
null
v0
[ "int", "int" ]
Any
def v0(self, v1: int, v2: int=0, **v3): v1 = int(v1) if not self.mode == 'rb': raise ValueError('Seek only available in read mode') if v2 == 0: v4 = v1 elif v2 == 1: v4 = self.loc + v1 elif v2 == 2: v4 = self.size + v1 else: raise ValueError('invalid whenc...
[]
[]
[]
16
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import asyncio from glob import has_magic import io import logging import os import warnings import weakref from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceNotFoundError, ...
null
v0
[ "Any", "Any", "bool" ]
Any
def v0(self, v1, v2='/', v3: bool=False, **v4): if v1 in ['', v2]: return ('', '') v1 = self._strip_protocol(v1) v1 = v1.lstrip(v2) if '/' not in v1: return (v1, '') else: return v1.split(v2, 1)
[]
[]
[]
9
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import asyncio from glob import has_magic import io import logging import os import warnings import weakref from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceNotFoundError, ...
null
v0
[ "str", "Any" ]
Any
async def v0(self, v1: str, v2=None, **v3): v1 = self._strip_protocol(v1) v4 = {} v5 = {} v6 = {} v7 = v3.pop('detail', False) try: v8 = await self._ls(v1, return_glob=True, **v3) except (FileNotFoundError, IOError): v8 = [] for v9 in v8: v10 = v9['name'].rstrip('...
[]
[]
[]
32
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import asyncio from glob import has_magic import io import logging import os import warnings import weakref from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceNotFoundError, ...
null
v0
[ "int", "int" ]
Any
async def v0(self, v1: int, v2: int=None, **v3): if v2 and v2 > self.size: v4 = self.size - v1 else: v4 = None if v2 is None else v2 - v1 async with self.container_client: v5 = await self.container_client.download_blob(blob=self.blob, offset=v1, length=v4) v6 = await v5.reada...
[]
[]
[]
9
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import asyncio from glob import has_magic import io import logging import os import warnings import weakref from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceNotFoundError, ...
null
v0
[ "str" ]
List[str]
def v0(self, v1: str) -> List[str]: v2 = re.split('\\s+', self.norm(v1)) if v2 == ['']: return [] return v2
[]
[ "re" ]
[ "import re" ]
5
r"""Whitespace :term:`tokenizer` class.""" import re from typing import ClassVar, List, Sequence from lmp.tknzr._base import BaseTknzr class WsTknzr(BaseTknzr): r"""Whitespace :term:`tokenizer` class. Tokenize text into (unicode) whitespace seperate tokens. No whitespace will be preserved after tokeniz...
null
v0
[ "List[str]" ]
List[str]
def v0(v1: List[str]) -> List[str]: v2 = v1 if len(v1) == 1 and v1[0] == 'not_initialized': v2 = ['default'] return v2
[]
[]
[]
5
# /******************************************************************************* # Copyright Intel Corporation. # This software and the related documents are Intel copyrighted materials, and your use of them # is governed by the express license under which they were provided to you (License). # Unless the License pro...
null
v0
[ "'OrgHeading'" ]
Any
def v0(self, v1: 'OrgHeading'): v1.depth = self.depth + 1 self.subheadings.append(v1)
[]
[]
[]
3
from datetime import datetime class OrgLink: def __init__(self, title, url) -> None: self.title = title self.url = url def __str__(self) -> str: return f'[[{self.url}][{self.title}]]' class OrgDate: def __init__(self, date: datetime) -> None: self.date : datetime = dat...
null
v0
[]
str
def v0(self) -> str: if self.tags: return f" :{':'.join(self.tags)}:" else: return ''
[]
[]
[]
5
from datetime import datetime class OrgLink: def __init__(self, title, url) -> None: self.title = title self.url = url def __str__(self) -> str: return f'[[{self.url}][{self.title}]]' class OrgDate: def __init__(self, date: datetime) -> None: self.date : datetime = dat...
null
v0
[ "str" ]
Any
def v0(self, v1: str): v2 = requests.get(f'{self.api}/{v1}') v2.raise_for_status() return v2.json()
[]
[ "requests" ]
[ "import requests" ]
4
from typing import Dict import matplotlib.pyplot as plt import matplotlib import pandas as pd import requests class GekkoClient: def __init__(self, url="http://localhost:3000"): self.url = url self.api = f"{url}/api" def get(self, endpoint: str): """ Send GET request to Gekko and ret...
null
v0
[ "str", "str", "bool", "bool" ]
Any
def v0(v1: str, v2: str, v3: bool=False, v4: bool=True): v5 = None v6 = Path(v1).stem.split('-')[-1] v7 = logging.getLogger(__name__) try: v8 = hashlib.sha256() if Path(v1).exists(): v7.info('"%s" already exists. Checking hash.', v1) with Path(v1).open('rb') as v9...
[]
[ "hashlib", "logging", "os", "pathlib", "requests", "shutil", "tempfile", "tqdm" ]
[ "import hashlib", "import logging", "import os", "import shutil", "import tempfile", "from pathlib import Path", "import requests", "import tqdm" ]
40
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import functools import hashlib import json import logging import os import shutil import tempfile from pathlib import Path from typing import Optional import requests import tqdm from playhouse.sqlite_ext import SqliteExtDatabase from .constan...
null
v0
[ "int", "Any" ]
Any
def v0(self, v1: int, v2): (v3, v4, v5) = v2 if self.renderable_uses_agg_context(v1): return (v4, None, None) elif self.renderable_uses_scan_context(v1): return (v5, None, None) else: return v2
[]
[]
[]
8
import abc from hail.utils.java import Env from .renderer import Renderer, PlainRenderer, Renderable def _env_bind(env, bindings): if bindings: if env: res = env.copy() res.update(bindings) return res else: return dict(bindings) else: re...
null
v4
[ "int", "Any", "Any" ]
Any
def v4(self, v5: int, v6, v7=None): v8 = self.renderable_child_context_without_bindings(v5, v6) v9 = self.bindings(v5, v7) v10 = self.agg_bindings(v5, v7) v11 = self.scan_bindings(v5, v7) if v9 or v10 or v11: (v12, v13, v14) = v8 return (v0(v12, v9), v0(v13, v10), v0(v14, v11)) e...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n if v2:\n if v1:\n v3 = v1.copy()\n v3.update(v2)\n return v3\n else:\n return dict(v2)\n else:\n return v1", "d...
[]
[]
10
import abc from hail.utils.java import Env from .renderer import Renderer, PlainRenderer, Renderable def _env_bind(env, bindings): if bindings: if env: res = env.copy() res.update(bindings) return res else: return dict(bindings) else: re...
null
v0
[ "Text" ]
bool
def v0(self, v1: Text) -> bool: v2 = v1[0:self._crop_at_length].split() if not v2: return False v3 = 0 for v4 in v2: v3 += len(v4) v5 = float(v3) / len(v2) if self._avg_word_length_min <= v5 <= self._avg_word_length_max and len(v2) >= self._min_words_per_value: return Tru...
[]
[]
[]
11
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
null
v0
[ "np.ndarray", "np.ndarray", "float" ]
Any
def v0(self, v1: np.ndarray, v2: np.ndarray, v3: float): v4 = np.abs(v1 - v2).max() self.assertLessEqual(v4, v3, f'Difference between torch and flax is {v4} (>= {v3}).')
[]
[ "numpy" ]
[ "import numpy as np" ]
3
# Copyright 2020 The HuggingFace Team. 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 applicabl...
null
v0
[]
t.Dict[str, t.Any]
def v0(self) -> t.Dict[str, t.Any]: v1 = [entri.to_dict() for v2 in self._entri] return {'kelas': self.kelas_kata, 'entri': v1}
[]
[]
[]
3
""" :mod:`tesaurus` -- Modul Tesaurus Tematis Python ================================================ .. module:: tesaurus :platform: Unix, Windows, Mac :synopsis: Modul ini mengandung implementasi scrapper Tesaurus Tematis Kemendikbud .. moduleauthor:: noaione <noaione0809@gmail.com> """ import asyncio impor...
null
v0
[ "str", "Any" ]
None
def v0(v1: str, v2=None) -> None: if v2 is None: v2 = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' if v1: v3 = logging.DEBUG else: v3 = logging.INFO logging.basicConfig(level=v3, format=v2)
[]
[ "logging" ]
[ "import logging" ]
8
import argparse import logging import os import sys from config import UrlConfigFile from server import AlreadyRegistered, run, server_methods LOG = logging.getLogger(__name__) DEFAULT_PORT = 5000 def configure_logging(debug: str, format=None) -> None: if format is None: format = "%(asctime)s - %(name)s...
null
v0
[ "ndarray", "Union[DataFrame, ndarray]", "ndarray", "Union[DataFrame, ndarray]", "Any" ]
Any
def v0(self, v1: ndarray, v2: Union[DataFrame, ndarray], v3: ndarray, v4: Union[DataFrame, ndarray], v5=60): (*v6, v7) = self._setup_training() v2 = np.array(v2) v4 = np.array(v4) v8 = self.model.fit(v1, v2, validation_data=(v3, v4), epochs=v5, batch_size=256, verbose=1, callbacks=v6) return (v8, v7...
[]
[ "numpy" ]
[ "import numpy as np", "from numpy import ndarray" ]
6
from typing import Union import numpy as np import tensorflow.keras as keras from numpy import ndarray from pandas import DataFrame from .model_helpers import make_tensorboard_callback, make_save_path from ..utils import naming class SimpleModel: def __init__(self, directory_name: str, n_input: int, n_output: i...
null
v0
[]
str
def v0() -> str: v1 = os.environ.get('CONDA_PREFIX', '') return os.path.basename(v1)
[]
[ "os" ]
[ "import os", "import os.path" ]
3
""" Utilities for getting relevant environment information. """ from __future__ import annotations import logging import os import os.path import pkgutil import pkg_resources logger = logging.getLogger(__name__) _dev_ignore_list = ['ami', 'pdsapp'] def not_ignored(path: list[str], ignores: list[str] = None) -> bo...
null
v12
[]
str
def v12() -> str: v13 = v0() v14 = sorted(v2()) v15 = f"Environment Information\n Conda Environment: {v13}\n Development Packages: {' '.join(v14)}" return v15
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n v1 = os.environ.get('CONDA_PREFIX', '')\n return os.path.basename(v1)", "dependencies": [] }, { "name": "v2", "input_types": [], "output_type": "set[str]", "code": "def v2() -> set[str]...
[ "os" ]
[ "import os", "import os.path" ]
5
""" Utilities for getting relevant environment information. """ from __future__ import annotations import logging import os import os.path import pkgutil import pkg_resources logger = logging.getLogger(__name__) _dev_ignore_list = ['ami', 'pdsapp'] def not_ignored(path: list[str], ignores: list[str] = None) -> bo...
null
v4
[ "v0" ]
v0
def v4(v5: v0) -> v0: def v6(*v7: Any, **v8: Any) -> Any: return v5(*v7, **v8) return v6
[ { "name": "v1", "input_types": [], "output_type": "Any", "code": "def v1(*v2: Any, **v3: Any) -> Any:\n return f(*v2, **v3)", "dependencies": [] } ]
[]
[]
5
# Simple support library for our run tests. from contextlib import contextmanager from typing import ( Any, Iterator, TypeVar, Generator, Optional, List, Tuple, Sequence, Union, Callable, ) @contextmanager def assertRaises(typ: type, msg: str = '') -> Iterator[None]: try: yield except Exceptio...
[ "v0 = TypeVar('F', bound=Callable)" ]
v0
[ "Any", "Any", "Any", "list", "list" ]
Any
def v0(self, v1, v2, v3, v4: list, v5: list): if v2 == 0: v5.append(v4[:]) if v2 < v1[0]: return for v6 in v1: if v6 > v2: return if v6 < v3: continue v4.append(v6) self.dfs(v1, v2 - v6, v6, v4, v5) v4.pop()
[]
[]
[]
13
class Solution: def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ results = [] candidates = sorted(candidates) self.dfs(candidates, target, 0, [], results) return results...
null
v0
[ "'Piece'" ]
None
def v0(self, v1: 'Piece') -> None: v2 = self.__pieces_to_coordinates.get(v1, None) if v2: self.__coordinates_to_pieces[v2].remove(v1) self.__pieces_to_coordinates.pop(v1, None) if type(v1) in self.__piece_types_to_pieces and v1 in self.__piece_types_to_pieces[type(v1)]: self.__piece_...
[]
[]
[]
9
from typing import List, Iterable, Dict, Set, TYPE_CHECKING from app_container import AppContainer, UsesAppContainer from coordinate import Coordinate from pieces.floor import FloorPiece from pieces.wall import WallPiece if TYPE_CHECKING: from pieces.piece import Piece class Grid(UsesAppContainer): def __in...
null
v0
[ "type" ]
Set['Piece']
def v0(self, v1: type) -> Set['Piece']: if not v1 in self.__piece_types_to_pieces: self.__piece_types_to_pieces[v1] = set() return set(self.__piece_types_to_pieces[v1])
[]
[]
[]
4
from typing import List, Iterable, Dict, Set, TYPE_CHECKING from app_container import AppContainer, UsesAppContainer from coordinate import Coordinate from pieces.floor import FloorPiece from pieces.wall import WallPiece if TYPE_CHECKING: from pieces.piece import Piece class Grid(UsesAppContainer): def __in...
null
v4
[]
Callable[[Callable[..., Any]], Callable[..., Any]]
def v4(**v5: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: def v6(v7: Callable[..., Any]) -> Callable[..., Any]: for (v8, v9) in v5.items(): setattr(v7, v8, v9) return v7 return v6
[ { "name": "v0", "input_types": [ "Callable[..., Any]" ], "output_type": "Callable[..., Any]", "code": "def v0(v1: Callable[..., Any]) -> Callable[..., Any]:\n for (v2, v3) in variables.items():\n setattr(v1, v2, v3)\n return v1", "dependencies": [] } ]
[]
[]
7
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[]
None
def v0(self) -> None: assert self._codename_to_terminal_code is not None assert self._previous_displayed_menu_height is not None assert self._tty_out is not None if self._clear_menu_on_exit: if self._title_lines: self._tty_out.write(len(self._title_lines) * self._codename_to_terminal...
[]
[]
[]
12
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[ "bool" ]
str
def v0(self, v1: bool=True) -> str: assert self._terminal_code_to_codename is not None assert self._tty_in is not None self._reading_next_key = True if self._paint_before_next_read: self._paint_menu() self._paint_before_next_read = False v2 = os.read(self._tty_in.fileno(), 80).decode...
[]
[ "os" ]
[ "import os" ]
15
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[]
None
def v0(self) -> None: if self._search_regex is None: self._matches = [] else: v1 = [] for (v2, v3) in enumerate(self._menu_entries): v4 = self._search_regex.search(v3) if v4: v1.append((v2, v4)) self._matches = v1
[]
[]
[]
10
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[ "int" ]
bool
def v0(self, v1: int) -> bool: self[v1] = v1 not in self._selected_menu_indices return self[v1]
[]
[]
[]
3
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[]
None
def v0(self) -> None: if self._search and self._search.search_text != '': self._displayed_index_to_menu_index = tuple((i for (v1, v2) in self._search.matches)) else: self._displayed_index_to_menu_index = tuple(range(len(self._menu_entries))) self._menu_index_to_displayed_index = {menu_index:...
[]
[]
[]
10
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[]
None
def v0(self) -> None: if self._selected_displayed_index is not None: if self._selected_displayed_index + 1 < len(self._displayed_index_to_menu_index): self._selected_displayed_index += 1 elif self._cycle_cursor: self._selected_displayed_index = 0 self._viewport.keep_v...
[]
[]
[]
7
#!/usr/bin/env python3 import argparse import copy import ctypes import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( cast, Any, Callable, Dict, Iterable, Iterator,...
null
v0
[]
None
def v0(self) -> None: if self._selected_displayed_index is not None: if self._selected_displayed_index > 0: self._selected_displayed_index -= 1 elif self._cycle_cursor: self._selected_displayed_index = len(self._displayed_index_to_menu_index) - 1 self._viewport.keep_v...
[]
[]
[]
7
#!/usr/bin/env python3 import argparse import copy import ctypes import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( cast, Any, Callable, Dict, Iterable, Iterator,...
null
v0
[ "int" ]
Optional[int]
def v0(self, v1: int) -> Optional[int]: if v1 in self._menu_index_to_displayed_index: return self._menu_index_to_displayed_index[v1] else: return None
[]
[]
[]
5
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[ "Optional[int]", "bool" ]
None
def v0(self, v1: Optional[int], v2: bool=True) -> None: if v1 is None: v1 = 0 if v2: self.update_terminal_size() if self._viewport[0] <= v1 <= self._viewport[1]: return if v1 < self._viewport[0]: v3 = v1 - self._viewport[0] else: v3 = v1 - self._viewport[1] ...
[]
[]
[]
12
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null
v0
[]
None
def v0(self) -> None: v1 = self._calculate_num_lines() if v1 != self._num_lines: v2 = min(v1, self._num_menu_entries) - 1 v3 = max(0, v2 - v1) self._viewport = (v3, v2) self._num_lines = v1
[]
[]
[]
7
#!/usr/bin/env python3 import argparse import copy import ctypes import io import locale import os import platform import re import shlex import signal import string import subprocess import sys from locale import getlocale from types import FrameType from typing import ( Any, Callable, Dict, Iterable,...
null