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
v29
[ "v0" ]
None
def v29(self, v30: v0) -> None: (v31, v32, v33) = v30.origin if not v30.blocker: if v31 in self.ignored_lines: if v33 < v32: (v32, v33) = (v33, v32) for v34 in range(v32, v33 + 1): if self.is_ignored_error(v34, v30, self.ignored_lines[v31]): ...
[]
[]
[]
17
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
[ "class v0:\n v1 = None\n v2 = ''\n v3 = None\n v4 = ''\n v5 = ''\n v6 = 0\n v7 = 0\n v8 = ''\n v9 = ''\n v10 = None\n v11 = False\n v12 = False\n v13 = None\n v14 = None\n\n def __init__(self, v15: List[Tuple[str, int]], v16: str, v17: Optional[str], v18: Optional[str], ...
v29
[ "int", "v0", "Dict[int, List[str]]" ]
bool
def v29(self, v30: int, v31: v0, v32: Dict[int, List[str]]) -> bool: if v31.blocker: return False if v31.code and self.is_error_code_enabled(v31.code) is False: return True if v30 not in v32: return False if not v32[v30]: return True if v31.code and self.is_error_code...
[]
[]
[]
12
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
[ "class v0:\n v1 = None\n v2 = ''\n v3 = None\n v4 = ''\n v5 = ''\n v6 = 0\n v7 = 0\n v8 = ''\n v9 = ''\n v10 = None\n v11 = False\n v12 = False\n v13 = None\n v14 = None\n\n def __init__(self, v15: List[Tuple[str, int]], v16: str, v17: Optional[str], v18: Optional[str], ...
v0
[ "str", "Set[str]" ]
None
def v0(self, v1: str, v2: Set[str]) -> None: if v1 in self.error_info_map: v3 = [] for v4 in self.error_info_map[v1]: if v4.target not in v2: v3.append(v4) elif v4.only_once: self.only_once_messages.remove(v4.message) self.error_info_ma...
[]
[]
[]
9
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
null
v0
[]
Optional[str]
def v0(self) -> Optional[str]: for v1 in self.error_info_map.values(): for v2 in v1: if v2.blocker: return v2.module return None
[]
[]
[]
6
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
null
v0
[]
Tuple[int, int]
def v0(self) -> Tuple[int, int]: v1 = self.error_info_map[self.file][-1] return (v1.line, v1.column)
[]
[]
[]
3
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
null
v0
[ "str" ]
List[str]
def v0(self, v1: str) -> List[str]: if v1 not in self.error_info_map: return [] self.flushed_files.add(v1) v2 = None if self.pretty: assert self.read_source v2 = self.read_source(v1) return self.format_messages(self.error_info_map[v1], v2)
[]
[]
[]
9
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
null
v0
[]
List[str]
def v0(self) -> List[str]: v1 = [] for v2 in self.error_info_map.keys(): if v2 not in self.flushed_files: v1.extend(self.file_messages(v2)) return v1
[]
[]
[]
6
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
null
v33
[ "List[v0]" ]
List[v29]
def v33(self, v34: List[v0]) -> List[v29]: v35 = [] v36 = [] v37 = None v38 = None for v39 in v34: if not self.show_error_context: pass elif v39.import_ctx != v36: v40 = len(v39.import_ctx) - 1 v41 = v40 while v41 >= 0: ...
[ { "name": "v30", "input_types": [ "str", "Optional[str]" ], "output_type": "str", "code": "def v30(v31: str, v32: Optional[str]) -> str:\n if v32 is not None and v31.startswith(v32):\n return v31[len(v32):]\n else:\n return v31", "dependencies": [] } ]
[]
[]
46
import os.path import sys import traceback from mypy.ordered_dict import OrderedDict from collections import defaultdict from typing import Tuple, List, TypeVar, Set, Dict, Optional, TextIO, Callable from typing_extensions import Final from mypy.scope import Scope from mypy.options import Options from mypy.version im...
[ "class v0:\n v1 = None\n v2 = ''\n v3 = None\n v4 = ''\n v5 = ''\n v6 = 0\n v7 = 0\n v8 = ''\n v9 = ''\n v10 = None\n v11 = False\n v12 = False\n v13 = None\n v14 = None\n\n def __init__(self, v15: List[Tuple[str, int]], v16: str, v17: Optional[str], v18: Optional[str], ...
v15
[ "Any", "Any" ]
bool
def v15(v16: Any, v17: Any) -> bool: if v16.__args__ == v17.__args__: return True if len(v17.__args__) == 1 and isinstance(v17.__args__[0], TypeVar) and (v17.__args__[0].__name__ == 'T'): return True for v18 in v16.__args__: if not any((v11(v18, arg2) for v19 in v17.__args__)): ...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
9
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v15
[ "Any", "Any" ]
bool
def v15(v16: Any, v17: Any) -> bool: if v16.__args__ == v17.__args__: return True if not v17.__args__: return True if not v16.__args__ and v17.__args__: return False if len(v17.__args__) == 1: return all((v11(arg1, v17.__args__[0]) for v18 in v16.__args__)) if len(v16...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
15
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v15
[ "Any", "Any" ]
bool
def v15(v16: Any, v17: Any) -> bool: if getattr(v16, '__origin__', None) == Union: for v18 in range(len(v17.__args__)): if v17.__args__[v18] is None: v17.__args__[v18] = type(None) for v19 in v16.__args__: if v19 is None: v19 = type(None) ...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
12
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v15
[ "Any", "Any" ]
bool
def v15(v16: Any, v17: Any) -> bool: (v18, v19) = (v16.__args__[0], v17.__args__[0]) if isinstance(v18, TypeVar) and v18.__name__ == 'KT': v18 = Any if isinstance(v19, TypeVar) and v19.__name__ == 'KT': v19 = Any if not v11(v18, v19): return False (v20, v21) = (v16.__args__[1...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
14
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v15
[ "Any", "Any" ]
bool
def v15(v16: Any, v17: Any) -> bool: if len(v16.__args__) != len(v17.__args__): return False return all((v11(v16.__args__[i], v17.__args__[i]) for v18 in range(len(v16.__args__))))
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
4
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v15
[ "Any", "Any" ]
bool
def v15(v16: Any, v17: Any) -> bool: if isinstance(v16, type): return hasattr(tuple, '__iter__') if isinstance(v17.__args__[0], TypeVar): return True return v11(v16.__args__[0], v17.__args__[0])
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
6
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v20
[ "Tuple[str, ...]" ]
Any
def v20(v21: Tuple[str, ...]): def v22(v23: Any, v24: Any) -> bool: if v24.__origin__ != v23.__origin__: return False if tuple((arg.__name__ for v25 in v24.__args__ if isinstance(v25, TypeVar))) == v21: return True return all((v16(v23.__args__[i], v24.__args__[i]) fo...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n if v2.__origin__ != v1.__origin__:\n return False\n if tuple((arg.__name__ for v3 in v2.__args__ if isinstance(v3, TypeVar))) == type_vars:\n retur...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
9
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v8
[ "Any", "Any" ]
bool
def v8(v9: Any, v10: Any) -> bool: if isinstance(v10, type) and issubclass(v10, dict) and hasattr(v10, '__annotations__'): for (v11, v12) in v10.__annotations__.items(): if v11 not in v9.__annotations__ or not v4(v9.__annotations__[v11], v12): return False elif hasattr(v10, '...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "bool", "code": "def v0(v1: Any, v2: Any) -> bool:\n return issubclass(v1.__origin__, v2.__origin__) and (len(v1.__args__) == len(v2.__args__) and all((is_subtype(v1.__args__[i], v2.__args__[i]) for v3 in range(len(v1...
[ "typing" ]
[ "from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic" ]
16
from typing import Any, Tuple, TypeVar, Union, Hashable, Sized, _SpecialForm, Generic from collections.abc import Callable, Iterable, Container, Reversible, Coroutine, Generator, AsyncGenerator from .tools import is_typed_dict, typeddict_to_dict def check_list(frst: Any, scnd: Any) -> bool: if frst.__args__ == ...
null
v0
[ "Any", "Any", "float" ]
Any
def v0(v1, v2, v3: float=1e-06): v1[..., -1] += v3 return torch.sum(v2[..., None] >= v1, dim=-1) - 1
[]
[ "torch" ]
[ "import torch", "from torch.nn import functional as F" ]
3
""" MIT License Copyright (c) 2019 Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation ...
null
v67
[ "Any", "Any", "Any", "Any", "bool", "float", "float", "float", "float" ]
Any
def v67(v68, v69, v70, v71, v72: bool=False, v73: float=1.0, v74: float=DEFAULT_MIN_BIN_WIDTH, v75: float=DEFAULT_MIN_BIN_HEIGHT, v76: float=DEFAULT_MIN_DERIVATIVE): v77 = (v68 >= -v73) & (v68 <= v73) v78 = ~v77 v79 = torch.zeros_like(v68) v80 = torch.zeros_like(v68) v71 = F.pad(v71, pad=(1, 1)) ...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any", "Any", "Any", "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3, v4, v5, v6, v7, v8):\n v9 = (v1 - v8) / v7\n v10 = v9 * (1 - v9)\n v11 = v6 * (v5 * v9.pow(2) + v3...
[ "math", "torch" ]
[ "import math", "import torch", "from torch.nn import functional as F" ]
14
""" MIT License Copyright (c) 2019 Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation ...
null
v39
[ "Any", "Any", "Any", "Any", "bool", "float", "float", "float", "float", "float", "float", "float" ]
Any
def v39(v40, v41, v42, v43, v44: bool=False, v45: float=0.0, v46: float=1.0, v47: float=0.0, v48: float=1.0, v49: float=DEFAULT_MIN_BIN_WIDTH, v50: float=DEFAULT_MIN_BIN_HEIGHT, v51: float=DEFAULT_MIN_DERIVATIVE): v52 = v41.shape[-1] if v49 * v52 > 1.0: raise ValueError('Minimal bin width too large for ...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any", "Any", "Any", "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3, v4, v5, v6, v7, v8):\n v9 = (v1 - v8) / v7\n v10 = v9 * (1 - v9)\n v11 = v6 * (v5 * v9.pow(2) + v3...
[ "torch" ]
[ "import torch", "from torch.nn import functional as F" ]
38
""" MIT License Copyright (c) 2019 Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation ...
null
v0
[ "dict", "dict" ]
dict
def v0(v1: dict, v2: dict) -> dict: v3 = v1.copy() v3.update(v2) for (v4, v5) in list(v3.items()): if v5 == '': v3.pop(v4) return v3
[]
[]
[]
7
# -*- coding: utf-8 -*- import hashlib import os import shutil from functools import wraps import pytest from .. import Image, ImageData, set_log_level from . import testdata current_dir = os.path.dirname(__file__) original_path = os.path.join(current_dir, '1.jpg') path = os.path.join(current_dir, 'tmp.jpg') def s...
null
v1
[ "Callable[[Any], v0]", "Any" ]
List[v0]
def v1(v2: Callable[[Any], v0], v3: Any) -> List[v0]: if v3 is None: return None assert isinstance(v3, list) return [v2(y) for v4 in v3]
[]
[]
[]
5
import re import datetime from dateutil import parser as dateutil_parser from typing import Any, Callable, List, Literal, Optional, TypeVar, Union # api.tweet.profile # User profile payload # # generator version 1 T = TypeVar('T') def from_str(x: Any) -> str: if x is None: return None assert isinstance(x, ...
[ "v0 = TypeVar('T')" ]
v0
[ "Any" ]
int
def v0(v1: Any) -> int: assert isinstance(v1, int) and (not isinstance(v1, bool)) return v1
[]
[]
[]
3
# To use this code, make sure you # # import json # # and then, to convert JSON from a string, do # # result = team_rename_payload_from_dict(json.loads(json_string)) from dataclasses import dataclass from typing import Optional, Any, List, TypeVar, Callable, Type, cast T = TypeVar("T") def from_str(x: Any)...
null
v0
[]
None
def v0(self) -> None: self.api_key: str = os.getenv('NOTION_API_KEY') self.page_url: str = os.getenv('NOTION_PAGE_URL') self.database_id: str = os.getenv('NOTION_database_id') self.page_id: str = self.get_page_id_from_url(self.page_url) self.URL_HEADERS = {'Authorization': f'Bearer {self.api_key}', ...
[]
[ "os" ]
[ "import os" ]
6
import os import requests import re import json class NotionService: BASE_API_URL = 'https://api.notion.com/v1/pages' PAGE_TITLE_MAX_LENGTH = 10 def __init__(self) -> None: pass def setup_settings(self) -> None: self.api_key: str = os.getenv('NOTION_API_KEY') self.page_url: ...
null
v0
[ "Any" ]
object
def v0(self, v1) -> object: v2 = v1 if len(v1) < self.PAGE_TITLE_MAX_LENGTH else v1[:self.PAGE_TITLE_MAX_LENGTH] + '...' return {'parent': {'database_id': self.database_id}, 'properties': {'Name': {'title': [{'type': 'text', 'text': {'content': v2}}]}}, 'children': [{'object': 'block', 'type': 'paragraph', 'par...
[]
[]
[]
3
import os import requests import re import json class NotionService: BASE_API_URL = 'https://api.notion.com/v1/pages' PAGE_TITLE_MAX_LENGTH = 10 def __init__(self) -> None: pass def setup_settings(self) -> None: self.api_key: str = os.getenv('NOTION_API_KEY') self.page_url: ...
null
v0
[ "str" ]
str
def v0(self, v1: str) -> str: v2 = re.compile('([\\w|\\d]{32}$)') v3 = v2.findall(v1)[0] v4 = '-'.join([v3[0:8], v3[8:12], v3[12:16], v3[16:20], v3[20:]]) return v4
[]
[ "re" ]
[ "import re" ]
5
import os import requests import re import json class NotionService: BASE_API_URL = 'https://api.notion.com/v1/pages' PAGE_TITLE_MAX_LENGTH = 10 def __init__(self) -> None: pass def setup_settings(self) -> None: self.api_key: str = os.getenv('NOTION_API_KEY') self.page_url: ...
null
v0
[]
None
def v0(self) -> None: if self.config.get('daemon'): return with self._num_wizards_lock: if self._num_wizards_in_progress > 0 or len(self.windows) > 0: return self.app.quit()
[]
[]
[]
7
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
null
v0
[ "str", "List[str]" ]
List[str]
def v0(self, v1: str, v2: List[str]) -> List[str]: v3 = v2[0] for v4 in v2: v1 = v3.join(v1.split(v4)) return v1.split(v3)
[]
[]
[]
5
from abc import ABC, abstractmethod from typing import Dict, Pattern, Optional, List from decimal import Decimal, getcontext import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.extractor import ExtractResult from recognizers_text.parser import Parser, ParseResult from recognizers_num...
null
v0
[ "int", "int" ]
bool
def v0(self, v1: int, v2: int) -> bool: v3 = 100 if v2 > 10 else 10 return v1 % v3 == 0 and v1 / v3 >= 1
[]
[]
[]
3
from abc import ABC, abstractmethod from typing import Dict, Pattern, Optional, List from decimal import Decimal, getcontext import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.extractor import ExtractResult from recognizers_text.parser import Parser, ParseResult from recognizers_num...
null
v0
[ "List[str]" ]
Decimal
def v0(self, v1: List[str]) -> Decimal: v2 = [False] * len(v1) v3 = 0 v4 = 1 for v5 in range(len(v1) - 1, 0, -1): if v1[v5] in self.round_number_set: if v4 > self.config.round_number_map[v1[v5]]: continue v2[v5] = True v4 = self.config.round_nu...
[]
[ "decimal" ]
[ "from decimal import Decimal, getcontext" ]
67
from abc import ABC, abstractmethod from typing import Dict, Pattern, Optional, List from decimal import Decimal, getcontext import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.extractor import ExtractResult from recognizers_text.parser import Parser, ParseResult from recognizers_num...
null
v0
[ "List[str]" ]
Decimal
def v0(self, v1: List[str]) -> Decimal: v2 = 0 v3 = v1[0] if v3 in self.config.cardinal_number_map and self.config.cardinal_number_map[v3] >= 10: v4 = '0.' v5 = self.__get_int_value(v1) v2 = Decimal(v4 + str(v5)) else: v6 = Decimal(0.1) for v7 in v1: v...
[]
[ "decimal" ]
[ "from decimal import Decimal, getcontext" ]
13
from abc import ABC, abstractmethod from typing import Dict, Pattern, Optional, List from decimal import Decimal, getcontext import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.extractor import ExtractResult from recognizers_text.parser import Parser, ParseResult from recognizers_num...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: self.separator_ = v1 self.setDisplayFormat('dd%sMM%syyyy' % (self.separator(), self.separator()))
[]
[]
[]
3
"""Qdateedit module.""" # -*- coding: utf-8 -*- from PyQt5 import QtWidgets, QtCore # type: ignore from pineboolib.core import decorators from typing import Any, Union class QDateEdit(QtWidgets.QDateEdit): """QDateEdit class.""" _parent: QtWidgets.QWidget _date: str separator_ = "-" def __init...
null
v0
[ "int" ]
None
def v0(self, v1: int) -> None: (v2, v3, v4) = self.train.to_components(negative_samples=self.samples, aux_matrix=self.val.interactions) (v5, v6, v7, v8, v9, v10) = train_test_split(v2, v3, v4, test_size=0.2) self._model.fit([v5, v7], v9, epochs=1, batch_size=self.batch_size, validation_data=([v6, v8], v10))
[]
[ "sklearn" ]
[ "from sklearn.model_selection import train_test_split" ]
4
from typing import Dict import numpy as np from sklearn.model_selection import train_test_split from xanthus.evaluate import metrics, create_rankings, score from xanthus.models.baseline import MatrixFactorization as MFModel from xanthus.models import ( MultiLayerPerceptron, GeneralizedMatrixFactorization, ...
null
v66
[]
Generator[Union[Tuple[Tuple[int, int], v0], 'OneOfTransaction'], None, None]
def v66(self) -> Generator[Union[Tuple[Tuple[int, int], v0], 'OneOfTransaction'], None, None]: for v67 in self.possibleTransactions: yield v67.walkFlatten(offset=self.offset, shouldEnterFn=self.shouldEnterFn)
[]
[]
[]
3
from builtins import isinstance from copy import deepcopy from typing import Callable, Tuple, Generator, Union, Optional from hwt.doc_markers import internal from hwt.hdl.types.array import HArray from hwt.hdl.types.bits import Bits from hwt.hdl.types.hdlType import HdlType from hwt.hdl.types.stream import HStream fro...
[ "class v0(object):\n\n def __init__(self, v1: HdlType, v2: int=0, v3: Optional['TransTmpl']=None, v4: Optional[HStructField]=None, v5: TypePath=TypePath()):\n self.parent = v3\n assert isinstance(v1, HdlType), v1\n assert isinstance(v5, TypePath), v5\n assert v3 is None or isinstance(...
v0
[ "str" ]
Any
def v0(self, v1: str): if v1.lower() == 'n': self.roll_n() if v1.lower() == 'e': self.roll_e() if v1.lower() == 's': self.roll_s() if v1.lower() == 'w': self.roll_w()
[]
[]
[]
9
import copy class Dice: def __init__(self, eyes: [int]): self.__eyes = eyes @property def eyes(self): return self.__eyes def top(self): # pragma no cover return self.__eyes[0] def right(self): # pragma no cover return self.__eyes[2] def roll_s(self): ...
null
v0
[ "int" ]
Any
def v0(self, v1: int): if v1 < 0: raise ValueError('Damage points cannot be less than zero.') self.health -= v1
[]
[]
[]
4
from abc import ABC, abstractmethod from project.card.card_repository import CardRepository class Player(ABC): @abstractmethod def __init__(self, username, health): self.username = username self.health = health self.card_repository = CardRepository() @property def username(se...
null
v0
[ "int" ]
bool
def v0(self, v1: int) -> bool: if v1 < 0: return False v2 = str(v1) v3 = 0 v4 = len(v2) - 1 if v4 == v3: return True else: while v4 - v3 >= 1: if v2[v3] != v2[v4]: return False v3 += 1 v4 -= 1 return True
[]
[]
[]
15
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @project : LeetCode @File : isPalindrome @Contact : 9824373@qq.com @Desc : 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出: false 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 示...
null
v0
[ "Optional[Union[List[str], str]]" ]
str
def v0(self, v1: Optional[Union[List[str], str]]=None) -> str: if isinstance(v1, list): v2 = [(self.expression.find(s), s) for v3 in v1 if v3 in self.expression] if v2: (v4, v1) = min(v2, key=itemgetter(0)) else: v4 = -1 elif v1: v4 = self.expression.find(...
[]
[ "operator" ]
[ "from operator import itemgetter" ]
18
import collections import datetime import itertools import json import math from operator import itemgetter import random import re import sys from typing import List, Optional, Union import pytz from pytz import UnknownTimeZoneError from .sql.casts import get_time_formatter from .sql.internal_utils.joins import ( ...
null
v0
[]
None
def v0(self) -> None: for (v1, v2, v3) in os.walk('./ax/ax', topdown=False): self.assertTrue('__init__.py' in v3, 'directory ' + v1 + ' does not contain a .__init__.py file')
[]
[ "os" ]
[ "import os" ]
3
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from ax.utils.common.testutils import TestCase class InitTest(TestCase): def testInitFiles(self) -> ...
null
v0
[ "str", "str", "str", "str", "str", "bool" ]
Any
def v0(self, v1: str, *, v2: str, v3: str, v4: str=None, v5: str=None, v6: bool=False): v7 = 'sni' if v6: v7 += '-regexp' v8 = [item for v9 in (v2, v3, v4, v5) if v9 is not None] self._set(v7, f"{v1} {','.join(v8)}") return self._section
[]
[]
[]
7
from os import geteuid from urllib.parse import urlsplit, parse_qs from .networking_sockets import * from ..base import OptionsGroup from ..exceptions import ConfigurationError class Networking(OptionsGroup): """Networking related stuff. Socket definition, binding and tuning.""" class sockets: "...
null
v4
[ "torch.Tensor", "int", "int" ]
List[Iterable[int]]
def v4(self, v5: torch.Tensor, v6: int, v7: int) -> List[Iterable[int]]: if v7 + 1 < self.ngram_size: return [[] for v8 in range(v6)] v9 = [{} for v8 in range(v6)] for v10 in range(v6): v11 = v5[v10].tolist() v12 = v9[v10] for v13 in zip(*[v11[i:] for v14 in range(self.ngram_...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = cur_len + 1 - self.ngram_size\n v3 = tuple(prev_input_ids[v1, v2:cur_len].tolist())\n return generated_ngrams[v1].get(v3, [])", "dependencies": [] } ]
[]
[]
17
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
null
v0
[ "torch.LongTensor", "List[int]" ]
bool
def v0(self, v1: torch.LongTensor, v2: List[int]) -> bool: if len(v2) == 0: return True elif len(v2) > len(v1): return False elif v1[-len(v2):].tolist() == v2: return True else: return False
[]
[]
[]
9
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
null
v0
[ "Iterable[int]" ]
Iterable[int]
def v0(self, v1: Iterable[int]) -> Iterable[int]: v2 = [] for v3 in v1: v4 = [] for v5 in self.bad_words_ids: if self._tokens_match(v3, v5[:-1]) is False: continue v4.append(v5[-1]) v2.append(v4) return v2
[]
[]
[]
10
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
null
v0
[ "torch.Tensor", "List[List[int]]" ]
None
def v0(self, v1: torch.Tensor, v2: List[List[int]]) -> None: v3 = [] for (v4, v5) in enumerate(v2): for v6 in v5: v3.append([v4, v6]) if not v3: return v1 v7 = torch.LongTensor(v3) v8 = torch.ones(len(v7)) v7 = torch.sparse.LongTensor(v7.t(), v8, v1.size()).to(v1.devi...
[]
[ "torch" ]
[ "import torch", "from torch.nn import functional as F" ]
12
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
null
v0
[]
int
def v0() -> int: v1 = 1 v2 = 2 v3 = 0 while v1 < 4000000: if v1 % 2 == 0: v3 = v3 + v1 v4 = v1 + v2 v1 = v2 v2 = v4 return v3
[]
[]
[]
11
#!/usr/bin/python3 """ Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the...
null
v0
[]
None
def v0(self, *v1, **v2) -> None: if not (self.root / 'train').exists(): raise ValueError(f'Please download and set ImageNet-1k train data under {self.root}.') if not (self.root / 'val').exists(): raise ValueError(f'Please download and set ImageNet-1k val data under {self.root}.')
[]
[]
[]
5
import pathlib from dataclasses import dataclass from typing import Any, Callable, Final, Optional, Tuple import albumentations as albu import torchvision from albumentations.pytorch import ToTensorV2 from trainer.factory.datasets import BaseDataModule, DatasetStats @dataclass(frozen=True) class Imagenet1kStats(Dat...
null
v24
[ "str", "int" ]
Any
def v24(self, v25: str, v26: int): v27 = '{}_{}'.format(self.name, v25) return v6(self.menv, v27, v26)
[ { "name": "v0", "input_types": [ "msat_env", "str", "Any" ], "output_type": "tuple", "code": "def v0(v1: msat_env, v2: str, v3) -> tuple:\n assert not v2.startswith('_'), v2\n v4 = msat_declare_function(v1, v2, v3)\n v4 = msat_make_constant(v1, v4)\n v5 = msat_decla...
[ "math" ]
[ "from math import log, ceil" ]
3
from typing import FrozenSet from collections import Iterable from math import log, ceil from mathsat import msat_term, msat_env from mathsat import msat_make_constant, msat_declare_function from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type from mathsat import msat_make_and, msa...
null
v1
[ "Any", "v0" ]
v0
def v1(v2, v3: v0) -> v0: try: v2 = int(v2) except: return v2 * v3 else: return 0 if v2 == 0 else v3 if v2 == 1 else v2 * v3
[]
[]
[]
7
# Copyright 2021 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, ...
[ "v0 = Any" ]
v23
[ "List[v0]" ]
v3
def v23(v24: List[v0]) -> v3: v25: v3 = {} def v26() -> str: if v25: return ' Partial solution: ' + ', '.join([f'{var} = {val}' for (v27, v28) in v25.items()]) + '.' else: return '' def v29(v30: v0) -> bool: (v31, v32) = (None, None) v33 = v30.tf_exp...
[ { "name": "v5", "input_types": [ "Any", "v4" ], "output_type": "v4", "code": "def v5(v6, v7: v4) -> v4:\n try:\n v6 = int(v6)\n except:\n return v6 * v7\n else:\n return 0 if v6 == 0 else v7 if v6 == 1 else v6 * v7", "dependencies": [] }, { "...
[ "tensorflow" ]
[ "import tensorflow as tf" ]
61
# Copyright 2021 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, ...
[ "@dataclasses.dataclass\nclass v0:\n v1: _DimPolynomial\n v2: TfVal", "v3 = Dict[str, TfVal]", "v4 = Any" ]
v0
[]
Optional[str]
def v0(self) -> Optional[str]: v1 = self.monomials() if len(v1) != 1: return None ((v2, v3),) = v1 if v3 != 1: return None return v2.to_var()
[]
[]
[]
8
# Copyright 2021 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, ...
null
v0
[]
Set[str]
def v0(self) -> Set[str]: v1 = set() for (v2, v3) in self.monomials(): v1.update(v2.get_vars()) return v1
[]
[]
[]
5
# Copyright 2021 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, ...
null
v4
[ "Dict[str, Any]" ]
Any
def v4(self, v5: Dict[str, Any]) -> Any: def v6(v7, v8): return v7 if v8 == 1 else pow(v7, v8) v9 = [v1(coeff, mon.evaluate(v5)) for (v10, v11) in self.items()] return sum(v9) if len(v9) > 1 else v9[0]
[ { "name": "v1", "input_types": [ "Any", "v0" ], "output_type": "v0", "code": "def v1(v2, v3: v0) -> v0:\n try:\n v2 = int(v2)\n except:\n return v2 * v3\n else:\n return 0 if v2 == 0 else v3 if v2 == 1 else v2 * v3", "dependencies": [] } ]
[]
[]
6
# Copyright 2021 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, ...
[ "v0 = Any" ]
v0
[ "nn.Module", "int" ]
nn.Module
def v0(v1: nn.Module, v2: int) -> nn.Module: v3 = list(v1.children()) v4 = v3[:-1] v5 = nn.Sequential(*v4) v5.out_channels = v2 return v5
[]
[ "torch" ]
[ "import torch.nn as nn" ]
6
from typing import Optional, Tuple import torch.nn as nn from pl_bolts.models.detection.components._supported_models import TORCHVISION_MODEL_ZOO from pl_bolts.utils import _TORCHVISION_AVAILABLE # noqa: F401 from pl_bolts.utils.warnings import warn_missing_pkg # noqa: F401 def _create_backbone_generic(model: nn....
null
v6
[ "nn.Module", "Optional[int]" ]
nn.Module
def v6(v7: nn.Module, v8: Optional[int]=None) -> nn.Module: if v8 is None: v9 = list(v7.children()) v8 = v9[-1].in_features return v0(v7, out_channels=v8)
[ { "name": "v0", "input_types": [ "nn.Module", "int" ], "output_type": "nn.Module", "code": "def v0(v1: nn.Module, v2: int) -> nn.Module:\n v3 = list(v1.children())\n v4 = v3[:-1]\n v5 = nn.Sequential(*v4)\n v5.out_channels = v2\n return v5", "dependencies": [] } ...
[ "torch" ]
[ "import torch.nn as nn" ]
5
from typing import Optional, Tuple import torch.nn as nn from pl_bolts.models.detection.components._supported_models import TORCHVISION_MODEL_ZOO from pl_bolts.utils import _TORCHVISION_AVAILABLE # noqa: F401 from pl_bolts.utils.warnings import warn_missing_pkg # noqa: F401 def _create_backbone_generic(model: nn....
null
v0
[ "nn.Module", "int" ]
nn.Module
def v0(v1: nn.Module, v2: int) -> nn.Module: v3 = v1.features v3.out_channels = v2 return v3
[]
[]
[]
4
from typing import Optional, Tuple import torch.nn as nn from pl_bolts.models.detection.components._supported_models import TORCHVISION_MODEL_ZOO from pl_bolts.utils import _TORCHVISION_AVAILABLE # noqa: F401 from pl_bolts.utils.warnings import warn_missing_pkg # noqa: F401 def _create_backbone_generic(model: nn....
null
v0
[ "list", "list" ]
Any
def v0(self, v1: list=None, v2: list=None): v3 = v1 if v1 else list(self.S) + list(self.s_dot_a()) v4 = v2 if v2 else self.E v3.reverse() for v5 in v3: for v6 in v4: if len(self.T[v5]) != len(self.E): v7 = self.sul.query(v5 + v6) self.T[v5] += (v7[-1],...
[]
[]
[]
9
from collections import defaultdict from aalpy.base import Automaton, SUL from aalpy.automata import Dfa, DfaState, MealyState, MealyMachine, MooreMachine, MooreState aut_type = ['dfa', 'mealy', 'moore'] closing_options = ['shortest_first', 'longest_first', 'single'] class ObservationTable: def __init__(self, a...
null
v1
[ "v0" ]
v0
def v1(v2: v0) -> v0: ... return v2
[]
[]
[]
3
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # "Fuzzing with Grammars" - a chapter of "The Fuzzing Book" # Web site: https://www.fuzzingbook.org/html/Grammars.html # Last change: 2021-11-03 13:03:24+01:00 # # Copyright (c) 2021 CISPA Helmholtz Center for Information Security # Copyright (c) 2018-2020 Saarland Univer...
[ "v0 = Mapping[str, List[Union[str, Tuple[str, Option]]]]" ]
v0
[ "bool" ]
Any
def v0(self, v1: bool): v2 = bool(self._providerControl.getProviderInstance()) if v1 and (not v2): self._providerControl.startProvider() elif not v1 and v2: self._providerControl.terminateProvider()
[]
[]
[]
6
# visionEnhancementProviders/NVDAHighlighter.py # A part of NonVisual Desktop Access (NVDA) # This file is covered by the GNU General Public License. # See the file COPYING for more details. # Copyright (C) 2018-2019 NV Access Limited, Babbage B.V., Takuya Nishimoto """Default highlighter based on GDI Plus.""" ...
null
v0
[ "wx.CommandEvent" ]
Any
def v0(self, v1: wx.CommandEvent): v2 = self._getSettingsStorage() if v1.GetEventObject() is self._enabledCheckbox: v2.highlightBrowseMode = v1.IsChecked() v2.highlightFocus = v1.IsChecked() v2.highlightNavigator = v1.IsChecked() self._ensureEnableState(v1.IsChecked()) se...
[]
[]
[]
19
# visionEnhancementProviders/NVDAHighlighter.py # A part of NonVisual Desktop Access (NVDA) # This file is covered by the GNU General Public License. # See the file COPYING for more details. # Copyright (C) 2018-2019 NV Access Limited, Babbage B.V., Takuya Nishimoto """Default highlighter based on GDI Plus.""" ...
null
v0
[ "np.ndarray", "int" ]
Any
def v0(self, v1: np.ndarray, v2: int=None): try: import yolov5 except ImportError: raise ImportError('Please run "pip install -U yolov5" to install YOLOv5 first for YOLOv5 inference.') assert self.model is not None, 'Model is not loaded, load it by calling .load_model()' if v2 is not Non...
[]
[ "warnings" ]
[ "import warnings" ]
14
# OBSS SAHI Tool # Code written by Fatih C Akyon, 2020. import logging import os import warnings from typing import Dict, List, Optional, Union import numpy as np from sahi.prediction import ObjectPrediction from sahi.utils.torch import cuda_is_available, empty_cuda_cache logger = logging.getLogger(__name__) clas...
null
v0
[ "Optional[List[int]]", "Optional[List[int]]" ]
Any
def v0(self, v1: Optional[List[int]]=[0, 0], v2: Optional[List[int]]=None): self._create_object_prediction_list_from_original_predictions(shift_amount_list=v1, full_shape_list=v2) if self.category_remapping: self._apply_category_remapping()
[]
[]
[]
4
# OBSS SAHI Tool # Code written by Fatih C Akyon, 2020. import logging import warnings from typing import Dict, List, Optional, Union import numpy as np from sahi.prediction import ObjectPrediction from sahi.utils.compatibility import fix_full_shape_list, fix_shift_amount_list from sahi.utils.cv import get_bbox_from...
null
v0
[ "Any" ]
int
def v0(v1) -> int: v2 = v1.post('/api/game') return v2.get_json()['game']['id']
[]
[]
[]
3
from doppelkopf.toggles import Toggle from doppelkopf.db import db from flask import json def test_index(client): response = client.get("/api/") assert response.status_code == 200 assert b"Healthy" in response.data def test_should_create_game(client): response = client.post("/api/game") data = r...
null
v0
[ "np.ndarray", "List", "List", "np.ndarray", "Dict", "int", "Any" ]
Any
def v0(v1: np.ndarray, v2: List=[], v3: List=[], v4: np.ndarray=None, v5: Dict=None, v6: int=18, v7=None): v8 = list(v1.keys()) if v5 is None: v5 = dict(zip(v8, [str(f) for v9 in v8])) if v4 is None: v4 = np.arange(len(v1[v8[0]])) if v7 is None: (v10, v7) = plt.subplots(1, 1) ...
[]
[ "matplotlib", "numpy" ]
[ "import numpy as np", "import matplotlib.pyplot as plt" ]
38
import numpy as np import pandas as pd import matplotlib.pyplot as plt from pymsm.multi_state_competing_risks_model import PathObject from pymsm.statistics import paths_to_timestep_matrix, get_state_timestep_probs from lifelines import AalenJohansenFitter from typing import List, Dict import warnings def competingris...
null
v25
[ "v8", "v0", "list[int]" ]
Any
def v25(v26: v8, v27: v0, v28: list[int]): for (v29, v30) in enumerate(range(v27.channel, v27.channel + v27.width)): v26.message_queue.append({'channel': v30, 'value': v28[v29]})
[]
[]
[]
3
from random import randint from dataclasses import dataclass from telnetlib import Telnet from time import sleep from datetime import datetime, timedelta from dataclasses import dataclass, field import argparse import yaml import sys import pyaudio import numpy as np import matplotlib.pyplot as plt from scipy import ...
[ "@dataclass\nclass v0:\n v1: int\n v2: int = 4\n v3: int = 0\n v4: int = 0\n v5: list[int] = field(default_factory=lambda : [100, 100, 100, 100])\n v6 = False\n\n def v7(self):\n return f'channel: {self.channel}, width: {self.width}, val: {self.val}'", "class v8(object):\n\n def __i...
v24
[ "v7", "list[v0]", "Any" ]
Any
def v24(v25: v7, v26: list[v0], v27=True): v28 = [] global lights for v29 in v26: v30 = v29.current[:] for (v31, v32) in enumerate(v29.current): if v32 == 0 and v32 == v29.target[v31] and (v29.current != v29.target): continue if v29.step > 0: ...
[]
[]
[]
33
from random import randint from dataclasses import dataclass from telnetlib import Telnet from time import sleep from datetime import datetime, timedelta from dataclasses import dataclass, field import argparse import yaml import sys import pyaudio import numpy as np import matplotlib.pyplot as plt from scipy import ...
[ "@dataclass\nclass v0:\n v1: Fixture\n v2: list[int]\n v3: list[int]\n v4: int\n v5: list[int]\n\n def v6(self):\n return f'Fixture: {self.fixture}, current: {self.current}, target: {self.target}, step: {self.step}'", "class v7(object):\n\n def __init__(self, v8, v9, v10, v11, v12=Fals...
v0
[ "int", "int" ]
Any
def v0(v1: int, v2: int): if v1 < 0: v1 = 0 if v1 > 100: v1 = 100 if v2 < 0: v2 = 0 if v2 > 100: v2 = 100 return randint(min(v1, v2), max(v1, v2))
[]
[ "random" ]
[ "from random import randint" ]
10
from random import randint from dataclasses import dataclass from telnetlib import Telnet from time import sleep from datetime import datetime, timedelta from dataclasses import dataclass, field import argparse import yaml import sys import pyaudio import numpy as np import matplotlib.pyplot as plt from scipy import ...
null
v1
[ "v0", "str" ]
Any
def v1(v2: v0, v3: str='value'): if not isinstance(v2, (int, float)): raise TypeError(f'{v3} must be int or float')
[]
[]
[]
3
from typing import Union number = Union[int, float] def validate_number(value: number, name: str = "value"): """ Checks if the value is int or float. Raises an exception if the check fails. """ if (not isinstance(value, (int, float))): raise TypeError(f"{name} must be int or...
[ "v0 = Union[int, float]" ]
v1
[ "v0", "str" ]
Any
def v1(v2: v0, v3: str='value'): if not isinstance(v2, (int, float)): raise TypeError(f'{v3} must be int or float') elif v2 < 0: raise ValueError(f'{v3} cannot be negative')
[]
[]
[]
5
from typing import Union number = Union[int, float] def validate_number(value: number, name: str = "value"): """ Checks if the value is int or float. Raises an exception if the check fails. """ if (not isinstance(value, (int, float))): raise TypeError(f"{name} must be int or...
[ "v0 = Union[int, float]" ]
v4
[]
None
def v4(self) -> None: self.assertEqual(v0('f: List[int]', 'List'), ['List[int]']) self.assertEqual(v0('f: List', 'List'), ['List']) self.assertEqual(v0('f: list[int]', 'List'), ['list[int]']) self.assertEqual(v0('f: Dict[str, int]', 'Dict'), ['Dict[str, int]']) self.assertEqual(v0('f: Callable[[str]...
[ { "name": "v0", "input_types": [ "str", "str" ], "output_type": "List[str]", "code": "def v0(v1: str, v2: str) -> List[str]:\n return [annotation_to_string(annotation) for v3 in subscripted_annotations(cst.parse_module(dedent(v1)), v2)]", "dependencies": [] } ]
[ "textwrap" ]
[ "from textwrap import dedent" ]
14
import unittest import libcst as cst from textwrap import dedent from typing import List from .generic_annotation import subscripted_annotations, stats_from_annotations_dict from util import annotation_to_string def get_subscripted_annotations(source: str, generic_name: str) -> List[str]: return [ annotat...
null
v4
[]
None
def v4(self) -> None: self.assertEqual(v0('f: List[List[int]]', 'List'), ['List[List[int]]']) self.assertEqual(v0("F = TypeVar('F', bound=List[int])", 'List'), []) self.assertEqual(v0('MyAlias = List[int]', 'List'), [])
[ { "name": "v0", "input_types": [ "str", "str" ], "output_type": "List[str]", "code": "def v0(v1: str, v2: str) -> List[str]:\n return [annotation_to_string(annotation) for v3 in subscripted_annotations(cst.parse_module(dedent(v1)), v2)]", "dependencies": [] } ]
[ "textwrap" ]
[ "from textwrap import dedent" ]
4
import unittest import libcst as cst from textwrap import dedent from typing import List from .generic_annotation import subscripted_annotations, stats_from_annotations_dict from util import annotation_to_string def get_subscripted_annotations(source: str, generic_name: str) -> List[str]: return [ annotat...
null
v46
[ "str" ]
v0
def v46(self, v47: str) -> v0: self.epic_games_item_id = v47 return self
[]
[]
[]
3
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # justice-platform-service (4.10.0) # pylint: disabl...
[ "class v0(Model):\n v1: str\n v2: str\n v3: str\n v4: Union[str, StatusEnum]\n v5: str\n\n def v6(self, v7: str) -> v0:\n self.epic_games_item_id = v7\n return self\n\n def v8(self, v9: str) -> v0:\n self.item_id = v9\n return self\n\n def v10(self, v11: str) -> v...
v46
[ "str" ]
v0
def v46(self, v47: str) -> v0: self.transaction_id = v47 return self
[]
[]
[]
3
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # justice-platform-service (4.10.0) # pylint: disabl...
[ "class v0(Model):\n v1: str\n v2: str\n v3: str\n v4: Union[str, StatusEnum]\n v5: str\n\n def v6(self, v7: str) -> v0:\n self.epic_games_item_id = v7\n return self\n\n def v8(self, v9: str) -> v0:\n self.item_id = v9\n return self\n\n def v10(self, v11: str) -> v...
v50
[ "Union[str, v46]" ]
v0
def v50(self, v51: Union[str, v46]) -> v0: self.status = v51 return self
[]
[]
[]
3
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # justice-platform-service (4.10.0) # pylint: disabl...
[ "class v0(Model):\n v1: str\n v2: str\n v3: str\n v4: Union[str, StatusEnum]\n v5: str\n\n def v6(self, v7: str) -> v0:\n self.epic_games_item_id = v7\n return self\n\n def v8(self, v9: str) -> v0:\n self.item_id = v9\n return self\n\n def v10(self, v11: str) -> v...
v0
[ "bool" ]
dict
def v0(self, v1: bool=False) -> dict: v2: dict = {} if hasattr(self, 'epic_games_item_id'): v2['epicGamesItemId'] = str(self.epic_games_item_id) elif v1: v2['epicGamesItemId'] = '' if hasattr(self, 'item_id'): v2['itemId'] = str(self.item_id) elif v1: v2['itemId'] = '...
[]
[]
[]
23
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # justice-platform-service (4.10.0) # pylint: disabl...
null
v0
[ "str", "Callable" ]
int
def v0(v1: str, v2: Callable=do_nothing) -> int: v3 = subprocess.Popen(v1, shell=True, stdout=subprocess.PIPE, universal_newlines=True) for v4 in iter(v3.stdout.readline, ''): v2(v4) v3.stdout.close() v5 = v3.wait() if v5: raise subprocess.CalledProcessError(v5, v1) return v5
[]
[ "subprocess" ]
[ "import subprocess" ]
9
__all__ = ["app"] import os import subprocess from typing import Callable from threading import Thread from functools import partial import typer from loguru import logger app = typer.Typer() def do_nothing(text: str): pass def remove_last_newline(text: str) -> str: return text[:-1] if text.endswith("\n...
null
v0
[ "str" ]
Any
def v0(v1: str): with open(v1) as v2: for v3 in v2: v3 = v3.strip() if not v3 or v3.startswith('#'): continue (v4, v5) = v3.split('=', 1) v4 = v4.strip() v5 = v5.strip() os.environ[v4] = v5
[]
[ "os" ]
[ "import os" ]
10
__all__ = ["app"] import os import subprocess from typing import Callable from threading import Thread from functools import partial import typer from loguru import logger app = typer.Typer() def do_nothing(text: str): pass def remove_last_newline(text: str) -> str: return text[:-1] if text.endswith("\n...
null
v1
[ "v0" ]
None
def v1(self, v2: v0) -> None: super().on_player_leave(v2) if self._get_chosen_one_player() is v2: self._set_chosen_one_player(None)
[]
[]
[]
4
# Released under the MIT License. See LICENSE for details. # """Provides the chosen-one mini-game.""" # ba_meta require api 6 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations from typing import TYPE_CHECKING import ba from bastd.actor.flag import Flag from bastd.actor.playerspa...
[ "class v0(ba.Player['Team']):\n\n def __init__(self) -> None:\n self.chosen_light: Optional[ba.NodeActor] = None" ]
v0
[]
None
def v0(self) -> None: for v1 in self.teams: self._scoreboard.set_team_value(v1, v1.time_remaining, self._chosen_one_time, countdown=True)
[]
[]
[]
3
# Released under the MIT License. See LICENSE for details. # """Provides the chosen-one mini-game.""" # ba_meta require api 6 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations from typing import TYPE_CHECKING import ba from bastd.actor.flag import Flag from bastd.actor.playerspa...
null
v9
[ "torch.Tensor", "int", "float", "float" ]
torch.Tensor
def v9(v10: torch.Tensor, v11: int=1, v12: float=0.1, v13: float=0.5) -> torch.Tensor: (v14, v15, v16, v17) = v10.size() v18 = torch.ones(v14, 1, v16, v17) for v19 in range(v14): v18[v19] = v0((v16, v17), v11, v12, v13) v18 = v18.to(v10) return v18
[ { "name": "v0", "input_types": [ "tuple[int]", "int", "float", "float" ], "output_type": "torch.Tensor", "code": "def v0(v1: tuple[int], v2: int=1, v3: float=0.1, v4: float=0.5) -> torch.Tensor:\n v5 = torch.ones(1, 1, *v1)\n v6 = -int(min(*v1) * v3)\n for v7 in ...
[ "torch" ]
[ "import torch" ]
7
from __future__ import annotations from typing import Callable import cv2 import numpy as np import torch import torchvision.transforms.functional as TF from PIL import Image from torchvision.io.image import ImageReadMode, read_image from torchvision.utils import save_image from storch.imageops.utils import random_...
null
v0
[ "torch.Tensor", "torch.Tensor", "Callable | torch.Tensor" ]
torch.Tensor
def v0(v1: torch.Tensor, v2: torch.Tensor, v3: Callable | torch.Tensor=torch.zeros) -> torch.Tensor: if isinstance(v3, Callable): v3 = v3(v1.size(), device=v1.device) v4 = v1 * v2 + v3 * (1 - v2) return v4
[]
[ "typing" ]
[ "from typing import Callable" ]
5
from __future__ import annotations from typing import Callable import cv2 import numpy as np import torch import torchvision.transforms.functional as TF from PIL import Image from torchvision.io.image import ImageReadMode, read_image from torchvision.utils import save_image from storch.imageops.utils import random_...
null
v0
[ "List[str]" ]
None
def v0(self, v1: List[str]) -> None: if not v1: return v2 = [tuple(v1)] v3 = 'delete from models where fqid in %s' self.connection.execute(v3, v2)
[]
[]
[]
6
from collections import defaultdict from textwrap import dedent from typing import Any, ContextManager, Dict, List, Optional from datastore.shared.di import service_as_singleton from datastore.shared.postgresql_backend.sql_query_helper import SqlQueryHelper from datastore.shared.services.read_database import ( Bas...
null
v0
[ "List[str]", "Optional[int]" ]
Dict[str, bool]
def v0(self, v1: List[str], v2: Optional[int]=None) -> Dict[str, bool]: if not v2: return self.get_deleted_status_from_read_db(v1) else: return self.get_deleted_status_from_events(v1, v2)
[]
[]
[]
5
from collections import defaultdict from textwrap import dedent from typing import Any, ContextManager, Dict, List, Optional from datastore.shared.di import service_as_singleton from datastore.shared.postgresql_backend.sql_query_helper import SqlQueryHelper from datastore.shared.services.read_database import ( Bas...
null
v0
[ "List[str]" ]
Dict[str, bool]
def v0(self, v1: List[str]) -> Dict[str, bool]: v2 = 'select fqid, deleted from models_lookup where fqid in %s' v3 = self.connection.query(v2, [tuple(v1)]) return {row['fqid']: row['deleted'] for v4 in v3}
[]
[]
[]
4
from collections import defaultdict from textwrap import dedent from typing import Any, ContextManager, Dict, List, Optional from datastore.shared.di import service_as_singleton from datastore.shared.postgresql_backend.sql_query_helper import SqlQueryHelper from datastore.shared.services.read_database import ( Bas...
null
v0
[ "str" ]
None
def v0(self, v1: str=None) -> None: if v1 is None: v1 = self.name with tf.compat.v1.keras.backend.name_scope(None), tf.compat.v1.device(None), tf.control_dependencies(None): for (v2, v3) in self.trainables.items(): if '/' in v2: v4 = v2.split('/') v5 =...
[]
[ "tensorflow" ]
[ "import tensorflow as tf" ]
11
import types import inspect import re import uuid import sys import numpy as np import tensorflow as tf tf.compat.v1.disable_v2_behavior() from collections import OrderedDict from typing import Any, List, Tuple, Union from . import tfutil from .. import util from .tfutil import TfExpression, TfExpressionEx _import_h...
null
v8
[ "Dict[str, Dict[str, Any]]", "Dict[str, Dict[str, Any]]", "Dict[str, Dict[str, List[Any]]]", "int" ]
List[Dict[str, Any]]
def v8(v9: Dict[str, Dict[str, Any]], v10: Dict[str, Dict[str, Any]], v11: Dict[str, Dict[str, List[Any]]], v12: int) -> List[Dict[str, Any]]: v13 = [] for (v14, v15) in v11.items(): v16 = v10.get(v14, {}) for (v17, v18) in v15.items(): v19 = v16.get(v17, {}) v20 = v19.ge...
[ { "name": "v0", "input_types": [ "Dict[str, Dict[str, Any]]", "str", "int" ], "output_type": "bool", "code": "def v0(v1: Dict[str, Dict[str, Any]], v2: str, v3: int) -> bool:\n if v2 == 'ROOT_ID':\n return True\n v4 = v1[v2]\n v5 = v4.get('type')\n if v5 == '...
[]
[]
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
v39
[ "Any", "int" ]
None
def v39(v40: Any, v41: int) -> None: (v42, v43) = v5(v41, use_slice_data=True) if v43: v44 = v31(datasource_type=v43.datasource.type, datasource_id=v43.datasource.id, form_data=v42, force=False) v44.raise_for_access()
[ { "name": "v0", "input_types": [ "Optional[int]", "Optional[str]", "FormData" ], "output_type": "Tuple[int, Optional[str]]", "code": "def v0(v1: Optional[int], v2: Optional[str], v3: FormData) -> Tuple[int, Optional[str]]:\n v4 = v3.get('datasource', '')\n if '__' in v4:\...
[ "datetime", "urllib" ]
[ "from datetime import date", "from urllib import parse" ]
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
v0
[ "List[str]" ]
List[datetime.time]
def v0(v1: List[str]) -> List[datetime.time]: v2 = v1[0] v3 = '%H:%M' if v2.count(':') == 2: v3 += ':%S' if '.' in v2: v3 += '.%f' return [datetime.datetime.strptime(v2, v3).time()]
[]
[ "datetime" ]
[ "import datetime" ]
8
# -*- coding: utf-8 -*- # Zinc grammar specification. # See the accompanying LICENSE file. # (C) 2016 VRT Systems # (C) 2021 Engie Digital # # vim: set ts=4 sts=4 et tw=78 sw=4 si: """ Parse Zinc file conform with the specification describe here (https://www.project-haystack.org/doc/Zinc) and produce a `Grid` instance...
null
v0
[ "Any", "Any" ]
torch.Tensor
def v0(self, v1, v2) -> torch.Tensor: v3 = self.to_spec(v1) v4 = self.spec2spec(v3, v2) if self.masking_based: v4 = v3 * v4 return v4
[]
[]
[]
6
from argparse import ArgumentParser from typing import Tuple from warnings import warn import torch import torch.nn as nn from torch import Tensor from lasaft.data.musdb_wrapper import SingleTrackSet from lasaft.source_separation.conditioned.separation_framework import Spectrogram_based from lasaft.utils.functions im...
null
v0
[ "Any" ]
torch.Tensor
def v0(self, v1) -> torch.Tensor: if self.magnitude_based: return self.stft.to_mag(v1).transpose(-1, -3) else: v2 = self.stft.to_spec_complex(v1) v2 = torch.flatten(v2, start_dim=-2) return v2.transpose(-1, -3)
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "from torch import Tensor" ]
7
from argparse import ArgumentParser from typing import Tuple from warnings import warn import torch import torch.nn as nn from torch import Tensor from lasaft.data.musdb_wrapper import SingleTrackSet from lasaft.source_separation.conditioned.separation_framework import Spectrogram_based from lasaft.utils.functions im...
null
v0
[ "Any", "Any" ]
Tuple[Tensor, Tensor]
def v0(self, v1, v2) -> Tuple[Tensor, Tensor]: v3 = None if self.magnitude_based: (v4, v3) = self.stft.to_mag_phase(v1) v5 = v4.transpose(-1, -3) else: v6 = self.stft.to_spec_complex(v1) v6 = torch.flatten(v6, start_dim=-2) v5 = v6.transpose(-1, -3) v7 = self.spec...
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "from torch import Tensor" ]
22
from argparse import ArgumentParser from typing import Tuple from warnings import warn import torch import torch.nn as nn from torch import Tensor from lasaft.data.musdb_wrapper import SingleTrackSet from lasaft.source_separation.conditioned.separation_framework import Spectrogram_based from lasaft.utils.functions im...
null
v0
[ "str", "bool" ]
None
def v0(self, v1: str, v2: bool) -> None: v3 = getattr(self, v1) if v2: self.unequip_message(v3.name) setattr(self, v1, None)
[]
[]
[]
5
from __future__ import annotations from typing import TYPE_CHECKING, Optional from components.base_component import BaseComponent from equipment_types import EquipmentType if TYPE_CHECKING: from entity import Actor, Item class Equipment(BaseComponent): parent: Actor def __init__(self, weapon: Optional...
null
v0
[ "float", "float", "dict" ]
float
def v0(self, v1: float, v2: float=None, v3: dict={}) -> float: v4: float = self.pool_volume / self.pump_flow if v1 > 25: self._computed_filtering_duration = 3 * v4 elif v1 > 20: self._computed_filtering_duration = 2 * v4 elif v1 > 15: self._computed_filtering_duration = 1 * v4 ...
[]
[]
[]
16
# coding: utf-8 """pypool_pump package allows to compute the duration of the swiming pool filtering. """ from .__version__ import VERSION, __version__ from .run import Run from datetime import timedelta, datetime from typing import List class FilteringDuration(object): """Root class with common parts""" def...
null
v0
[]
None
async def v0(self) -> None: if not self.enabled: return v1 = [coordinator.async_request_refresh() for v2 in self.coordinators.values()] await asyncio.gather(*v1)
[]
[ "asyncio" ]
[ "import asyncio" ]
5
"""The Elexa Guardian integration.""" from __future__ import annotations import asyncio from collections.abc import Awaitable, Callable from typing import cast from aioguardian import Client from aioguardian.errors import GuardianError import voluptuous as vol from homeassistant.config_entries import ConfigEntry, Co...
null
v0
[ "str", "str" ]
Any
def v0(v1: str, v2: str): if v1 == 'MEDIUM' and v2 == 'SMALL': return False if v1 == 'LARGE' and v2 in ['SMALL', 'MEDIUM']: return False return True
[]
[]
[]
6
import requests from .models import Plane, Airport from math import sqrt, degrees, atan2 from datetime import timedelta def send_warning(data): print(data) requests.post(url='https://evently.bjucps.dev/app/error_report', json=data) def check_time_delta(first, second, max): if first is None...
null
v5
[ "tp.List[tp.List[int]]", "tp.Optional[tp.Iterable[int]]" ]
None
def v5(v6: tp.List[tp.List[int]], v7: tp.Optional[tp.Iterable[int]]=None) -> None: v8 = len(v6) v9 = np.zeros((v8,), dtype=bool) v10 = np.zeros((v8,), dtype=bool) v11 = sum((len(l) for v12 in v6)) v13 = tqdm.tqdm(total=v11) if v7 is None: v7 = range(len(v6)) def v14(v15: int): ...
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "def v0(v1: int):\n if visited[v1]:\n return\n assert not on_path[v1]\n visited[v1] = True\n on_path[v1] = True\n v2 = lil[v1]\n for v3 in range(len(v2) - 1, -1, -1):\n prog.update()\n ...
[ "numpy", "tqdm" ]
[ "import numpy as np", "import tqdm" ]
26
import typing as tp import numpy as np import tqdm def remove_back_edges( lil: tp.List[tp.List[int]], start: tp.Optional[tp.Iterable[int]] = None ) -> None: nn = len(lil) visited = np.zeros((nn,), dtype=bool) on_path = np.zeros((nn,), dtype=bool) num_edges = sum(len(l) for l in lil) prog = tq...
null
v0
[ "Optional[str]", "List", "Dict[str, Any]" ]
Any
def v0(self, v1: Optional[str]=None, v2: List=[], v3: Dict[str, Any]=None): if v1 is not None: self.scenario = v1 self.post('/sim/load', json={'scenario': self.scenario, 'modifiers': v2, 'edits': v3}) self.sim_started = True self.start_time_s = self.curr_time_s()
[]
[]
[]
6
import requests from typing import Any, Dict, List, Optional import pandas as pd class Simulation: __SECONDS_IN_A_DAY: int = 60 * 60 * 24 def __init__( self, api: str, scenario: Optional[str] = None, country_code: Optional[str] = None, city_name: Optional[str] = None...
null
v0
[ "int" ]
Any
def v0(self, v1: int): if not self.sim_started: self.reset() v2 = self.curr_time_s() v3 = v1 + v2 (v4, v5, v6) = (v3 // 3600, v3 // 60 % 60, v3 % 60) self.get('/sim/goto-time', params={'t': f'{v4}:{v5}:{v6}'})
[]
[]
[]
7
import requests from typing import Any, Dict, List, Optional import pandas as pd class Simulation: __SECONDS_IN_A_DAY: int = 60 * 60 * 24 def __init__( self, api: str, scenario: Optional[str] = None, country_code: Optional[str] = None, city_name: Optional[str] = None...
null
v0
[]
int
def v0(self) -> int: (v1, v2, v3) = self.get('/sim/get-time').content.decode().split('.')[0].split(':') return int(v1) * 3600 + int(v2) * 60 + int(v3)
[]
[]
[]
3
import requests from typing import Any, Dict, List, Optional import pandas as pd class Simulation: __SECONDS_IN_A_DAY: int = 60 * 60 * 24 def __init__( self, api: str, scenario: Optional[str] = None, country_code: Optional[str] = None, city_name: Optional[str] = None...
null
v0
[]
pd.DataFrame
def v0(self) -> pd.DataFrame: v1 = self.get('/data/get-agent-positions').json()['agents'] if not v1: return pd.DataFrame() for (v2, v3) in enumerate(v1): v4 = v3['id'] v5 = next(iter(v4.keys())) v6 = v4[v5] v3['mode'] = v5 v3['id'] = v6[0] if isinstance(v6, li...
[]
[ "pandas" ]
[ "import pandas as pd" ]
14
import requests from typing import Any, Dict, List, Optional import pandas as pd class Simulation: __SECONDS_IN_A_DAY: int = 60 * 60 * 24 def __init__( self, api: str, scenario: Optional[str] = None, country_code: Optional[str] = None, city_name: Optional[str] = None...
null
v0
[]
pd.DataFrame
def v0(self) -> pd.DataFrame: v1 = self.get('/data/all-trip-time-lower-bounds').json() return pd.DataFrame(list(v1.values()), index=list(v1.keys()), columns=[''])
[]
[ "pandas" ]
[ "import pandas as pd" ]
3
import requests from typing import Any, Dict, List, Optional import pandas as pd class Simulation: __SECONDS_IN_A_DAY: int = 60 * 60 * 24 def __init__( self, api: str, scenario: Optional[str] = None, country_code: Optional[str] = None, city_name: Optional[str] = None...
null
v0
[ "Any" ]
int
def v0(self, v1) -> int: v2 = self.get('/data/trip-time-lower-bound', id=v1) return int(v2.content.decode())
[]
[]
[]
3
import requests from typing import Any, Dict, List, Optional import pandas as pd class Simulation: __SECONDS_IN_A_DAY: int = 60 * 60 * 24 def __init__( self, api: str, scenario: Optional[str] = None, country_code: Optional[str] = None, city_name: Optional[str] = None...
null