text
stringlengths
180
381k
Imports: ```python import torch from torch import Tensor import typing ``` Type definitions: Input Types: Output Type: Optional[Dict] Dependencies: ```python def v0(v1): v2 = torch.ones((7,)) (v3, v4) = torch.unique(v1, return_counts=True) v2[v3] = v2[v3] - v4 / torch.sum(v4) return v2 ``` Function Na...
Imports: ```python import typing ``` Type definitions: ```python v0 = TypeVar('ManagedCluster') ``` Input Types: v0 Output Type: v0 Dependencies: Function Name: v1 Function: ```python def v1(self, v2: v0) -> v0: self._ensure_mc(v2) v3 = self.context.get_edge_zone() if v3: v2.extended_location = sel...
Imports: ```python import typing ``` Type definitions: Input Types: List[str], dict Output Type: List[int] Dependencies: Function Name: v0 Function: ```python def v0(v1: List[str], v2: dict) -> List[int]: v3 = [] for v4 in v1: if v4 in v2: v3.append(v2[v4]) return v3 ```
Imports: ```python import typing ``` Type definitions: ```python class v0: def __init__(self, v1, v2: BlobContainer) -> None: (self.name, self.container) = (v1, v2) def __repr__(self) -> str: return f'{type(self).__name__}(name={repr(self.name)}, container={repr(self.container.name)}, exists={...
Imports: ```python import pandas as pd import numpy as np import typing ``` Type definitions: Input Types: Output Type: pd.DataFrame Dependencies: ```python def v0(v1: pd.DataFrame, v2: Sequence[str]) -> pd.DataFrame: for v3 in v2: v4 = v1[v3].values v5 = np.ravel(np.nonzero(~np.isnan(v4))) ...
Imports: ```python import typing ``` Type definitions: Input Types: list Output Type: float Dependencies: Function Name: v0 Function: ```python def v0(v1: list) -> float: v2 = 0 for v3 in v1: v2 += pow(v3 / sum(v1), 2) return 1 - v2 ```
Imports: ```python import typing ``` Type definitions: Input Types: pd.Series Output Type: bool Dependencies: Function Name: v0 Function: ```python def v0(v1: pd.Series) -> bool: try: return isinstance(v1[0][0], dict) except TypeError: return False ```
Imports: ```python from statistics import mode, StatisticsError import numpy as np import typing ``` Type definitions: Input Types: [float], Any Output Type: Any Dependencies: ```python def v0(v1, v2=0): v3 = [round(x, v2) for v4 in v1] try: return mode(v3) except StatisticsError: return No...
Imports: ```python import typing ``` Type definitions: Input Types: ArgumentParser Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: ArgumentParser): v1.add_argument('-c', '--config', type=str, help="Path to the model's config file", default=None) v1.add_argument('--group',...
Imports: ```python import typing ``` Type definitions: Input Types: bytes Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: bytes): if v1 == b'\xff\xf4\xff\xfd\x06': self.transport.loseConnection() return v2 = v1.decode('utf-8').strip() try: v3 =...
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: int Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str) -> int: (v2, v3) = (0, 0) for v4 in v1: if v4 == '1': v2 += 1 else: v3 += 1 v3 = min(v3, v2) re...
Imports: ```python import typing ``` Type definitions: Input Types: List[int], int Output Type: int Dependencies: Function Name: v0 Function: ```python def v0(self, v1: List[int], v2: int) -> int: v3 = [0] * (2 * v2) for v4 in range(len(v1) // 2): if v1[v4] <= v1[-v4 - 1]: v5 = v1[v4] ...
Imports: ```python import numpy as np from numpy.typing import ArrayLike, NDArray import typing ``` Type definitions: Input Types: unittest.TestCase, ArrayLike, NDArray[np.float_], str Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(v1: unittest.TestCase, v2: ArrayLike, v3: NDArray[np.flo...
Imports: ```python from base64 import urlsafe_b64decode, urlsafe_b64encode import typing ``` Type definitions: ```python class v0(FlaskForm): v1 = FileField('My File', validators=[DataRequired()]) v2 = SubmitField('Upload') ``` Input Types: v0 Output Type: Tuple[str,] Dependencies: Function Name: v3 Function: ...
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: int Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str) -> int: if self.unk is None: return v1 return self.vocab_mapping[v1] if v1 in self.vocab_mapping else self.vocab_mapping[self.unk] ```
Imports: ```python import torch as th import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torch.autograd import Function import typing ``` Type definitions: Input Types: Tensor, Tensor, Tensor, Tensor, Tensor, str Output Type: Tensor Dependencies: ```python def v0(v1: Tensor, v2: Tensor...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(self) -> None: v1 = self.name print() print('Writer: flushing data...') self.write_api.__del__() self.client.__del__() print('Writer: closed'.format...
Imports: ```python import random import typing ``` Type definitions: Input Types: Output Type: str Dependencies: Function Name: v0 Function: ```python def v0() -> str: v1 = [] for v2 in range(0, 4): v1.append(str(random.randint(1, 255))) return '.'.join(v1) ```
Imports: ```python import torch from torch import Tensor import typing ``` Type definitions: Input Types: Tensor, Tensor, Tensor Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Tensor=None, v2: Tensor=None, v3: Tensor=None): if isinstance(v1, Tensor): if self.counts_m...
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str) -> str: v2 = [] for v3 in v1: if v3 == '1': v2.append(self.constants.SPONDEE) if v3 == '0': v2.append(self....
Imports: ```python from hashlib import md5, sha1 from hmac import HMAC import json import typing ``` Type definitions: Input Types: '加密密钥', dict, Any Output Type: Any Dependencies: ```python def v0(v1): if paramData.get(v1) == 'null': return '' elif not isinstance(paramData.get(v1, ''), str): v...
Imports: ```python import typing ``` Type definitions: Input Types: Dict[str, str] Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Dict[str, str]) -> str: v2 = self.board if v1.get('keyword'): v2 += f"_key_{v1['keyword']}" if v1.get('author'): v2 += f"...
Imports: ```python import typing ``` Type definitions: ```python class v0: def __init__(self, v1=0, v2=None): self.val = v1 self.next = v2 ``` Input Types: v0 Output Type: v0 Dependencies: Function Name: v3 Function: ```python def v3(self, v4: v0) -> v0: if not v4 or not v4.next: retur...
Imports: ```python import os import shutil import typing ``` Type definitions: Input Types: Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(self) -> None: os.chdir(self.oldcwd) shutil.rmtree(self.tempdir) ```
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: 'LinearLayer' Dependencies: Function Name: v0 Function: ```python def v0(self) -> 'LinearLayer': self.train() return self ```
Imports: ```python import pickle from base64 import b64encode, b64decode import typing ``` Type definitions: Input Types: Any, Any Output Type: dict Dependencies: Function Name: v0 Function: ```python def v0(self, v1, v2) -> dict: v3 = f'{v1}-{v2}{self.note_info_file_suffix}' v4 = self._fetch_content_response...
Imports: ```python import os import typing ``` Type definitions: Input Types: Any, str, Any, Any, Any Output Type: Any Dependencies: ```python def v0(v1, v2, v3, v4): v5 = {0, 1, 2, 3, 4, 5, 6, 7} v6 = {8, 9, 10} v7 = dict() v8 = -1 if os.path.isfile(v1): with open(v1, 'r') as v9: ...
Imports: ```python from asyncio import ensure_future import typing ``` Type definitions: Input Types: discord.Message, Iterable[discord.Emoji] Output Type: Any Dependencies: ```python async def v0(): for v1 in reactions: await message.add_reaction(v1) ``` Function Name: v2 Function: ```python async def v2(...
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str): self.org_name.fill(v1) self.update_button.click() ```
Imports: ```python import io import typing ``` Type definitions: Input Types: Union[io.BufferedReader, bytes] Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Union[io.BufferedReader, bytes]): if isinstance(v1, bytes): v1 = io.BytesIO(v1) v2 = True while v2: ...
Imports: ```python import io import tarfile from tarfile import TarInfo, TarFile import typing ``` Type definitions: Input Types: TarFile, TarFile Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: TarFile, v2: TarFile): with io.BytesIO(str.encode('\n'.join([member.name.lstrip('...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(self) -> str: if self.modified: return f'{self.string}+~{self.ahead}.{self.gitSHA}' return f'{self.string}+{self.ahead}.{self.gitSHA}' ```
Imports: ```python import typing ``` Type definitions: Input Types: odict, str Output Type: int Dependencies: ```python def v0(v1: list, v2: str) -> int: for (v3, v4) in enumerate(v1): if v4['name'] == v2: return v3 return -1 ``` ```python def v5(v6: odict, v7: str) -> int: if v7 == 'no...
Imports: ```python import typing ``` Type definitions: ```python class v0(enum.IntEnum): v1 = 0 v2 = 1 v3 = 2 v4 = 3 v5 = 4 v6 = 5 ``` Input Types: typing.BinaryIO, v0 Output Type: None Dependencies: ```python def v7(v8: typing.BinaryIO, v9: bytes) -> int: if 'b' not in v8.mode: rais...
Imports: ```python import typing ``` Type definitions: ```python v0 = List[TimeSeriesItem] ``` ```python v1 = List[UnformattedSeriesItem] ``` ```python v2 = Dict[str, str] ``` Input Types: element.Tag Output Type: v0 Dependencies: ```python def v3(v4: element.ResultSet) -> List[str]: return [el.text for v5 in v4.fi...
Imports: ```python import typing ``` Type definitions: Input Types: Path Output Type: Any Dependencies: ```python @logger(log_file) def v0(v1): if v1 != 0: v0(v1 - 1) ``` Function Name: v2 Function: ```python def v2(v3: Path): v4 = v3 / 'my_log.txt' @logger(v4) def v5(v6): if v6 != 0: ...
Imports: ```python import numpy as np import typing ``` Type definitions: Input Types: np.ndarray, Any, Any Output Type: np.ndarray Dependencies: ```python def v0(v1: np.ndarray, v2: Union[List, Tuple], v3: str='zeros') -> np.ndarray: v4 = 'value of `padding` must be tuple or list of 2, 2x2 or 4 or int' if typ...
Imports: ```python import difflib import typing ``` Type definitions: Input Types: str, str Output Type: Iterator[str] Dependencies: Function Name: v0 Function: ```python def v0(v1: str, v2: str) -> Iterator[str]: v3 = difflib.Differ() v4 = v1.splitlines() v5 = v2.splitlines() return v3.compare(v4, v5...
Imports: ```python import random import typing ``` Type definitions: Input Types: int, str Output Type: Generator Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int, v2: str='train') -> Generator: v3 = self.data[v2] v4 = len(v3) v5 = list(range(v4)) v6 = random.getstate() ran...
Imports: ```python import typing ``` Type definitions: Input Types: timedelta, Callable[[], datetime] Output Type: bool Dependencies: Function Name: v0 Function: ```python def v0(self, v1: timedelta, v2: Callable[[], datetime]) -> bool: assert self.finished_at v3 = self.finished_at + v1 return v3 <= v2() ...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: tuple Dependencies: Function Name: v0 Function: ```python def v0(self) -> tuple: try: v1 = self.get(name=self.model.NAME_SOV_TAG) v2 = False except self.model.DoesNotExist: (v1, v2) = self.update_or_creat...
Imports: ```python import typing ``` Type definitions: Input Types: condition.Segment Output Type: List[v3.Condition] Dependencies: Function Name: v0 Function: ```python def v0(self, v1: condition.Segment) -> List[v3.Condition]: v2 = [condition for v3 in self._conditions if v3.segment() == v1] for v4 in v2: ...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: List[str] Dependencies: Function Name: v0 Function: ```python def v0(self) -> List[str]: v1 = self.repo.commit('master') v2 = self.repo.commit(self.get_current_branch()) v3 = self.get_changes_list(self.get_branch_point(v1, v...
Imports: ```python import typing ``` Type definitions: Input Types: ArgumentParser Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: ArgumentParser): super().configure(v1) v1.add_argument('-r', '--region', type=str, required=True, help='AWS region') v1.add_argument('-a'...
Imports: ```python import typing ``` Type definitions: Input Types: int Output Type: int Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int) -> int: if v1 > 100: return 255 if v1 < -100: return 0 v2 = int(v1 * 1.275 + 127) self.dbg('serial_packet', 'Converted moto...
Imports: ```python import typing ``` Type definitions: ```python @dataclass class v0: v1: int v2: int v3: float v4: float v5: float def v6(self): return 6 and self.month < 10 def v7(self): return self.quantity * self.summer_rate def v8(self): return self.quanti...
Imports: ```python import typing ``` Type definitions: ```python class v0(TestCase): v1: BleDevice v2: BleDevice v3: Optional[BleDevice] v4: logging.Logger = None v5 = os.path.join(HERE, 'bond_db{}.pkl') v6 = False v7 = {} v8 = {} v9 = {} @classmethod def v10(cls) -> None: ...
Imports: ```python import typing ``` Type definitions: Input Types: int Output Type: list Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int) -> list: v2 = 'select * from t_music where mid = ?' v3 = [] v4 = self.conn.cursor() v4.execute(v2, (v1,)) v5 = v4.fetchall() v4.cl...
Imports: ```python import math import typing ``` Type definitions: Input Types: float, float, int Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: float, v2: float, v3: int): self.v = v1 self.w = v2 self.n = v3 v4 = 0.0 while v4 <= v3 * self.dt: v4 = v4...
Imports: ```python import typing ``` Type definitions: Input Types: int, bool Output Type: Path Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int, v2: bool=True) -> Path: if len(self.__sample_ids) <= v1 or v1 < 0: raise Exception(f"Sample index '{v1}' out of range (found {len(self._...
Imports: ```python import typing ``` Type definitions: Input Types: list, Any, Any Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: list, v2=2, v3=2): v4 = 0 for v5 in v1: v4 += v5 ** v2 return round(v4 / len(v1), v3) ```
Imports: ```python import typing ``` Type definitions: Input Types: int Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int): if v1 == self.iloc_economic_status_score: return 'score' elif v1 == self.iloc_is_tokyo_flag: return 'is_tokyo' elif v1 == self...
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: t.Optional[Path] Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str) -> t.Optional[Path]: for v2 in self.files: if v2.match(v1): return v2 return None ```
Imports: ```python import argparse import typing ``` Type definitions: Input Types: int, Any, int, float, float, Any, float, int, int, Any, float, int, int, int Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(v1: int=100, v2=cwd + '/input/test/', v3: int=20, v4: float=0.5, v5: float=0.1, v...
Imports: ```python from collections import defaultdict import numpy as np import typing ``` Type definitions: Input Types: np.ndarray, str, int Output Type: Dict[str, List[np.ndarray]] Dependencies: Function Name: v0 Function: ```python def v0(v1: np.ndarray, v2: str, v3: int=0) -> Dict[str, List[np.ndarray]]: v4...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(self) -> None: self._definition_uri = self._get_definition_file(self._api_identifier) self._swagger_body = self._process_definition_file() ```
Imports: ```python import collections import typing ``` Type definitions: ```python v0 = Dict[UUID, MutableMapping[CountType, int]] ``` Input Types: Output Type: v0 Dependencies: Function Name: v1 Function: ```python def v1(*v2: v0) -> v0: v3: v0 = collections.defaultdict(collections.Counter) for v4 in v2: ...
Imports: ```python import typing ``` Type definitions: Input Types: int Output Type: int Dependencies: Function Name: v0 Function: ```python def v0(v1: int) -> int: v2 = None while v2 is None: try: v2 = int(input('Please select a profile by inputting a number (e.g. 1): ')) if v...
Imports: ```python import typing ``` Type definitions: Input Types: Optional[Text] Output Type: List[Text] Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Optional[Text]=None) -> List[Text]: if v1 is None: return list(self.data.keys()) if v1 in self.data: return list(self....
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str): v2 = False v3 = self.reason if v3.startswith('Cascading '): v4 = v3[10:] v5 = v4.split('.') v6 = v5[0] if v6 =...
Imports: ```python import typing ``` Type definitions: Input Types: List Output Type: Dict[str, List[str]] Dependencies: Function Name: v0 Function: ```python def v0(v1: List) -> Dict[str, List[str]]: (v2, v3) = ([], []) for v4 in v1: v2.append(v4['snt']) v3.append(v4['gold']) assert len(v...
Imports: ```python import typing ``` Type definitions: ```python class v0: def __init__(self, v1: int, *v2, **v3): self.edge_end_id = v1 self.x: int = v3.get('x', 0) self.y: int = v3.get('y', 0) self.color: Color = v3.get('color', (0, 0, 0)) self.direction: Direction = Direc...
Imports: ```python import queue import typing ``` Type definitions: Input Types: requests.Response Output Type: Optional[Mapping[str, Any]] Dependencies: Function Name: v0 Function: ```python def v0(self, v1: requests.Response, **v2) -> Optional[Mapping[str, Any]]: if self.deals_categories.empty() and (not self.i...
Imports: ```python import typing ``` Type definitions: Input Types: Iterable[str], Iterable[bytes] Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Iterable[str], v2: Iterable[bytes], *v3, **v4) -> None: with self.query_handler.write_batch() as v5: for (v6, v7) in zip...
Imports: ```python import subprocess import sys from subprocess import PIPE, Popen import typing ``` Type definitions: Input Types: Any, Any, bool, bool Output Type: Tuple[str, str] Dependencies: ```python def v0(v1: str) -> str: return v1.replace('\r\n', '\n').replace('\r', '\n') ``` ```python def v2(v3: Any, v4:...
Imports: ```python import numpy as np import torch import torch.nn as nn import typing ``` Type definitions: Input Types: nn.Module, onnx.ModelProto, Mapping[str, str], Mapping[str, Callable[[np.ndarray], np.ndarray]] Output Type: Any Dependencies: ```python def v0(v1: onnx.TensorProto) -> np.ndarray: if v1.data_t...
Imports: ```python import typing ``` Type definitions: Input Types: int Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int): self._app_state.set_quietly('index', v1) self.save_annotations(self._last_index) self._update_im() self._update_state() self._last_ind...
Imports: ```python import typing ``` Type definitions: Input Types: callable Output Type: Tuple[str, Optional[str]] Dependencies: Function Name: v0 Function: ```python def v0(v1: callable) -> Tuple[str, Optional[str]]: if not v1.__doc__: return ('[ERROR] Missing command docstring', None) (v2, v3, v4) ...
Imports: ```python import typing ``` Type definitions: Input Types: list Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: list): v2 = self.get_source() if isinstance(v1, dict): if 'includes' in v1: v1 = v1['includes'] else: raise Val...
Imports: ```python from multiprocessing import Pool import os import pandas as pd from tqdm import tqdm import typing ``` Type definitions: Input Types: Iterator[Path] Output Type: List[Dict] Dependencies: ```python def v0(v1: Path): v2 = SingleDayIMIData(v1) v2.process_messages() v3 = calculate_orderbook_...
Imports: ```python import numpy as np import typing ``` Type definitions: Input Types: Any Output Type: np.ndarray Dependencies: Function Name: v0 Function: ```python def v0(v1: Any) -> np.ndarray: v1 = np.array(v1) v1[v1 < 0] = 0 v2 = np.sum(v1) if v2 == 0: return np.ones(len(v1)) / len(v1) ...
Imports: ```python import csv import typing ``` Type definitions: Input Types: Path Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Path) -> None: v2 = self.catalog.keys() with open(v1, 'w', newline='') as v3: v4 = csv.DictWriter(v3, fieldnames=v2) v4.wri...
Imports: ```python import typing ``` Type definitions: Input Types: asyncio.StreamReader, int Output Type: int Dependencies: Function Name: v0 Function: ```python async def v0(v1: asyncio.StreamReader, v2: int=DEFAULT_MAX_BITS) -> int: v3: int = 1 << v2 v4: int = 0 v5: int = 0 v6: bool = True whil...
Imports: ```python import typing ``` Type definitions: Input Types: int Output Type: bytes Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int) -> bytes: if (v2 := self.stdout.read(v1)): return v2 raise EOFError ```
Imports: ```python import typing ``` Type definitions: Input Types: int, Any, Any Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: int, v2, v3): for (v4, v5) in zip(v2, v3): if v5.grad is None: v5.grad = v4.grad.cpu() / v1 else: v5.grad ...
Imports: ```python import re import typing ``` Type definitions: Input Types: str Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str): v2 = v1.split(' ') v3 = ['\n', '\r', '"', "'", '.', '’', ',', '“”', ';', '“', '!', '”', '”', '“', '-'] for (v4, v5) in enumerate(v2)...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: bool Dependencies: Function Name: v0 Function: ```python def v0(self) -> bool: self.amount.validate() return True ```
Imports: ```python import typing ``` Type definitions: Input Types: str, List Output Type: bool Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str, v2: List=None) -> bool: v3 = {'batch_id': v1} if v2: v3['hosts_to_remove'] = v2 v4 = self.session.post(self.base_url + '/combine...
Imports: ```python import re import typing ``` Type definitions: Input Types: argparse.ArgumentParser, str, bool, str, str, bool Output Type: None Dependencies: ```python def v0(v1: str) -> Union[str, None]: if re.match(accepted_regex, v1): return template.format(v1) elif keep_nonmatch: return ...
Imports: ```python from pathlib import Path import typing ``` Type definitions: Input Types: Any, str Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1, v2: str): self.logger.info(v2) for v3 in self.working_dir.rglob('*.md'): self.current_filename = Path(v3).relative...
Imports: ```python import typing ``` Type definitions: Input Types: str, str Output Type: Optional[Tuple[str, int]] Dependencies: Function Name: v0 Function: ```python def v0(v1: str, v2: str) -> Optional[Tuple[str, int]]: if not v1 or v1[0] != v2: return None v3 = 1 v4 = [] while v3 < len(v1)...
Imports: ```python import typing ``` Type definitions: Input Types: str, dict Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str=None, v2: dict=None): self._end_url = v1 self._params = v2 ```
Imports: ```python import numpy as np from itertools import permutations import typing ``` Type definitions: Input Types: List[List[int]], List[List[int]] Output Type: int Dependencies: Function Name: v0 Function: ```python def v0(self, v1: List[List[int]], v2: List[List[int]]) -> int: v3 = np.array(v1) v4 = ...
Imports: ```python from pathlib import Path import typing ``` Type definitions: Input Types: str Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(v1: str): v2 = Path(v1) v2.mkdir(parents=True, exist_ok=True) return str(v2) ```
Imports: ```python import typing ``` Type definitions: Input Types: timedelta Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(self, v1: timedelta) -> str: v2 = f"{v1.days} day{('s,' if v1.days > 1 else ', ')}" (v3, v4) = divmod(int(v1.total_seconds()), 3600 * 24) (v5, v4) = di...
Imports: ```python import warnings import typing ``` Type definitions: Input Types: bool Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: bool): warnings.warn('Not recommended API', UserWarning) if self.render and (not v1): self.close() self.port = None ...
Imports: ```python import numpy as np import typing ``` Type definitions: Input Types: np.ndarray, np.ndarray Output Type: float Dependencies: Function Name: v0 Function: ```python def v0(v1: np.ndarray, v2: np.ndarray) -> float: v3 = list(np.unique(v1)) v4 = list(np.unique(v2)) v5 = {} for v6 in v3[1...
Imports: ```python import typing ``` Type definitions: Input Types: str Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str) -> str: v2 = [] for v3 in v1.split('/'): if v3 == '' or v3 == '.': continue elif v3 == '..': if v2: ...
Imports: ```python import urllib import typing ``` Type definitions: Input Types: str, Any Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: str=os.path.expanduser('~/Downloads/'), v2=''): if not v2: v2 = self.name + '.torrent' else: v2 = v2.strip('.torrent'...
Imports: ```python import sys import typing ``` Type definitions: Input Types: Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(self) -> str: v1 = dict(win32='PATH', linux='LD_LIBRARY_PATH', darwin='DYLD_LIBRARY_PATH') v2: str = v1.get(sys.platform, None) if v2 is None: ...
Imports: ```python import asyncio import typing ``` Type definitions: Input Types: int Output Type: int Dependencies: Function Name: v0 Function: ```python async def v0(v1: int) -> int: v2 = 1 print(f'started to calculate {v1}!') for v3 in range(1, v1 + 1): v2 *= v3 if v3 % 1000 == 0: ...
Imports: ```python import typing ``` Type definitions: Input Types: datetime.datetime Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: datetime.datetime): self.timestamp = v1 return self ```
Imports: ```python import numpy as np import numpy.matlib from scipy.signal import find_peaks import typing ``` Type definitions: Input Types: float, Optional[float] Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: float=0.1, v2: Optional[float]=None): v3 = list(self.mutual_in...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: Optional[str] Dependencies: Function Name: v0 Function: ```python def v0(self) -> Optional[str]: if not self.rpm_build_task_id: return None return f'https://koji.fedoraproject.org/koji/taskinfo?taskID={self.rpm_build_tas...
Imports: ```python import typing ``` Type definitions: Input Types: bool, Optional[Dict[str, str]] Output Type: str Dependencies: Function Name: v0 Function: ```python def v0(v1: bool=False, v2: Optional[Dict[str, str]]=None) -> str: v3 = [] v4 = [] if v2 is None: v2 = {} if v1: v3 = [...
Imports: ```python import typing ``` Type definitions: Input Types: Output Type: None Dependencies: Function Name: v0 Function: ```python def v0(self) -> None: if self.reserved_tcp_socket: self.reserved_tcp_socket.close() self.reserved_tcp_socket = None ```
Imports: ```python import pandas as pd from sys import float_info as sflt import typing ``` Type definitions: Input Types: pd.Series, float, bool, int Output Type: Any Dependencies: ```python def v0(v1: pd.Series, v2: pd.Series, v3: bool=True, v4: bool=True, v5: int=None, **v6): v1 = verify_series(v1) v2 = ver...
Imports: ```python import typing ``` Type definitions: Input Types: Tuple, List[Union[str, int]] Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Tuple, v2: List[Union[str, int]]): if not self.is_built: self.build(v1) self.procedure.update_args(v1, v2) self.exe...
Imports: ```python from os import listdir, makedirs, rename, stat from os.path import dirname, exists, isdir, isfile, join import typing ``` Type definitions: Input Types: str, Any Output Type: Any Dependencies: ```python def v0(v1: str): return {'Jan': '(01)Janvier', 'Feb': '(02)Fevrier', 'Mar': '(03)Mars', 'Apr'...
Imports: ```python import typing ``` Type definitions: Input Types: Dict[Any, Any] Output Type: Any Dependencies: Function Name: v0 Function: ```python def v0(self, v1: Dict[Any, Any]): v2 = self.metadata.get('fileheader') or {} self.metadata['fileheader'] = {**v1, **v2} ```