name
stringclasses
293 values
input_types
listlengths
0
49
output_type
stringlengths
1
180
code
stringlengths
37
97.8k
dependencies
listlengths
0
6
lib_used
listlengths
0
11
imports
listlengths
0
40
line_count
int64
3
155
full_code
stringlengths
51
996k
input_type_defs
listlengths
1
11
v0
[]
np.ndarray
def v0(self) -> np.ndarray: if self.number_tracks() == 0: return np.array([], dtype=np.uint32) v1 = [self.get_track(j).number_measurements() for v2 in range(self.number_tracks())] return np.array(v1, dtype=np.uint32)
[]
[ "numpy" ]
[ "import numpy as np" ]
5
"""Class to hold the tracks and cameras of a 3D scene. This can be the output of either data association or of bundle adjustment. Authors: Ayush Baid, John Lambert, Xiaolong Wu """ import itertools from typing import Any, Dict, List, Optional, Tuple import numpy as np from gtsam import PinholeCameraCal3Bundler, Pose3...
null
v0
[]
float
def v0(self) -> float: v1 = self.get_scene_reprojection_errors() v2 = np.mean(v1) return v2
[]
[ "numpy" ]
[ "import numpy as np" ]
4
"""Class to hold the tracks and cameras of a 3D scene. This can be the output of either data association or of bundle adjustment. Authors: Ayush Baid, John Lambert, Xiaolong Wu """ import itertools from typing import Any, Dict, List, Optional, Tuple import numpy as np from gtsam import PinholeCameraCal3Bundler, Pose3...
null
v0
[ "str", "int", "int" ]
int
def v0(self, v1: str, v2: int, v3: int) -> int: if v2 is not None and v2 < v3: raise ValueError(f'{v1} `event_ndims` of {self.name} must be at least {v3} but was passed {v2} instead.') return 0 if v2 is None else v2 - v3
[]
[]
[]
4
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
null
v0
[ "str", "Any", "int" ]
Any
def v0(self, v1: str, v2: Any, v3: int): if len(v2) < v3: raise ValueError(f'{v1} `event_shape` of {self.name} must have at least {v3} dimensions, but was {v2} which has only {len(v2)} dimensions instead.')
[]
[]
[]
3
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
null
v0
[ "int", "int", "bool" ]
Union[float, dict]
def v0(self, v1: int=None, v2: int=None, v3: bool=False) -> Union[float, dict]: v4 = self.rate_clusters(v1, v2) v5 = self._data.groupby(self._cluster_column_name) v6 = 0 v7 = 0 v8 = 0 for v9 in v4: v10 = v5.get_group(v9)[self._object_column_name].unique() v11 = v5.get_group(v9)[s...
[]
[]
[]
35
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "int", "int", "bool" ]
Union[float, dict]
def v0(self, v1: int=None, v2: int=None, v3: bool=False) -> Union[float, dict]: v4 = self.rate_clusters(v1, v2) (v5, v6) = self.get_num_timestamps(v1, v2, return_timestamps=True) v7 = 0 if v3: v8 = 0 v9 = 0 for v10 in v6: if not v3: v7 += self.calc_t_clustering_ra...
[]
[]
[]
32
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "dict", "int", "bool" ]
Union[float, dict]
def v0(self, v1: dict, v2: int, v3: bool=False) -> Union[float, dict]: v4 = 0 v5 = self._data[self._data[self._time_column_name] == v2][self._cluster_column_name].unique() v5 = np.delete(v5, np.where(v5 < 0)) for v6 in v5: try: v4 += v1[v6] except: continue v7...
[]
[ "numpy" ]
[ "import numpy as np" ]
25
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "int", "int", "Union[int, str, list]" ]
dict
def v0(self, v1: int=None, v2: int=None, v3: Union[int, str, list]=None) -> dict: v4 = self.get_ids_to_rate(v3, self._cluster_column_name, v1, v2) v5 = v4[:] for v6 in v4: if int(v6) < 0: v5.remove(v6) v7 = self.calc_cluster_rating(v5, v1) return v7
[]
[]
[]
8
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "Union[list, np.ndarray]", "int" ]
dict
def v0(self, v1: Union[list, np.ndarray], v2: int=None) -> dict: if v2 is None: v2 = np.min(self._data[self._time_column_name].unique()) v3 = {} v4 = self.obtain_cluster_compositions() v5 = self._data.groupby(self._cluster_column_name) for v6 in v1: v7 = v5.get_group(v6)[self._time_c...
[]
[ "numpy" ]
[ "import numpy as np" ]
36
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "Union[int, str, list]", "int", "int" ]
dict
def v0(self, v1: Union[int, str, list]=None, v2: int=None, v3: int=None) -> dict: v4 = self.get_ids_to_rate(v1, self._object_column_name) if v3 is None: v3 = np.max(self._data[self._time_column_name].unique()) v5 = self.obtain_cluster_compositions() v6 = self.calc_object_rating(v5, v4, v3, v2) ...
[]
[ "numpy" ]
[ "import numpy as np" ]
7
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "dict", "Union[list, np.ndarray]", "int", "int" ]
dict
def v0(self, v1: dict, v2: Union[list, np.ndarray], v3: int, v4: int=None) -> dict: v5 = {} v6 = self._data.groupby(self._object_column_name) for v7 in v2: v8 = v6.get_group(v7) v8 = v8[v8[self._time_column_name] <= v3] if v4 is not None: v8 = v8[v8[self._time_column_name...
[]
[ "numpy" ]
[ "import numpy as np" ]
52
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[]
float
def v0(self) -> float: v1 = len(self._data[self._object_column_name].unique()) v2 = len(self._data[self._data[self._cluster_column_name] >= 0][self._object_column_name].unique()) return v2 / v1
[]
[]
[]
4
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "Union[list, np.ndarray]", "int" ]
np.ndarray
def v0(self, v1: Union[list, np.ndarray], v2: int) -> np.ndarray: v3 = [] for v4 in v1: v5 = self._data[(self._data[self._object_column_name] == v4) & (self._data[self._time_column_name] == v2)] try: v5 = v5.drop([self._object_column_name, self._cluster_column_name, self._time_column...
[]
[ "numpy" ]
[ "import numpy as np" ]
14
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "int", "int", "bool" ]
int
def v0(self, v1: int, v2: int, v3: bool=False) -> int: v4 = self._data[self._time_column_name].unique() if v1 is not None: v4 = [i for v5 in v4 if v5 >= v1] if v2 is not None: v4 = [v5 for v5 in v4 if v5 <= v2] v6 = len(v4) if not v3: return v6 else: return (v6, v...
[]
[]
[]
11
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "Union[int, str, list]", "str", "int", "int" ]
list
def v0(self, v1: Union[int, str, list], v2: str, v3: int=None, v4: int=None) -> list: if v1 is None: v5 = self._data.copy() if v3 is not None: v5 = v5[v5[self._time_column_name] >= v3] if v4 is not None: v5 = v5[v5[self._time_column_name] <= v4] v6 = v5[v2].un...
[]
[]
[]
15
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[]
dict
def v0(self) -> dict: v1 = {} v2 = self._data.groupby([self._time_column_name, self._cluster_column_name]) if not self._jaccard: v3 = self._data.groupby(self._cluster_column_name).count() for (v4, v5) in v2: if int(v4[1]) < 0: continue v5 = v5[self._object_column_name...
[]
[]
[]
23
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "list" ]
float
def v0(self, v1: list) -> float: v2 = self.calc_sse(v1) return v2 / len(v1)
[]
[]
[]
3
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "list" ]
float
def v0(self, v1: list) -> float: v2 = 0 for v3 in range(len(v1)): v4 = [10] * self._minPts for v5 in range(len(v1)): if v3 == v5: continue v6 = euclidean(np.array(v1[v3]), np.array(v1[v5])) for v7 in range(len(v4)): if v6 < v4[v...
[]
[ "numpy", "scipy" ]
[ "import numpy as np", "from scipy.spatial.distance import euclidean" ]
15
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "int" ]
float
def v0(self, v1: int) -> float: v2 = len(self._data[self._data[self._time_column_name] == v1][self._object_column_name].unique()) v3 = len(self._data[(self._data[self._time_column_name] == v1) & (self._data[self._cluster_column_name] >= 0)][self._object_column_name].unique()) return v3 / v2
[]
[]
[]
4
import numpy as np from scipy.spatial.distance import euclidean from typing import Union import pandas class CLOSE(object): def __init__(self, data: pandas.DataFrame, measure: Union[str, callable] = 'mse', minPts: int = None, output: bool = False, jaccard: bool = False, weighting: bool = False, ...
null
v0
[ "str" ]
Tuple[str, str]
def v0(v1: str) -> Tuple[str, str]: v2 = v1.split('/') if len(v2) == 1: raise TypeError('Type improperly formatted, a namespace is missing: ', v2) if len(v2) > 2: raise ValueError('Type improperly formatted, too many separators: ', v2) return (v2[0], v2[1])
[]
[]
[]
7
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
null
v1
[ "str", "bool" ]
Optional[v0]
def v1(self, v2: str, v3: bool=False) -> Optional[v0]: try: return self.GetField(v2, v3) except TypeError: pass v4 = self._GetField(self.namespace.namespace + '/' + v2, v3) if not v4: v4 = self._GetField('/' + v2, v3) return v4
[]
[]
[]
9
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
[ "v0 = typing.NamedTuple('OptWrapper', [('field', FieldParts), ('optional', bool)])" ]
v4
[ "str", "bool" ]
Optional[v0]
def v4(self, v5: str, v6: bool=False) -> Optional[v0]: (v7, v7) = v1(v5) return self._GetField(v5, v6)
[ { "name": "v1", "input_types": [ "str" ], "output_type": "Tuple[str, str]", "code": "def v1(v2: str) -> Tuple[str, str]:\n v3 = v2.split('/')\n if len(v3) == 1:\n raise TypeError('Type improperly formatted, a namespace is missing: ', v3)\n if len(v3) > 2:\n raise Val...
[]
[]
3
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
[ "v0 = typing.NamedTuple('OptWrapper', [('field', FieldParts), ('optional', bool)])" ]
v0
[]
List[str]
def v0(self, **v1) -> List[str]: v2 = self.get(**v1) v3 = [y for v4 in v2 for v5 in v4.get('tags', [])] return sorted(list(set(v3)))
[]
[]
[]
4
# -*- coding: utf-8 -*- """API for working with saved queries for assets.""" import warnings from typing import Generator, List, Optional, Union from ...constants.api import MAX_PAGE_SIZE from ...exceptions import NotFoundError, ResponseError, ApiWarning # from ...features import Features from ...parsers.tables impor...
null
v0
[ "bool" ]
Union[Generator[dict, None, None], List[dict]]
def v0(self, v1: bool=False) -> Union[Generator[dict, None, None], List[dict]]: v2 = self.get_generator() return v2 if v1 else list(v2)
[]
[]
[]
3
# -*- coding: utf-8 -*- """API for working with saved queries for assets.""" import warnings from typing import Generator, List, Optional, Union from ...constants.api import MAX_PAGE_SIZE from ...exceptions import NotFoundError, ResponseError, ApiWarning # from ...features import Features from ...parsers.tables impor...
null
v0
[]
Generator[dict, None, None]
def v0(self) -> Generator[dict, None, None]: v1 = 0 while True: v2 = self._get(offset=v1) v1 += len(v2) if not v2: break for v3 in v2: yield v3.to_dict()
[]
[]
[]
9
# -*- coding: utf-8 -*- """API for working with saved queries for assets.""" import warnings from typing import Generator, List, Optional, Union from ...constants.api import MAX_PAGE_SIZE from ...exceptions import NotFoundError, ResponseError, ApiWarning # from ...features import Features from ...parsers.tables impor...
null
v0
[ "str" ]
dict
def v0(self, v1: str, **v2) -> dict: v3 = self.get_by_name(value=v1, **v2) self._delete(uuid=v3['uuid']) return v3
[]
[]
[]
4
# -*- coding: utf-8 -*- """API for working with saved queries for assets.""" import warnings from typing import Generator, List, Optional, Union from ...constants.api import MAX_PAGE_SIZE from ...exceptions import NotFoundError, ResponseError, ApiWarning # from ...features import Features from ...parsers.tables impor...
null
v0
[]
argparse.ArgumentParser
def v0() -> argparse.ArgumentParser: v1 = argparse.ArgumentParser(prog='generate_ods') v1.add_argument('--torch_ir_include_dir', required=True, help='Directory in include/ containing the Torch dialect') v1.add_argument('--debug_registry_dump', help='File to dump the the PyTorch JIT operator registry into') ...
[]
[ "argparse" ]
[ "import argparse" ]
5
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # Also available under a BSD-style license. See LICENSE. """Queries the pytorch op registry and generates ODS and CC sourc...
null
v0
[ "datetime" ]
None
def v0(self, v1: datetime) -> None: self.second = v1.second self.minute = v1.minute self.hour = v1.hour self.day_of_month = v1.day self.month = v1.month self.year = v1.year
[]
[]
[]
7
from abc import ABC, abstractmethod from datetime import datetime from typing import Generic, Type, TypeVar, Union from .devices import I2CDevice from .parsers import RegisterParser from .typing import RegisterState BlockType = TypeVar("BlockType") class RegisterBlock(Generic[BlockType], ABC): """ Abstract ...
null
v0
[ "Union[int, slice]", "'RegisterState'" ]
None
def v0(self, v1: Union[int, slice], v2: 'RegisterState') -> None: if isinstance(v1, int): v1 = slice(v1, v1 + 1) if len(v2) != len(self.pending_state[v1]): raise ValueError('Value must have as many bytes as slice') self.pending_state[v1] = v2
[]
[]
[]
6
from abc import ABC, abstractmethod from datetime import datetime from typing import Generic, Type, TypeVar, Union from .devices import I2CDevice from .parsers import RegisterParser from .typing import RegisterState BlockType = TypeVar("BlockType") class RegisterBlock(Generic[BlockType], ABC): """ Abstract ...
null
v0
[ "Dict" ]
Any
async def v0(self, v1: Dict): v2 = [sk.get_g1().get_fingerprint() for (v3, v4) in self.service.keychain.get_all_private_keys()] return {'public_key_fingerprints': v2}
[]
[]
[]
3
import asyncio import logging import time from datetime import datetime from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple from blspy import PrivateKey, G1Element from seno.cmds.init_funcs import check_keys from seno.consensus.block_rewards import calculate_base_farmer_reward from seno....
null
v0
[ "Dict" ]
Any
async def v0(self, v1: Dict): assert self.service.wallet_state_manager is not None v2 = self.service.wallet_state_manager.sync_mode v3 = await self.service.wallet_state_manager.synced() return {'synced': v3, 'syncing': v2, 'genesis_initialized': True}
[]
[]
[]
5
import asyncio import logging import time from datetime import datetime from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple from blspy import PrivateKey, G1Element from seno.cmds.init_funcs import check_keys from seno.consensus.block_rewards import calculate_base_farmer_reward from seno....
null
v0
[ "Dict" ]
Any
async def v0(self, v1: Dict): assert self.service.wallet_state_manager is not None v2 = self.service.wallet_state_manager.peak if v2 is None: return {'height': 0} else: return {'height': v2.height}
[]
[]
[]
7
import asyncio import logging import time from datetime import datetime from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple from blspy import PrivateKey, G1Element from seno.cmds.init_funcs import check_keys from seno.consensus.block_rewards import calculate_base_farmer_reward from seno....
null
v0
[ "Dict" ]
Any
async def v0(self, v1: Dict): assert self.service.wallet_state_manager is not None v2 = self.service.config['selected_network'] v3 = self.service.config['network_overrides']['config'][v2]['address_prefix'] return {'network_name': v2, 'network_prefix': v3}
[]
[]
[]
5
import asyncio import logging import time from datetime import datetime from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple from blspy import PrivateKey, G1Element from seno.cmds.init_funcs import check_keys from seno.consensus.block_rewards import calculate_base_farmer_reward from seno....
null
v0
[ "Dict" ]
Any
async def v0(self, v1: Dict): assert self.service.wallet_state_manager is not None v2: List[WalletInfo] = await self.service.wallet_state_manager.get_all_wallet_info_entries() return {'wallets': v2}
[]
[]
[]
4
import asyncio import logging import time from datetime import datetime from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple from blspy import PrivateKey, G1Element from seno.cmds.init_funcs import check_keys from seno.consensus.block_rewards import calculate_base_farmer_reward from seno....
null
v0
[ "Dict" ]
Any
async def v0(self, v1: Dict): v2 = self.service.constants.INITIAL_FREEZE_END_TIMESTAMP return {'INITIAL_FREEZE_END_TIMESTAMP': v2}
[]
[]
[]
3
import asyncio import logging import time from datetime import datetime from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple from blspy import PrivateKey, G1Element from seno.cmds.init_funcs import check_keys from seno.consensus.block_rewards import calculate_base_farmer_reward from seno....
null
v0
[ "pd.Series", "pd.Series", "int" ]
pd.Series
def v0(v1: pd.Series, v2: pd.Series, v3: int=1) -> pd.Series: v4 = v1 - v2 v5 = abs(v2 - v4) return v5.rolling(window=v3).mean() / v1
[]
[]
[]
4
""" Third generation models implementation (VPIN) """ import pandas as pd def get_vpin(volume: pd.Series, buy_volume: pd.Series, window: int = 1) -> pd.Series: """ Get Volume-Synchronized Probability of Informed Trading (VPIN) from bars, p. 292-293. :param volume: (pd.Series) bar volume :param buy_vo...
null
v0
[ "List[swagger_to.style.Complaint]", "str", "bool", "bool" ]
List[str]
def v0(v1: List[swagger_to.style.Complaint], v2: str, v3: bool, v4: bool) -> List[str]: if v4: v1.sort(key=lambda complaint: complaint.line) v5 = [] for v6 in v1: v7 = '' if v4: v7 += '{}:{} '.format(v2, v6.line) else: v7 += '{}: '.format(v6.where) ...
[]
[]
[]
15
#!/usr/bin/env python3 """Read a correct swagger file and check whether it conforms to a style guide.""" import argparse import pathlib from typing import List import sys import swagger_to.intermediate import swagger_to.style import swagger_to.swagger def main() -> int: """Execute the main routine.""" parse...
null
v0
[ "np.ndarray", "np.ndarray" ]
NoReturn
def v0(self, v1: np.ndarray, v2: np.ndarray) -> NoReturn: v3 = self.__transform(v1) self.linear_regression_model.fit(v3, v2)
[]
[]
[]
3
from __future__ import annotations from typing import NoReturn from . import LinearRegression from ...base import BaseEstimator import numpy as np class PolynomialFitting(BaseEstimator): """ Polynomial Fitting using Least Squares estimation """ def __init__(self, k: int) -> PolynomialFitting: ...
null
v0
[ "np.ndarray" ]
np.ndarray
def v0(self, v1: np.ndarray) -> np.ndarray: v2 = self.__transform(v1) return self.linear_regression_model.predict(v2)
[]
[]
[]
3
from __future__ import annotations from typing import NoReturn from . import LinearRegression from ...base import BaseEstimator import numpy as np class PolynomialFitting(BaseEstimator): """ Polynomial Fitting using Least Squares estimation """ def __init__(self, k: int) -> PolynomialFitting: ...
null
v0
[ "np.ndarray", "np.ndarray" ]
float
def v0(self, v1: np.ndarray, v2: np.ndarray) -> float: v3 = self.__transform(v1) return self.linear_regression_model.loss(v3, v2)
[]
[]
[]
3
from __future__ import annotations from typing import NoReturn from . import LinearRegression from ...base import BaseEstimator import numpy as np class PolynomialFitting(BaseEstimator): """ Polynomial Fitting using Least Squares estimation """ def __init__(self, k: int) -> PolynomialFitting: ...
null
v0
[ "str" ]
Any
def v0(self, v1: str): v2 = [plot[v1] for v3 in self.plots] v4 = self._get_stats(v2) setattr(self, v1, v4['mean']) setattr(self, f'{v1}_stats', v4)
[]
[]
[]
5
from os import ( startfile, getcwd ) from os.path import join from io import BytesIO from csv import ( writer, excel ) from openpyxl import ( Workbook, load_workbook ) from statistics import ( mean, variance, stdev ) from treetopper.plot import Plot from treetopper.timber import ( ...
null
v0
[ "str", "Any" ]
Any
def v0(self, v1: str, v2): self._data[v1] = v2 if self.matchms_key_style is True: self.harmonize_metadata() return self
[]
[]
[]
5
from collections.abc import Mapping import numpy as np from pickydict import PickyDict from .utils import load_known_key_conversions _key_regex_replacements = {r"\s": "_", r"[!?.,;:]": ""} _key_replacements = load_known_key_conversions() class Metadata: """Class to handle spectrum met...
null
v0
[ "np.ndarray" ]
np.ndarray
def v0(v1: np.ndarray) -> np.ndarray: assert isinstance(v1, np.ndarray) assert v1.ndim == 3 return v1[..., 0].astype(np.uint32)
[]
[ "numpy" ]
[ "import numpy as np" ]
4
from typing import Tuple, Union, Callable, Optional, Sequence from pytest_mock import MockerFixture import pytest import numpy as np import dask.array as da from squidpy.im import ( segment, ImageContainer, SegmentationCustom, SegmentationWatershed, ) from squidpy.im._segment import _SEG_DTYPE from sq...
null
v0
[ "DataArray" ]
DataArray
def v0(v1: DataArray) -> DataArray: v2 = v1.stack(latlon=('lat', 'lon')) v3 = v2.argmax('time') return v3.unstack()
[]
[]
[]
4
from typing import Sequence import numpy as np import xarray from xarray import DataArray from xclim.indices.run_length import rle_1d def get_longest_run_start_index( arr: DataArray, window: int = 1, dim: str = "time", ) -> DataArray: return xarray.apply_ufunc( get_index_of_longest_run, ...
null
v7
[ "str" ]
Any
def v7(self, v8: str): v9 = tuple((x.name for v10 in self.tables[v8].primary_key)) def v11(v12: str, v13: Dict, v14) -> List: if not path.isdir(v12): return [] (v15, v16, v15) = next(os.walk(v12)) return [v13 | {v9[v14]: d} for v17 in v16] v18 = 0 v19 = [{}] whil...
[ { "name": "v0", "input_types": [ "str", "Dict", "Any" ], "output_type": "List", "code": "def v0(v1: str, v2: Dict, v3) -> List:\n if not path.isdir(v1):\n return []\n (v4, v5, v4) = next(os.walk(v1))\n return [v2 | {pkey_names[v3]: d} for v6 in v5]", "depend...
[ "os" ]
[ "from os import path", "import os" ]
18
from __future__ import annotations import shutil from betfairlightweight.resources.streamingresources import MarketDefinition from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook from betfairlightweight.streaming.listener import StreamListener import sqlalchemy from sqlalchemy.sql.expr...
null
v3
[ "Callable[[str], Dict]" ]
List[Dict]
def v3(self, v4: Callable[[str], Dict]) -> List[Dict]: def v5(v6, v7): self.insert_strategy_runners(v7, v4) v8 = self._dbc.scan_cache('strategymeta') self._dbc.scan_cache('strategyupdates', v5) return v8
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n self.insert_strategy_runners(v2, profit_func)", "dependencies": [] } ]
[]
[]
7
from __future__ import annotations import shutil from betfairlightweight.resources.streamingresources import MarketDefinition from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook from betfairlightweight.streaming.listener import StreamListener import sqlalchemy from sqlalchemy.sql.expr...
null
v0
[ "Any", "str", "str", "datetime", "dict" ]
Any
def v0(self, v1, v2: str, v3: str, v4: datetime, v5: dict): v6 = {'type': v2, 'name': v3, 'exec_time': v4, 'info': v5} self._dbc.write_to_cache(tbl_nm='strategymeta', pkey_flts={'strategy_id': str(v1)}, data=v6)
[]
[]
[]
3
from __future__ import annotations import shutil from betfairlightweight.resources.streamingresources import MarketDefinition from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook from betfairlightweight.streaming.listener import StreamListener import sqlalchemy from sqlalchemy.sql.expr...
null
v0
[ "Any", "Any" ]
List[Dict]
def v0(self, v1, v2) -> List[Dict]: v3 = self._dbc.tables['strategyrunners'] v4 = self._dbc.session.query(v3.columns['runner_id'], v3.columns['profit'].label('runner_profit')).filter(v3.columns['strategy_id'] == v2, v3.columns['market_id'] == v1).cte() v5 = self._dbc.tables['marketrunners'] v6 = self._d...
[]
[]
[]
6
from __future__ import annotations import shutil from betfairlightweight.resources.streamingresources import MarketDefinition from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook from betfairlightweight.streaming.listener import StreamListener import sqlalchemy from sqlalchemy.sql.expr...
null
v0
[ "Any", "Any", "Any", "Any", "Any" ]
List[Dict]
def v0(self, v1, v2, v3, v4=None, v5=False) -> List[Dict]: v6 = [v1.c[nm] for v7 in v2] v8 = self._dbc.session.query(*v6) if v4 is not None: v8 = self._dbc.order_query(v8, v1.c, v4, v5) v9 = v8.limit(v3).all() return [dict(row) for v10 in v9]
[]
[]
[]
7
from __future__ import annotations import shutil from betfairlightweight.resources.streamingresources import MarketDefinition from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook from betfairlightweight.streaming.listener import StreamListener import sqlalchemy from sqlalchemy.sql.expr...
null
v0
[ "Any" ]
Dict
def v0(self, v1) -> Dict: v2 = {'market_id': v1} return self._dbc.read_row('marketmeta', v2)
[]
[]
[]
3
from __future__ import annotations import shutil from betfairlightweight.resources.streamingresources import MarketDefinition from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook from betfairlightweight.streaming.listener import StreamListener import sqlalchemy from sqlalchemy.sql.expr...
null
v0
[ "list" ]
Any
def v0(v1: list): for v2 in v1: print(v2)
[]
[]
[]
3
from math import sqrt # function with int parameter def my_function(a: str): print(a) my_function(3) # function with type annotation def my_function2(a: str) -> str: return a print(my_function2(3)) # import sqrt from math and use it print(sqrt(9.4323)) # import alias from math # from math import sqrt as square_...
null
v0
[ "dict" ]
Any
def v0(v1: dict): for (v2, v3) in v1.items(): print(v2, v3)
[]
[]
[]
3
from math import sqrt # function with int parameter def my_function(a: str): print(a) my_function(3) # function with type annotation def my_function2(a: str) -> str: return a print(my_function2(3)) # import sqrt from math and use it print(sqrt(9.4323)) # import alias from math # from math import sqrt as square_...
null
v0
[ "tuple" ]
Any
def v0(v1: tuple): for v2 in v1: print(v2)
[]
[]
[]
3
from math import sqrt # function with int parameter def my_function(a: str): print(a) my_function(3) # function with type annotation def my_function2(a: str) -> str: return a print(my_function2(3)) # import sqrt from math and use it print(sqrt(9.4323)) # import alias from math # from math import sqrt as square_...
null
v0
[ "str" ]
Dict
def v0(self, v1: str, *v2, **v3) -> Dict: v4 = [] v5 = v1 with open('tokenizer/eng_sentence_tokenizer.pkl', 'rb') as v6: v7 = pickle.load(v6) for (v8, (v9, v10)) in enumerate(v7.span_tokenize(v5)): v6 = v5[v9:v10] v6 = v6[:self.max_sent_len] if len(v6) > self.min_sent_len...
[]
[ "pickle" ]
[ "import pickle" ]
11
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" from typing import Dict import re import string from jina.hub.crafters.nlp.Sentencizer import Sentencizer import pickle # class Splitter(Sentencizer): # count = 0 # separator = "|" # # def __init__(self,...
null
v0
[ "str" ]
bool
def v0(self, v1: str) -> bool: for v2 in self._configs: if v2.has_section(v1): return True return False
[]
[]
[]
5
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v0
[ "str", "str" ]
bool
def v0(self, v1: str, v2: str) -> bool: for v3 in self._configs: if v3.has_option(v1, v2): return True return False
[]
[]
[]
5
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v0
[ "str", "str" ]
str | None
def v0(self, v1: str, v2: str) -> str | None: for v3 in self._configs: try: return v3.get_value(v1, v2) except (configparser.NoSectionError, configparser.NoOptionError): pass if not self.has_section(v1): raise configparser.NoSectionError(v1) raise configparser...
[]
[ "configparser" ]
[ "import configparser" ]
9
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v0
[ "str", "str" ]
str | None
def v0(self, v1: str, v2: str) -> str | None: for v3 in self._configs: if v3.has_option(v1, v2): return v3.get_source_for_option(v1, v2) return None
[]
[]
[]
5
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v5
[ "v1", "str", "str", "dict", "bool", "str | None" ]
str
def v5(self, v6: v1, *, v7: str, v8: str, v9: dict, v10: bool=True, v11: str | None=None) -> str: v12 = partial(self._possibly_interpolate_value, option=v7, section=v8, section_values=v9) if isinstance(v6, str): return v12(v6) if v10 else v6 if isinstance(v6, list): def v13(v14: v0) -> str:...
[ { "name": "v2", "input_types": [ "v0" ], "output_type": "str", "code": "def v2(v3: v0) -> str:\n if not isinstance(v3, str):\n return str(v3)\n v4 = possibly_interpolate(v3) if interpolate else v3\n return f'\"{v4}\"'", "dependencies": [] } ]
[ "functools" ]
[ "from functools import partial" ]
14
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
[ "v0 = Union[bool, int, float, str]", "v1 = Union[v0, List[v0]]" ]
v0
[ "str" ]
list[str]
def v0(self, v1: str) -> list[str]: v2 = self.values.get(v1) if v2 is None: raise configparser.NoSectionError(v1) return [*v2.keys(), *(default_option for v3 in self.defaults if v3 not in v2)]
[]
[ "configparser" ]
[ "import configparser" ]
5
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v3
[]
dict
def v3(self) -> dict: def v4(v5, v6) -> tuple[str, Any]: if isinstance(v6, dict): v6 = str(v6) if v5.endswith('.add'): v5 = v5.rsplit('.', 1)[0] v6 = f'+{v6!r}' elif v5.endswith('.remove'): v5 = v5.rsplit('.', 1)[0] v6 = f'-{v6!r}'...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "tuple[str, Any]", "code": "def v0(v1, v2) -> tuple[str, Any]:\n if isinstance(v2, dict):\n v2 = str(v2)\n if v1.endswith('.add'):\n v1 = v1.rsplit('.', 1)[0]\n v2 = f'+{v2!r}'\n elif v1.end...
[]
[]
13
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v0
[ "Any", "Any" ]
tuple[str, Any]
def v0(v1, v2) -> tuple[str, Any]: if isinstance(v2, dict): v2 = str(v2) if v1.endswith('.add'): v1 = v1.rsplit('.', 1)[0] v2 = f'+{v2!r}' elif v1.endswith('.remove'): v1 = v1.rsplit('.', 1)[0] v2 = f'-{v2!r}' return (v1, v2)
[]
[]
[]
10
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import configparser import getpass import itertools import os import re from abc import ABC, abstractmethod from dataclasses import dataclass from funct...
null
v0
[ "Optional[Dict[str, Dict[str, Optional[Tensor]]]]" ]
Dict[str, Optional[Tensor]]
def v0(self, v1: Optional[Dict[str, Dict[str, Optional[Tensor]]]]) -> Dict[str, Optional[Tensor]]: v2 = self.get_incremental_state(v1, 'attn_state') if v2 is not None: return v2 else: v3: Dict[str, Optional[Tensor]] = {} return v3
[]
[]
[]
7
# Copyright 2021 The LightSeq Team # Copyright Facebook Fairseq # We use layers from Facebook Fairseq as our baseline import math import uuid from typing import Dict, Optional, Tuple, List import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn import Parameter, LayerNorm, Dropout, L...
null
v0
[ "Optional[Dict[str, Dict[str, Optional[Tensor]]]]", "str" ]
Optional[Dict[str, Optional[Tensor]]]
def v0(self, v1: Optional[Dict[str, Dict[str, Optional[Tensor]]]], v2: str) -> Optional[Dict[str, Optional[Tensor]]]: v3 = self._get_full_incremental_state_key(v2) if v1 is None or v3 not in v1: return None return v1[v3]
[]
[]
[]
5
# Copyright 2021 The LightSeq Team # Copyright Facebook Fairseq # We use layers from Facebook Fairseq as our baseline import math import uuid from typing import Dict, Optional, Tuple, List import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn import Parameter, LayerNorm, Dropout, L...
null
v0
[ "Optional[Dict[str, Dict[str, Optional[Tensor]]]]", "str", "Dict[str, Optional[Tensor]]" ]
Optional[Dict[str, Dict[str, Optional[Tensor]]]]
def v0(self, v1: Optional[Dict[str, Dict[str, Optional[Tensor]]]], v2: str, v3: Dict[str, Optional[Tensor]]) -> Optional[Dict[str, Dict[str, Optional[Tensor]]]]: if v1 is not None: v4 = self._get_full_incremental_state_key(v2) v1[v4] = v3 return v1
[]
[]
[]
5
# Copyright 2021 The LightSeq Team # Copyright Facebook Fairseq # We use layers from Facebook Fairseq as our baseline import math import uuid from typing import Dict, Optional, Tuple, List import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn import Parameter, LayerNorm, Dropout, L...
null
v0
[ "str", "Optional[str]", "Optional[str]", "Optional[str]", "Optional[str]", "Optional[Dict[str, Any]]" ]
str
def v0(v1: str, v2: Optional[str], v3: Optional[str], v4: Optional[str], v5: Optional[str], v6: Optional[Dict[str, Any]]=None) -> str: v7 = f'{v1}://' if v2 is not None: v7 += f'{quote_plus(v2)}' if v3 is not None: v7 += f':{quote_plus(v3)}' v7 += '@' if v4 is not None: ...
[]
[ "urllib" ]
[ "from urllib.parse import quote_plus" ]
17
import logging from abc import abstractmethod from dataclasses import dataclass, field from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type from urllib.parse import quote_plus import pydantic from sqlalchemy import create_engine, inspect from sqlalchemy.engine.reflection import Inspector from sqlal...
null
v0
[ "str", "str" ]
None
def v0(self, v1: str, v2: str='table') -> None: if v2 == 'table': self.tables_scanned += 1 elif v2 == 'view': self.views_scanned += 1 else: raise KeyError(f'Unknown entity {v2}.')
[]
[]
[]
7
import logging from abc import abstractmethod from dataclasses import dataclass, field from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type from urllib.parse import quote_plus import pydantic from sqlalchemy import create_engine, inspect from sqlalchemy.engine.reflection import Inspector from sqlal...
null
v3
[ "types.Location" ]
None
def v3(v4: types.Location) -> None: if v0(v4): raise RuntimeError('Cannot aspirate a tiprack')
[ { "name": "v0", "input_types": [ "types.Location" ], "output_type": "bool", "code": "def v0(v1: types.Location) -> bool:\n v2 = v1.labware.as_labware()\n return v2.parent and v2.parent.is_tiprack", "dependencies": [] } ]
[]
[]
3
import logging from typing import Optional, Any from opentrons import types from opentrons.calibration_storage import get from opentrons.calibration_storage.types import TipLengthCalNotFound from opentrons.hardware_control.dev_types import PipetteDict from opentrons.protocol_api.labware import Labware, Well from opent...
null
v3
[ "types.Location" ]
None
def v3(v4: types.Location) -> None: if v0(v4): raise RuntimeError('Cannot dispense to a tiprack')
[ { "name": "v0", "input_types": [ "types.Location" ], "output_type": "bool", "code": "def v0(v1: types.Location) -> bool:\n v2 = v1.labware.as_labware()\n return v2.parent and v2.parent.is_tiprack", "dependencies": [] } ]
[]
[]
3
import logging from typing import Optional, Any from opentrons import types from opentrons.calibration_storage import get from opentrons.calibration_storage.types import TipLengthCalNotFound from opentrons.hardware_control.dev_types import PipetteDict from opentrons.protocol_api.labware import Labware, Well from opent...
null
v0
[ "types.Location" ]
bool
def v0(v1: types.Location) -> bool: v2 = v1.labware.as_labware() return v2.parent and v2.parent.is_tiprack
[]
[]
[]
3
import logging from typing import Optional, Any from opentrons import types from opentrons.calibration_storage import get from opentrons.calibration_storage.types import TipLengthCalNotFound from opentrons.hardware_control.dev_types import PipetteDict from opentrons.protocol_api.labware import Labware, Well from opent...
null
v0
[ "logging.Logger" ]
None
def v0(v1: logging.Logger) -> None: v2 = logging.StreamHandler(sys.stdout) v2.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(name)s %(message)s')) v1.addHandler(v2)
[]
[ "logging", "sys" ]
[ "import logging", "import sys" ]
4
# sqlalchemy/log.py # Copyright (C) 2006-2022 the SQLAlchemy authors and contributors # <see AUTHORS file> # Includes alterations by Vinay Sajip vinay_sajip@yahoo.co.uk # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Logging control ...
null
v0
[ "str" ]
None
def v0(self, v1: str, *v2: Any, **v3: Any) -> None: v3['exc_info'] = 1 self.log(logging.ERROR, v1, *v2, **v3)
[]
[ "logging" ]
[ "import logging" ]
3
# sqlalchemy/log.py # Copyright (C) 2006-2022 the SQLAlchemy authors and contributors # <see AUTHORS file> # Includes alterations by Vinay Sajip vinay_sajip@yahoo.co.uk # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Logging control ...
null
v0
[ "int" ]
bool
def v0(self, v1: int) -> bool: if self.logger.manager.disable >= v1: return False return v1 >= self.getEffectiveLevel()
[]
[]
[]
4
# sqlalchemy/log.py # Copyright (C) 2006-2022 the SQLAlchemy authors and contributors # <see AUTHORS file> # Includes alterations by Vinay Sajip vinay_sajip@yahoo.co.uk # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Logging control ...
null
v0
[]
int
def v0(self) -> int: v1 = self._echo_map[self.echo] if v1 == logging.NOTSET: v1 = self.logger.getEffectiveLevel() return v1
[]
[ "logging" ]
[ "import logging" ]
5
# sqlalchemy/log.py # Copyright (C) 2006-2022 the SQLAlchemy authors and contributors # <see AUTHORS file> # Includes alterations by Vinay Sajip vinay_sajip@yahoo.co.uk # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Logging control ...
null
v2
[ "int" ]
Any
async def v2(v3: int): v4 = await v0(v3) if v4: await v4.update(fc_3ds=None).apply() if v4.fc_3ds is None and v4.fc_switch is None: await v4.delete()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.FriendCode.get(v1)", "dependencies": [] } ]
[]
[]
6
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v2
[ "int" ]
Any
async def v2(v3: int): v4 = await v0(v3) if v4: if v4.position != 'Helper': await v4.update(console=None).apply() else: await v4.delete()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.Staff.query.where(models.Staff.id == v1).gino.first()", "dependencies": [] } ]
[]
[]
7
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v3
[ "int", "str" ]
Any
async def v3(v4: int, v5: str): v6 = await v0(v4, v5) if v6: await v6.delete()
[ { "name": "v0", "input_types": [ "int", "str" ], "output_type": "Any", "code": "async def v0(v1: int, v2: str):\n return await models.TimedRestriction.query.where((models.TimedRestriction.user == v1) & (models.TimedRestriction.type == v2)).gino.first()", "dependencies": [] }...
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v3
[ "int", "str" ]
Any
async def v3(v4: int, v5: str): v6 = await v0(v4, v5) if v6: await v6.update(alerted=True).apply()
[ { "name": "v0", "input_types": [ "int", "str" ], "output_type": "Any", "code": "async def v0(v1: int, v2: str):\n return await models.TimedRestriction.query.where((models.TimedRestriction.user == v1) & (models.TimedRestriction.type == v2)).gino.first()", "dependencies": [] }...
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v3
[ "int", "int" ]
Any
async def v3(v4: int, v5: int): v6 = await v0(v4, v5) if v6: await v6.delete()
[ { "name": "v0", "input_types": [ "int", "int" ], "output_type": "Any", "code": "async def v0(v1: int, v2: int):\n return await models.TimedRole.query.where((models.TimedRole.user_id == v1) & (models.TimedRole.role_id == v2)).gino.first()", "dependencies": [] } ]
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v3
[ "str" ]
Any
async def v3(v4: str): v5 = await v0(v4) if v5: await v5.delete()
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Any", "code": "async def v0(v1: str):\n if (v2 := (await models.Flag.get(v1))):\n return v2.value\n return None", "dependencies": [] } ]
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v3
[ "str", "bool" ]
Any
async def v3(v4: str, v5: bool): v6 = await v0(v4) if v6: await v6.update(value=v5).apply()
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Any", "code": "async def v0(v1: str):\n if (v2 := (await models.Flag.get(v1))):\n return v2.value\n return None", "dependencies": [] } ]
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v2
[ "int" ]
Any
async def v2(v3: int): v4 = await v0(v3) if v4: await v4.delete()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.Softban.query.where(models.Softban.user == v1).gino.first()", "dependencies": [] } ]
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v4
[ "int" ]
Any
async def v4(v5: int): v6 = await v2(v5) if not v6: v6 = await v0(v5) return v6
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.Member.create(id=v1)", "dependencies": [] }, { "name": "v2", "input_types": [ "int" ], "output_type": "Any", "code": "async def v2(v3: ...
[]
[]
5
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v7
[ "int" ]
Any
async def v7(v8: int): v9 = await v2(v8) await v9.update(watched=True).apply()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.Member.create(id=v1)", "dependencies": [] }, { "name": "v2", "input_types": [ "int" ], "output_type": "Any", "code": "async def v2(v3: ...
[]
[]
3
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v2
[ "int" ]
Any
async def v2(v3: int): v4 = await v0(v3) if v4: await v4.update(watched=False).apply()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.Member.get(v1)", "dependencies": [] } ]
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v2
[ "int" ]
bool
async def v2(v3: int) -> bool: v4 = await v0(v3) return v4.watched if v4 else False
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Optional[models.Member]", "code": "async def v0(v1: int) -> Optional[models.Member]:\n return await models.Member.get(v1)", "dependencies": [] } ]
[]
[]
3
import datetime from . import models from discord import TextChannel, utils from typing import Optional def generate_id() -> int: return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int) -> Optional[models.PermanentRole]: await add_dbmember_if_not_exist(...
null
v2
[ "int" ]
Any
async def v2(v3: int): v4 = await v0(v3) if v4: await v4.update(fc_switch=None).apply() if v4.fc_3ds is None and v4.fc_switch is None: await v4.delete()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.FriendCode.get(v1)", "dependencies": [] } ]
[]
[]
6
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v2
[ "int", "str" ]
Any
async def v2(v3: int, v4: str): v5 = await v0(v3) if v5: await v5.update(description=v4).apply()
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "async def v0(v1: int):\n return await models.Rule.get(v1)", "dependencies": [] } ]
[]
[]
4
from . import models import datetime from discord import utils, TextChannel def generate_id(): return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int): await add_dbmember_if_not_exist(user_id) if not await models.PermanentRole.query.where((models.Per...
null
v2
[ "str" ]
Any
async def v2(v3: str): v4 = await v0(v3) if v4: await v4.delete()
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Optional[models.Flag]", "code": "async def v0(v1: str) -> Optional[models.Flag]:\n return await models.Flag.get(v1)", "dependencies": [] } ]
[]
[]
4
import datetime from . import models from discord import TextChannel, utils from typing import Optional def generate_id() -> int: return utils.time_snowflake(datetime.datetime.now()) async def add_permanent_role(user_id: int, role_id: int) -> Optional[models.PermanentRole]: await add_dbmember_if_not_exist(...
null
v0
[ "Path" ]
Optional[Path]
def v0(v1: Path) -> Optional[Path]: with (v1 / 'package.json').open(encoding='utf-8') as v2: v3 = json.load(v2) v4 = v3.get('devDependencies', dict()).get('@quetz-frontend/builder') v4 = v4 or v3.get('dependencies', dict()).get('@quetz-frontend/builder') if v4 is None: return None v5...
[]
[ "json" ]
[ "import json" ]
13
import importlib import json import os import shutil import subprocess from pathlib import Path from shutil import which from typing import List, Optional, Tuple from setuptools import find_packages from typer import Argument, Option, Typer from .paths import ( GLOBAL_APP_DIR, GLOBAL_EXTENSIONS_DIR, GLOBA...
null
v3
[ "Optional[pathlib.Path]" ]
dict
def v3(v4: Optional[pathlib.Path]=None) -> dict: v5 = v0(v4) if '_metainfo' in v5: del v5['_metainfo'] return v5
[ { "name": "v0", "input_types": [ "Optional[pathlib.Path]" ], "output_type": "Any", "code": "def v0(v1: Optional[pathlib.Path]=None):\n return json.loads((v1 or get_installed_plugins_path()).read_text('utf8'))", "dependencies": [ "v2" ] }, { "name": "v2", "input...
[ "json" ]
[ "import json" ]
5
"""Helper functions for the distribution.""" import importlib import json import pathlib import subprocess import sys import types import os from typing import Optional, List import requests import repobee_plug as plug import _repobee.ext from _repobee import distinfo from _repobee import plugin class DependencyRe...
null
v3
[ "dict", "Optional[pathlib.Path]" ]
None
def v3(v4: dict, v5: Optional[pathlib.Path]=None) -> None: v6 = v5 or v2() v7 = v0(v6).get('_metainfo') or {} v7.update(v4.get('_metainfo') or {}) v8 = dict(v4) v8['_metainfo'] = v7 v6.write_text(json.dumps(v8, indent=4), encoding='utf8')
[ { "name": "v0", "input_types": [ "Optional[pathlib.Path]" ], "output_type": "Any", "code": "def v0(v1: Optional[pathlib.Path]=None):\n return json.loads((v1 or get_installed_plugins_path()).read_text('utf8'))", "dependencies": [ "v2" ] }, { "name": "v2", "input...
[ "json" ]
[ "import json" ]
7
"""Helper functions for the distribution.""" import importlib import json import pathlib import subprocess import sys import types import os from typing import Optional, List import requests import repobee_plug as plug import _repobee.ext from _repobee import distinfo from _repobee import plugin class DependencyRe...
null
v3
[ "Optional[pathlib.Path]" ]
List[str]
def v3(v4: Optional[pathlib.Path]=None) -> List[str]: v5 = v0(v4) return (v5.get('_metainfo') or {}).get('active_plugins') or []
[ { "name": "v0", "input_types": [ "Optional[pathlib.Path]" ], "output_type": "Any", "code": "def v0(v1: Optional[pathlib.Path]=None):\n return json.loads((v1 or get_installed_plugins_path()).read_text('utf8'))", "dependencies": [ "v2" ] }, { "name": "v2", "input...
[ "json" ]
[ "import json" ]
3
"""Helper functions for the distribution.""" import importlib import json import pathlib import subprocess import sys import types import os from typing import Optional, List import requests import repobee_plug as plug import _repobee.ext from _repobee import distinfo from _repobee import plugin class DependencyRe...
null
v9
[ "List[str]", "Optional[pathlib.Path]" ]
None
def v9(v10: List[str], v11: Optional[pathlib.Path]=None) -> None: v12 = v0(v11) v12.setdefault('_metainfo', {})['active_plugins'] = v10 v3(v12, v11)
[ { "name": "v0", "input_types": [ "Optional[pathlib.Path]" ], "output_type": "Any", "code": "def v0(v1: Optional[pathlib.Path]=None):\n return json.loads((v1 or get_installed_plugins_path()).read_text('utf8'))", "dependencies": [ "v2" ] }, { "name": "v2", "input...
[ "json" ]
[ "import json" ]
4
"""Helper functions for the distribution.""" import importlib import json import pathlib import subprocess import sys import types import os from typing import Optional, List import requests import repobee_plug as plug import _repobee.ext from _repobee import distinfo from _repobee import plugin class DependencyRe...
null
v0
[ "bool" ]
None
def v0(v1: bool) -> None: global relative_help_links v2 = v1
[]
[]
[]
3
import re from typing import Any, List, Match, Optional from markdown import Markdown from markdown.extensions import Extension from markdown.preprocessors import Preprocessor from zerver.lib.markdown.preprocessor_priorities import PREPROCESSOR_PRIORITES # There is a lot of duplicated code between this file and # he...
null
v0
[ "Dict[str, Any]" ]
Any
def v0(self, v1: Dict[str, Any]): if v1: v2 = v1.copy() v2.update(self.__original_kwargs__) v3 = self.__class__(self.callback, **v2) return self._ensure_assignment_on_copy(v3) else: return self.copy()
[]
[]
[]
8
""" The MIT License (MIT) Copyright (c) 2015-2021 Rapptz Copyright (c) 2021-2021 Pycord Development Copyright (c) 2021-present Texus Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restri...
null
v0
[ "str" ]
typing.Tuple[str, typing.Optional[os.stat_result]]
def v0(self, v1: str) -> typing.Tuple[str, typing.Optional[os.stat_result]]: for v2 in self.all_directories: v3 = os.path.realpath(os.path.join(v2, v1)) v2 = os.path.realpath(v2) if os.path.commonprefix([v3, v2]) != v2: continue try: return (v3, os.stat(v3)) ...
[]
[ "os" ]
[ "import os" ]
11
import importlib.util import os import stat import typing from email.utils import parsedate import anyio from starlette.datastructures import URL, Headers from starlette.exceptions import HTTPException from starlette.responses import FileResponse, RedirectResponse, Response from starlette.types import Receive, Scope,...
null
v0
[ "str" ]
Any
def v0(self, v1: str): self.app.log(v1) for v2 in self.notifiers: v2.add_msg_to_queue(v1)
[]
[]
[]
4
#!/usr/bin/env python import asyncio from collections import deque import logging import time from typing import List, Dict, Optional, Tuple, Set, Deque from hummingbot.client.command import __all__ as commands from hummingbot.core.clock import Clock from hummingbot.core.data_type.order_book_tracker import OrderBookT...
null
v0
[ "pytiled_parser.TiledMap", "pytiled_parser.Tileset", "int" ]
Optional[pytiled_parser.Tile]
def v0(v1: pytiled_parser.TiledMap, v2: pytiled_parser.Tileset, v3: int) -> Optional[pytiled_parser.Tile]: for (v4, v5) in v1.tilesets.items(): if v5 is v2: for (v6, v7) in v5.tiles.items(): if v3 == v7.id: return v7 return None
[]
[]
[]
7
""" Functions and classes for managing a map saved in the .tmx format. Typically these .tmx maps are created using the `Tiled Map Editor`_. For more information, see the `Platformer Tutorial`_. .. _Tiled Map Editor: https://www.mapeditor.org/ .. _Platformer Tutorial: http://arcade.academy/examples/platform_tutorial/...
null
v0
[ "pytiled_parser.Tile", "Optional[str]", "Optional[str]" ]
Any
def v0(v1: pytiled_parser.Tile, v2: Optional[str], v3: Optional[str]): v4 = None if v1.image: v4 = v1.image elif v1.tileset.image: v4 = v1.tileset.image if not v4: print(f'Warning for tile {v1.id_}, no image source listed either for individual tile, or as a tileset.') ret...
[]
[ "os", "pathlib" ]
[ "import os", "from pathlib import Path" ]
21
""" Functions and classes for managing a map saved in the .tmx format. Typically these .tmx maps are created using the `Tiled Map Editor`_. For more information, see the `Platformer Tutorial`_. .. _Tiled Map Editor: https://www.mapeditor.org/ .. _Platformer Tutorial: http://arcade.academy/examples/platform_tutorial/...
null