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
v2
[ "Iterable[str]", "int", "str" ]
List[str]
def v2(self, v3: Iterable[str], v4: int, v5: str='right') -> List[str]: def v6(v7): return v4 - self.len(v7) + len(v7) if v5 == 'left': return [x.ljust(v6(x)) for v8 in v3] elif v5 == 'center': return [v8.center(v6(v8)) for v8 in v3] else: return [v8.rjust(v6(v8)) for v8...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n return max_len - self.len(v1) + len(v1)", "dependencies": [] } ]
[]
[]
10
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v0
[ "Union[str, int]" ]
Optional[Callable]
def v0(self, v1: Union[str, int]) -> Optional[Callable]: if isinstance(self.formatters, (list, tuple)): if is_integer(v1): v1 = cast(int, v1) return self.formatters[v1] else: return None else: if is_integer(v1) and v1 not in self.columns: v...
[]
[ "pandas", "typing" ]
[ "from typing import IO, TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, Union, cast", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_...
11
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v26
[]
List[str]
def v26(self) -> List[str]: v27 = self._format_strings() return v13(v27, self.justify)
[ { "name": "v11", "input_types": [], "output_type": "v0", "code": "def v11() -> v0:\n v12 = get_option('display.unicode.east_asian_width')\n if v12:\n return EastAsianTextAdjustment()\n else:\n return v0()", "dependencies": [] }, { "name": "v13", "input_types": ...
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
3
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
[ "class v0:\n\n def __init__(self):\n self.encoding = get_option('display.encoding')\n\n def v1(self, v2: str) -> int:\n return v1(v2)\n\n def v3(self, v4: Any, v5: int, v6: str='right') -> List[str]:\n return v3(v4, v5, mode=v6)\n\n def v7(self, v8: int, *v9, **v10) -> str:\n ...
v26
[]
List[List[str]]
def v26(self) -> List[List[str]]: v27 = {k: cast(int, v) for (v28, v29) in self.col_space.items()} v30 = self.tr_frame v31 = self._get_formatted_index(v30) if not is_list_like(self.header) and (not self.header): v32 = [] for (v33, v34) in enumerate(v30): v35 = self._format_co...
[ { "name": "v11", "input_types": [], "output_type": "v0", "code": "def v11() -> v0:\n v12 = get_option('display.unicode.east_asian_width')\n if v12:\n return EastAsianTextAdjustment()\n else:\n return v0()", "dependencies": [] }, { "name": "v13", "input_types": ...
[ "pandas", "typing" ]
[ "from typing import IO, TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, Union, cast", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_...
61
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
[ "class v0:\n\n def __init__(self):\n self.encoding = get_option('display.encoding')\n\n def v1(self, v2: str) -> int:\n return v1(v2)\n\n def v3(self, v4: Any, v5: int, v6: str='right') -> List[str]:\n return v3(v4, v5, mode=v6)\n\n def v7(self, v8: int, *v9, **v10) -> str:\n ...
v11
[ "Iterable[list[str]]" ]
str
def v11(self, v12: Iterable[list[str]]) -> str: v13 = self.line_width v14 = 1 v15 = list(v12) if self.fmt.index: v16 = v15.pop(0) v13 -= np.array([self.adj.len(x) for v17 in v16]).max() + v14 v18 = [np.array([self.adj.len(v17) for v17 in col]).max() if len(col) > 0 else 0 for v19 in ...
[ { "name": "v0", "input_types": [ "list[int]", "int" ], "output_type": "list[int]", "code": "def v0(v1: list[int], v2: int) -> list[int]:\n v3 = 1\n v4 = []\n v5 = 0\n v6 = len(v1) - 1\n for (v7, v8) in enumerate(v1):\n v9 = v8 + v3\n v5 += v9\n if ...
[ "numpy" ]
[ "import numpy as np" ]
30
""" Module for formatting output data in console (to string). """ from __future__ import annotations from shutil import get_terminal_size from typing import Iterable import numpy as np from pandas.io.formats.format import DataFrameFormatter from pandas.io.formats.printing import pprint_thing class St...
null
v14
[ "int" ]
List[str]
def v14(self, v15: int) -> List[str]: v16 = self.tr_frame v17 = self._get_formatter(v15) return v1(v16.iloc[:, v15]._values, v17, float_format=self.float_format, na_rep=self.na_rep, space=self.col_space.get(v16.columns[v15]), decimal=self.decimal, leading_space=self.index)
[ { "name": "v1", "input_types": [ "Any", "Optional[Callable]", "Optional[v0]", "str", "Optional[int]", "Optional[Union[str, int]]", "str", "str", "Optional[bool]", "Optional[int]" ], "output_type": "List[str]", "code": "def v1(v2: Any, v...
[ "decimal", "pandas" ]
[ "import decimal", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.n...
4
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
[ "v0 = Union[str, Callable, 'EngFormatter']" ]
v0
[]
List[str]
def v0(self) -> List[str]: v1: List[str] = [] v2 = self.frame.columns if isinstance(v2, ABCMultiIndex): v1.extend(('' if name is None else name for v3 in v2.names)) else: v1.append('' if v2.name is None else v2.name) return v1
[]
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
8
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from datetime import tzinfo import decimal from functools import partial from io import StringIO import math import re from shutil import get_terminal_...
null
v15
[]
List[str]
def v15(self) -> List[str]: v16 = self.formatter or v3(self.values, nat_rep=self.nat_rep, box=self.box) return [v16(x) for v17 in self.values]
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n if v1 is None or (is_scalar(v1) and isna(v1)):\n return nat_rep\n if not isinstance(v1, Timedelta):\n v1 = Timedelta(v1)\n v2 = v1._repr_base(format=format)\n if box:\n v...
[ "numpy", "pandas" ]
[ "import numpy as np", "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tsli...
3
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
null
v7
[ "Optional[v0]", "Optional[Union[float, int]]" ]
Callable
def v7(self, v8: Optional[v0]=None, v9: Optional[Union[float, int]]=None) -> Callable: if v8 is None: v8 = self.float_format if v8: def v10(v11): assert v8 is not None return v8(value=v11) if notna(v11) else self.na_rep else: def v12(v13): return...
[ { "name": "v1", "input_types": [ "Any" ], "output_type": "Any", "code": "def v1(v2):\n return str(v2) if notna(v2) else self.na_rep", "dependencies": [] }, { "name": "v3", "input_types": [ "Any" ], "output_type": "Any", "code": "def v3(v4):\n return ...
[ "pandas" ]
[ "from pandas._config.config import get_option, set_option", "from pandas._libs import lib", "from pandas._libs.missing import NA", "from pandas._libs.tslib import format_array_from_datetime", "from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT", "from pandas._libs.tslibs.nattype import NaTTyp...
30
""" Internal module for formatting output data in csv, html, and latex files. This module also applies to display formatting. """ from contextlib import contextmanager from csv import QUOTE_NONE, QUOTE_NONNUMERIC from datetime import tzinfo import decimal from functools import partial from io import StringIO import ma...
[ "v0 = Union[str, Callable, 'EngFormatter']" ]
v0
[]
int
def v0(self) -> int: v1 = self.__fetch(start=1, limit=1) return v1.found
[]
[]
[]
3
from typing import Optional, Generator, List from lakey_finicity.api_http_client import ApiHttpClient from lakey_finicity.models import Institution from lakey_finicity.responses import InstitutionsListResponse DEFAULT_BATCH_SIZE = 25 class InstitutionsQuery(object): def __init__(self, http_client: ApiHttpClien...
null
v0
[]
None
def v0(self) -> None: self.REVIEWED = True v1 = '{} in {}'.format(self.PROJECT, self.LANGUAGE) v2 = 'Resource {} fully reviewed.'.format(self.RESOURCE) self.url = self.build_webhook_url(self.URL_REVIEWED_METHOD_TEMPLATE, project=self.PROJECT, language=self.LANGUAGE, resource=self.RESOURCE) self.send...
[]
[]
[]
6
# -*- coding: utf-8 -*- from typing import Any, Dict from zerver.lib.test_classes import WebhookTestCase class TransifexHookTests(WebhookTestCase): STREAM_NAME = 'transifex' URL_TEMPLATE = u"/api/v1/external/transifex?stream={stream}&api_key={api_key}" URL_REVIEWED_METHOD_TEMPLATE = "reviewed=100" URL...
null
v0
[]
None
def v0(self) -> None: self.REVIEWED = False v1 = '{} in {}'.format(self.PROJECT, self.LANGUAGE) v2 = 'Resource {} fully translated.'.format(self.RESOURCE) self.url = self.build_webhook_url(self.URL_TRANSLATED_METHOD_TEMPLATE, project=self.PROJECT, language=self.LANGUAGE, resource=self.RESOURCE) self...
[]
[]
[]
6
# -*- coding: utf-8 -*- from typing import Any, Dict from zerver.lib.test_classes import WebhookTestCase class TransifexHookTests(WebhookTestCase): STREAM_NAME = 'transifex' URL_TEMPLATE = u"/api/v1/external/transifex?stream={stream}&api_key={api_key}" URL_REVIEWED_METHOD_TEMPLATE = "reviewed=100" URL...
null
v0
[]
Dict[Callable, Tuple[float, Optional[datetime.datetime]]]
def v0(self) -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]]: v1 = super().get_periodic_tasks() v1.update(self._get_behaviours_tasks()) return v1
[]
[]
[]
4
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
null
v0
[]
Dict[Callable, Tuple[float, Optional[datetime.datetime]]]
def v0(self) -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]]: v1 = {} for v2 in self.active_behaviours: v1[v2.act_wrapper] = (v2.tick_interval, v2.start_at) return v1
[]
[]
[]
5
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
null
v0
[ "Exception", "Callable", "bool" ]
None
def v0(v1: Exception, v2: Callable, v3: bool=False) -> None: if v3: self.logger.debug(f'<{v1}> raised during `{v2}`') else: self.logger.exception(f'<{v1}> raised during `{v2}`')
[]
[]
[]
5
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '金融服務' v1['id'] = 'finance' v2 = {} v2['banks'] = '銀行' v2['credit-unions'] = '信用合作社' v2['financial-service'] = '金融服務' v1['sub'] = v2 return v1
[]
[]
[]
10
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '投資理財' v1['id'] = 'investment' v2 = {} v2['invest-service'] = '投資服務' v2['trust-service'] = '信託服務' v2['insurance'] = '保險' v2['bills-finance'] = '票券金融' v1['sub'] = v2 return v1
[]
[]
[]
11
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '不動產投資管理' v1['id'] = 'real-estate' v2 = {} v2['agents'] = '房地產仲介' v2['escrow-service'] = '代書、地政士' v1['sub'] = v2 return v1
[]
[]
[]
9
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '貿易工商服務' v1['id'] = 'trade-service' v2 = {} v2['business-service'] = '工商服務' v2['telemarketing'] = '市調、電話行銷' v2['property-management'] = '建築經理' v2['rental-service'] = '租賃' v2['product-design'] = '產品設計' v2['trading'] = '貿易...
[]
[]
[]
14
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '顧問諮詢' v1['id'] = 'consultant' v2 = {} v2['PR'] = '公關顧問' v2['engineer'] = '技師、工程師' v2['construction'] = '土木工程顧問' v2['industrial-safety'] = '工業技師、工安技師' v2['electrical'] = '電機' v2['invest-financial'] = '投資財務顧問' v2['env...
[]
[]
[]
15
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '律師' v1['id'] = 'lawyer' v2 = {} v2['lawyers'] = '律師' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '會計師' v1['id'] = 'accountant' v2 = {} v2['accountants'] = '會計師' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '稅務帳務代理' v1['id'] = 'booking-service' v2 = {} v2['receivable-management'] = '應收帳款管理' v2['bookkeepers'] = '記帳士' v1['sub'] = v2 return v1
[]
[]
[]
9
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '專利商標代理' v1['id'] = 'patent-and-trademark' v2 = {} v2['intellectual-property'] = '專利、智財' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '人力仲介' v1['id'] = 'recruitment-agency' v2 = {} v2['employment-service'] = '人力仲介' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '翻譯移民服務' v1['id'] = 'immigrationservices' v2 = {} v2['migration-service'] = '移民服務' v2['translation-service'] = '翻譯服務' v1['sub'] = v2 return v1
[]
[]
[]
9
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '徵信社' v1['id'] = 'credit-information' v2 = {} v2['credit-report'] = '徵信社' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '醫療矯正訓練' v1['id'] = 'medical-remedial-training' v2 = {} v2['medical-remedial-training'] = '醫療矯正訓練' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 衛生機關及單位 health-agencies class HealthAgencies(object): def health_agencies() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '衛生機關及單位' list['id'] = 'health-agencies' health_agencies = {} health_agencies['health-a...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '會議商展' v1['id'] = 'conference-expo' v2 = {} v2['exhibition-service'] = '展覽服務' v2['conference-centers'] = '會議中心' v1['sub'] = v2 return v1
[]
[]
[]
9
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = 'SOHO族工作室' v1['id'] = 'soho-studio' v2 = {} v2['studio'] = '個人工作室' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '公證' v1['id'] = 'notary' v2 = {} v2['notary-service'] = '公證服務' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 金融服務 finance class Finance(object): def finance() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '金融服務' list['id'] = 'finance' finance = {} finance['banks'] = '銀行' finance['credit-unions'] = '信用合作社' ...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '印刷機械' v1['id'] = 'printing-machinery' v2 = {} v2['printing-machinery'] = '印刷機械' v2['hot-stamping-machinery'] = '燙金機械' v1['sub'] = v2 return v1
[]
[]
[]
9
from typing import Dict from ..base_category import BaseCategory # 自動化設備 automation class Automation(object): def automation() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '自動化設備' list['id'] = 'automation' automation = {} automation['automation-machinery'] = '自動化機械' au...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '殯儀服務' v1['id'] = 'funeral-services' v2 = {} v2['funeral-service'] = '殯葬服務' v1['sub'] = v2 return v1
[]
[]
[]
8
from typing import Dict from ..base_category import BaseCategory # 殯儀服務 funeral-services class FuneralServices(object): def funeral_services() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '殯儀服務' list['id'] = 'funeral-services' funeral_services = {} funeral_services['funeral-...
null
v0
[]
Dict[str, Dict[str, str]]
def v0() -> Dict[str, Dict[str, str]]: v1 = {} v1['name'] = '調味品' v1['id'] = 'flavoring-extracts' v2 = {} v2['seasoning'] = '調味料' v2['soy-sauce-oyster-sauce'] = '醬油蠔油' v1['sub'] = v2 return v1
[]
[]
[]
9
from typing import Dict from ..base_category import BaseCategory class NativeGoods(object): def native_goods() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '土產品' list['id'] = 'native-goods' native_goods = {} native_goods['famous'] = '名特產' native_goods['local-special'] ...
null
v0
[ "Any" ]
List[int]
def v0(v1) -> List[int]: v2 = [] v3 = 0 for v4 in v1: v2.append(v3) v3 += v4 v5 = min(v2) v2 = [_ - v5 for v6 in v2] return v2
[]
[]
[]
9
import dataclasses from typing import List, Optional, Tuple from blspy import G2Element, AugSchemeMPL from src.types.blockchain_format.coin import Coin from src.types.condition_opcodes import ConditionOpcode from src.types.blockchain_format.program import Program from src.types.blockchain_format.sized_bytes import b...
null
v0
[]
DataLoader
def v0(self) -> DataLoader: if self.train_dataset is None: raise ValueError('Trainer: training requires a train_dataset.') v1 = self._get_train_sampler() if self.augment_data_collator is not None: return DataLoader(self.train_dataset, batch_size=self.args.train_batch_size, sampler=v1, collat...
[]
[ "torch" ]
[ "import torch", "from torch import nn", "from torch.utils.data.dataloader import DataLoader", "from torch.utils.data.dataset import Dataset", "from torch.utils.data.distributed import DistributedSampler", "from torch.utils.data.sampler import RandomSampler, SequentialSampler" ]
8
# coding=utf-8 # Copyright 2020-present 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 ap...
null
v0
[ "int" ]
Any
def v0(self, v1: int): self.create_optimizer() self.create_scheduler(v1)
[]
[]
[]
3
# coding=utf-8 # Copyright 2020-present 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 ap...
null
v0
[ "Dict[str, float]", "Any" ]
None
def v0(self, v1: Dict[str, float], v2=True) -> None: if self.state.epoch is not None: v1['epoch'] = round(self.state.epoch, 2) v3 = {**v1, **{'step': self.state.global_step}} self.state.log_history.append(v3) v1['use_global_step'] = v2 self.control = self.callback_handler.on_log(self.args, s...
[]
[]
[]
7
import collections import gc import inspect import math from multiprocessing.spawn import import_main_path import os import re import shutil import sys import time import warnings from logging import StreamHandler from pathlib import Path from typing import ( TYPE_CHECKING, Any, Callable, Counter, D...
null
v0
[ "Dict[str, Union[torch.Tensor, Any]]" ]
Dict[str, Union[torch.Tensor, Any]]
def v0(self, v1: Dict[str, Union[torch.Tensor, Any]]) -> Dict[str, Union[torch.Tensor, Any]]: for (v2, v3) in v1.items(): if isinstance(v3, torch.Tensor): v1[v2] = v3.to(self.args.device) if self.args.past_index >= 0 and self._past is not None: v1['mems'] = self._past if self.ada...
[]
[ "torch" ]
[ "import torch", "from torch import nn", "from torch.utils.data.dataloader import DataLoader", "from torch.utils.data.dataset import Dataset", "from torch.utils.data.distributed import DistributedSampler", "from torch.utils.data.sampler import RandomSampler, SequentialSampler" ]
9
# coding=utf-8 # Copyright 2020-present 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 ap...
null
v0
[ "Any", "Any", "Any" ]
List[str]
def v0(self, v1=None, v2=PREFIX_CHECKPOINT_DIR, v3=False) -> List[str]: v4 = [] v5 = [str(x) for v6 in Path(v1).glob(f'{v2}-*') if os.path.isdir(v6)] for v7 in v5: if v3: v4.append((os.path.getmtime(v7), v7)) else: v8 = re.match(f'.*{v2}-([0-9]+)', v7) if ...
[]
[ "os", "pathlib", "re" ]
[ "import os", "import re", "from pathlib import Path" ]
17
# coding=utf-8 # Copyright 2020-present 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 ap...
null
v0
[ "Dict[str, Union[torch.Tensor, Any]]" ]
Any
def v0(self, v1: Dict[str, Union[torch.Tensor, Any]]): if hasattr(self.original_model, 'floating_point_ops'): return self.original_model.floating_point_ops(v1) else: return 0
[]
[]
[]
5
# copyright 2021 the huggingface team. all rights reserved. # # licensed under the apache license, version 2.0 (the "license"); # you may not use this file except in compliance with the license. # you may obtain a copy of the license at # # http://www.apache.org/licenses/license-2.0 # # unless required by app...
null
v0
[]
list
def v0(self) -> list: v1 = self.ball.getField('translation') v2 = v1.getSFVec3f() if abs(v2[0]) < 4.5 and abs(v2[1]) < 3: if self.previousBallLocation[0] + 0.05 < v2[0] or self.previousBallLocation[0] - 0.05 > v2[0] or self.previousBallLocation[1] + 0.05 < v2[1] or (self.previousBallLocation[1] - 0....
[]
[]
[]
8
""" The Basic Supervisor class. All Supervisor classes should be derived from this class. """ import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) from controller import Supervisor import struct from Utils.Consts import (TIME_STEP) ...
null
v0
[ "Any" ]
None
def v0(self, v1) -> None: self.previousBallLocation = v1 v2 = self.ball.getField('translation') v2.setSFVec3f(v1) self.ball.resetPhysics()
[]
[]
[]
5
""" The Basic Supervisor class. All Supervisor classes should be derived from this class. """ import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) from controller import Supervisor import struct from Utils.Consts import (TIME_STEP) ...
null
v0
[ "Any" ]
list
def v0(self, v1) -> list: v2 = self.robots[v1].getField('translation') return v2.getSFVec3f()
[]
[]
[]
3
""" The Basic Supervisor class. All Supervisor classes should be derived from this class. """ import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) from controller import Supervisor import struct from Utils.Consts import (TIME_STEP) ...
null
v0
[ "base.String", "typing.Optional[typing.Union[base.InputFile, pathlib.Path]]", "base.Integer", "base.Integer", "base.Boolean", "typing.Optional[typing.Union[str, pathlib.Path]]", "typing.Optional[base.Boolean]" ]
Any
async def v0(self, v1: base.String, v2: typing.Optional[typing.Union[base.InputFile, pathlib.Path]]=None, v3: base.Integer=30, v4: base.Integer=65536, v5: base.Boolean=True, v6: typing.Optional[typing.Union[str, pathlib.Path]]=None, v7: typing.Optional[base.Boolean]=True): v8 = await self.get_file(v1) return aw...
[]
[]
[]
3
from __future__ import annotations import datetime import pathlib import typing import warnings from .base import BaseBot, api from .. import types from ..types import base from ..utils.deprecated import deprecated from ..utils.exceptions import ValidationError from ..utils.mixins import DataMixin, ContextInstanceMix...
null
v0
[ "Any", "bool" ]
Any
def v0(self, v1, v2: bool=False): if v1 is NaT: return self._assert_tzawareness_compat(v1) if v2: if not timezones.tz_compare(self.tz, v1.tz): raise ValueError(f"Timezones don't match. '{self.tz}' != '{v1.tz}'")
[]
[ "pandas" ]
[ "from pandas._libs import lib, tslib", "from pandas._libs.tslibs import BaseOffset, NaT, NaTType, Resolution, Timestamp, conversion, fields, get_resolution, iNaT, ints_to_pydatetime, is_date_array_normalized, normalize_i8_timestamps, timezones, to_offset, tzconversion", "from pandas.errors import PerformanceWar...
7
from datetime import datetime, time, timedelta, tzinfo from typing import Optional, Union, cast import warnings import numpy as np from pandas._libs import lib, tslib from pandas._libs.tslibs import ( BaseOffset, NaT, NaTType, Resolution, Timestamp, conversion, fields, get_resolution, ...
null
v0
[ "int", "str", "str", "str", "str", "str", "str", "str" ]
Any
def v0(self, v1: int=None, v2: str=None, v3: str=None, v4: str=None, v5: str=None, v6: str=None, v7: str=None, v8: str=None): if v2: self.name = v2 if v3: self.category = v3 if v4: self.type = v4 if v5: self.version = v5 if v6: self.ip = v6 if v7: ...
[]
[]
[]
15
""" Database model device. """ from src.models import db class Device(db.Model): """ Device class """ class Category(object): SIMULATOR = 'simulator' HARDWARE = 'hardware' class Status(object): INACTIVE = 'inactive' AVAILABLE = 'available' USED = 'used' ...
null
v0
[ "str", "int" ]
None
def v0(self, v1: str, v2: int=1) -> None: super().count(v1, count=v2) self.client.incr(v1, count=v2, rate=self.rate)
[]
[]
[]
3
"""Monitor using Statsd.""" import re import typing from typing import Any, Dict, Optional, Pattern, cast from mode.utils.objects import cached_property from faust.exceptions import ImproperlyConfigured from faust.types import ( AppT, CollectionT, EventT, Message, PendingMessage, RecordMetada...
null
v0
[ "bool", "callable", "callable", "config.Config", "str", "Optional[str]" ]
Tuple[tf.keras.models.Model, np.ndarray]
def v0(v1: bool, v2: callable, v3: callable, v4: config.Config, v5: str, v6: Optional[str]=None) -> Tuple[tf.keras.models.Model, np.ndarray]: v7 = (v4.parameters.ssd_image_size, v4.parameters.ssd_image_size, 3) v8 = [0.07, 0.15, 0.33, 0.51, 0.69, 0.87, 1.05] if v1: (v9, v10) = v2(image_size=v7, n_cl...
[]
[]
[]
15
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "callable", "int", "callable", "int", "tf.keras.models.Model", "str", "int", "int", "int", "Optional[tf.keras.callbacks.TensorBoard]" ]
tf.keras.callbacks.History
def v0(v1: callable, v2: int, v3: callable, v4: int, v5: tf.keras.models.Model, v6: str, v7: int, v8: int, v9: int, v10: Optional[tf.keras.callbacks.TensorBoard]) -> tf.keras.callbacks.History: v11 = os.path.join(v6, str(v7)) os.makedirs(v11, exist_ok=True) v12 = [tf.keras.callbacks.ModelCheckpoint(filepath...
[]
[ "os", "tensorflow" ]
[ "import os", "import tensorflow as tf" ]
10
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "str", "bool" ]
Tuple[str, str]
def v0(v1: str, v2: bool) -> Tuple[str, str]: v3 = 'ssd_predictions' v4 = 'ssd_labels' if v2: v3 = f'dropout-{v3}' v5 = os.path.join(v1, v3) v6 = os.path.join(v1, v4) return (v5, v6)
[]
[ "os" ]
[ "import os" ]
8
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "np.ndarray", "tf.keras.models.Model", "int", "int" ]
np.ndarray
def v0(v1: np.ndarray, v2: tf.keras.models.Model, v3: int, v4: int) -> np.ndarray: v5 = np.zeros((v3, 8732 * v4, 73)) for v6 in range(v4): v7 = v2.predict_on_batch(v1) for v8 in range(v3): v5[v8][v6 * 8732:v6 * 8732 + 8732] = v7[v8] return v5
[]
[ "numpy" ]
[ "import numpy as np" ]
7
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "Sequence[np.ndarray]", "float" ]
List[np.ndarray]
def v0(v1: Sequence[np.ndarray], v2: float) -> List[np.ndarray]: v3 = [] v4 = len(v1) v5 = np.dtype([('class_id', np.int32), ('confidence', 'f4'), ('xmin', 'f4'), ('ymin', 'f4'), ('xmax', 'f4'), ('ymax', 'f4')]) for v6 in range(v4): v7 = v1[v6] if not v7.size: v3.append(v7) ...
[]
[ "numpy" ]
[ "import numpy as np" ]
18
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "Union[np.ndarray, Sequence[np.ndarray]]", "np.ndarray", "Sequence[str]", "str", "str", "int", "int", "str", "Optional[bool]", "Optional[float]" ]
None
def v0(v1: Union[np.ndarray, Sequence[np.ndarray]], v2: np.ndarray, v3: Sequence[str], v4: str, v5: str, v6: int, v7: int, v8: str, v9: Optional[bool]=True, v10: Optional[float]=0) -> None: v11 = str(v6).zfill(v7) v12 = f'{v4}{v8}-{v11}' v12 = f'{v12}-{v10}' if v10 else v12 v13 = f'{v5}-{v11}.bin' w...
[]
[ "pickle" ]
[ "import pickle" ]
9
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "np.ndarray", "np.ndarray" ]
np.ndarray
def v0(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: v3 = v2.max(axis=0) v4 = v1.max(axis=0) v5 = np.maximum(v3, v4) + 1 v6 = np.ravel_multi_index(v2.T, v5) v7 = np.ravel_multi_index(v1.T, v5) v8 = np.in1d(v6, v7) return v2[~v8]
[]
[ "numpy" ]
[ "import numpy as np" ]
8
# -*- coding: utf-8 -*- # # Copyright 2019 Jim Martens # # 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 appl...
null
v0
[ "str", "Any", "Any" ]
Any
def v0(self, v1: str='', v2=None, v3=True): v4 = self.model.objects.filter(**{v1: v2}).first() if not v4: return {} return self.serialize(v4) if v3 else v4
[]
[]
[]
5
from abc import ABC from contextlib import suppress from copy import deepcopy from django.db import DataError from django.db.models import Max from django.db.models.fields.related import ManyToManyField from rest_framework.exceptions import ValidationError # Create your services here. class StorageService(ABC): ...
null
v0
[ "str", "Any" ]
Any
def v0(self, v1: str='', v2=None): v3 = self.model.objects.filter(**{v1: v2}).first() return v3.delete()
[]
[]
[]
3
from abc import ABC from contextlib import suppress from copy import deepcopy from django.db import DataError from django.db.models import Max from django.db.models.fields.related import ManyToManyField from rest_framework.exceptions import ValidationError # Create your services here. class StorageService(ABC): ...
null
v0
[ "Any", "Any", "bool" ]
Any
def v0(self, v1, v2=None, v3: bool=True): v4 = [] if not self.unique_identifier or not v1: return for v5 in v1: if isinstance(v2, dict): v5.update(v2) (v5, v6) = self.upsert(data=v5, many_to_many_clear=v3) v4.append(v5) return v4
[]
[]
[]
10
from abc import ABC from contextlib import suppress from copy import deepcopy from django.db import DataError from django.db.models import Max from django.db.models.fields.related import ManyToManyField from rest_framework.exceptions import ValidationError # Create your services here. class StorageService(ABC): ...
null
v0
[ "Any" ]
bool
def v0(self, v1) -> bool: if not self.unique_identifier or not v1: return False for v2 in v1: if isinstance(v2, self.model): v2.delete() return True
[]
[]
[]
7
from abc import ABC from contextlib import suppress from copy import deepcopy from django.db import DataError from django.db.models import Max from django.db.models.fields.related import ManyToManyField from rest_framework.exceptions import ValidationError # Create your services here. class StorageService(ABC): ...
null
v0
[ "list", "tuple", "Any", "dict" ]
Any
def v0(self, v1: list, v2: tuple, v3=None, v4: dict=None): v5 = [] if not isinstance(v1, list): return v5 if not v4: v4 = {} try: for v6 in v1: v5.append(self.escape_serialized_object_id(v6, v2, v3, v4)) except Exception as e: pass return v5
[]
[]
[]
12
from abc import ABC from contextlib import suppress from copy import deepcopy from django.db import DataError from django.db.models import Max from django.db.models.fields.related import ManyToManyField from rest_framework.exceptions import ValidationError # Create your services here. class StorageService(ABC): ...
null
v0
[ "Any", "int" ]
int
def v0(v1, v2: int) -> int: for v3 in range(v2): (v4, v5) = (input().split()[0], set(map(int, input().split()))) getattr(v1, v4)(v5) return sum(v1)
[]
[]
[]
5
def main(atrr, times: int) -> int: for _ in range(times): (command, new__set) = (input().split()[0], set(map(int, input().split()))) getattr(atrr, command)(new__set) return sum(atrr) if __name__ == "__main__": (_, a) = (int(input()), set(map(int, input().split()))) print(main(a, int(...
null
v0
[ "int" ]
Any
def v0(self, v1: int): if not self.risk_history_map: self.risk_history_map[v1] = self.baseline_risk elif v1 not in self.risk_history_map: assert v1 - 1 in self.risk_history_map, 'humans should never skip a day worth of risk refresh' self.risk_history_map[v1] = self.risk_history_map[v1 - ...
[]
[ "logging" ]
[ "import logging" ]
20
""" This module contains the logic and attributes of the `Human` agent in our simulator. """ import math import datetime import logging import numpy as np import typing import warnings from collections import defaultdict from orderedset import OrderedSet from covid19sim.utils.mobility_planner import MobilityPlanner f...
null
v0
[ "int", "typing.List[float]" ]
Any
def v0(self, v1: int, v2: typing.List[float]): assert self.conf.get('RISK_MODEL') == 'transformer' assert len(v2) == self.contact_book.tracing_n_days_history, "unexpected transformer history coverage; what's going on?" for v3 in range(len(v2)): self.risk_history_map[v1 - v3] = v2[v3]
[]
[]
[]
5
""" This module contains the logic and attributes of the `Human` agent in our simulator. """ import math import datetime import logging import numpy as np import typing import warnings from collections import defaultdict from orderedset import OrderedSet from covid19sim.utils.mobility_planner import MobilityPlanner f...
null
v0
[ "Any" ]
Dict[str, str]
def v0(self, v1) -> Dict[str, str]: v2 = self.type_map.get(v1[1], 'STRING') v3 = 'NULLABLE' if not v1[6] or v2 == 'TIMESTAMP' else 'REQUIRED' return {'name': v1[0], 'type': v2, 'mode': v3}
[]
[]
[]
4
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
null
v0
[]
dict
def v0() -> dict: v1 = argparse.ArgumentParser() v1.add_argument('-f', '--file', help='set ncfile.', action='append', type=str) v2 = v1.parse_args() v3 = {'file': v2.file} return v3
[]
[ "argparse" ]
[ "import argparse" ]
6
# coding: utf-8 """ Name: ptl_vrt.py potential vorticity on the isentropic. Usage: python3 ptl_vrt.py --file <ncfile> <ncfile2> Author: Ryosuke Tomita Date: 2022/2/5 """ import argparse import numpy as np from metpy.units import units from ncmagics import fetchtime, japanmap_nh, meteotool_nh def parse_args() -> di...
null
v0
[ "np.ndarray", "xr.DataArray", "xr.DataArray" ]
xr.DataArray
def v0(v1: np.ndarray, v2: xr.DataArray, v3: xr.DataArray) -> xr.DataArray: v4 = xr.DataArray(v1, dims=('latitude', 'longitude'), coords={'latitude': v2, 'longitude': v3}) return v4
[]
[ "xarray" ]
[ "import xarray as xr" ]
3
# coding: utf-8 """ Name: grad_t.py Calcurate equivalent_potential_temperature. example: python3 grad_pt.py --file <ncfile> Author: Ryosuke Tomita Date: 2021/10/22 """ import argparse import xarray as xr import numpy as np from ncmagics import fetchtime, japanmap, meteotool def parse_args() -> dict: """parse_a...
null
v0
[]
str
def v0(self) -> str: v1 = self.re.search('/.+?chapter-(\\d+(?:\\.\\d+)?)', self.chapter) if not v1: v1 = self.re.search('/.+?Ch(\\d+(?:\\.\\d+)?)', self.chapter) if not v1: v1 = self.re.search('/c(\\d+(?:\\.\\d+)?)', self.chapter) if not v1: v1 = self.re.search('/(\\d+(?:\\.\\d+)...
[]
[]
[]
9
from .mangago_me import MangaGoMe class RocacaCom(MangaGoMe): def get_chapter_index(self) -> str: re = self.re.search(r'/.+?chapter-(\d+(?:\.\d+)?)', self.chapter) if not re: re = self.re.search(r'/.+?Ch(\d+(?:\.\d+)?)', self.chapter) if not re: re = self.re.search...
null
v0
[ "List[str]", "List[str]" ]
Any
def v0(v1: List[str], v2: List[str]): v3 = [rule.split(' -> ')[1] for v4 in v1] assert set(v3) == set(v2)
[]
[]
[]
3
from typing import Callable, List import pytest from .. import SemparseTestCase from allennlp_semparse.common import ExecutionError, ParsingError from allennlp_semparse import DomainLanguage, predicate, predicate_with_side_args class Arithmetic(DomainLanguage): def __init__( self, allow_function_curryi...
null
v0
[ "str" ]
Any
def v0(v1: str): with open(v1) as v2: v3 = v2.read() v3 = re.sub('\\D', '', v3) v4 = list(map(int, v3)) if len(v4) != 81: raise ValueError(f'Incorrect input format for textfile {v1}') return [v4[i:i + 9] for v5 in range(0, len(v4), 9)]
[]
[ "re" ]
[ "import re" ]
8
import re def parser(file: str): """ Parser to take .txt file and turn into Sudoku list. Parameters: file (str): Path to .txt file Returns: (list): Nested list containing Sudoku Input Sample: Input needs to be text file containing 81 numbers in order. Everything except ...
null
v0
[ "dict" ]
bool
def v0(self, v1: dict) -> bool: try: self.validate(v1) self.logger.info(self.json_dump_pretty(v1)) except ValueError: self.logger.error('Cannot send node data message') self.logger.error(self.json_dump_pretty(v1)) return False return True
[]
[]
[]
9
# pylint: disable=duplicate-code """ Node data message messages ========================== Node data message related metadata connection messages .. Copyright: Copyright Wirepas Ltd 2019 licensed under Apache License, Version 2.0 See file LICENSE for full license details. """ from .aut...
null
v0
[ "str" ]
Dict[str, str]
def v0(v1: str) -> Dict[str, str]: v2 = {} with open(v1, encoding='utf-8') as v3: for v4 in v3: v5 = v4.split('|') (v6, v7) = (v5[0], v5[-1]) v2[v6] = v7.strip() return v2
[]
[]
[]
8
import pickle from pathlib import Path from typing import Dict, List, Any, Union import torch import yaml def read_metafile(path: str) -> Dict[str, str]: text_dict = {} with open(path, encoding='utf-8') as f: for line in f: split = line.split('|') text_id, text = split[0], spl...
null
v0
[ "object", "Union[str, Path]" ]
None
def v0(v1: object, v2: Union[str, Path]) -> None: with open(str(v2), 'wb') as v3: pickle.dump(v1, v3)
[]
[ "pickle" ]
[ "import pickle" ]
3
import pickle from pathlib import Path from typing import Dict, List, Any, Union import torch import yaml def read_metafile(path: str) -> Dict[str, str]: text_dict = {} with open(path, encoding='utf-8') as f: for line in f: split = line.split('|') text_id, text = split[0], spl...
null
v0
[ "Union[str, Path]" ]
Any
def v0(v1: Union[str, Path]) -> Any: with open(v1, 'rb') as v2: v3 = pickle.load(v2) return v3
[]
[ "pickle" ]
[ "import pickle" ]
4
from typing import Any, Union, Dict, Mapping from pathlib import Path from ruamel.yaml import YAML import pickle import h5py import numpy as np from numbers import Number PathLike = Union[str, Path] yaml = YAML(typ='safe') def read_yaml(fname: Union[str, Path]) -> Any: """Read the given file using YAML. P...
null
v0
[ "dict", "torch.device" ]
tuple
def v0(v1: dict, v2: torch.device) -> tuple: (v3, v4, v5, v6) = (v1['tokens'], v1['mel'], v1['tokens_len'], v1['mel_len']) (v3, v4, v5, v6) = (v3.to(v2), v4.to(v2), v5.to(v2), v6.to(v2)) return (v3, v4, v5, v6)
[]
[]
[]
4
import pickle from pathlib import Path from typing import Dict, List, Any, Union import torch import yaml def read_metafile(path: str) -> Dict[str, str]: text_dict = {} with open(path, encoding='utf-8') as f: for line in f: split = line.split('|') text_id, text = split[0], spl...
null
v5
[]
v0
def v5() -> v0: v6 = [v1(partition=0, offset=0, ts=2), v1(partition=1, offset=0, ts=1), v1(partition=2, offset=0, ts=4), v1(partition=1, offset=1, ts=3), v1(partition=1, offset=2, ts=5), v1(partition=2, offset=1, ts=7), v1(partition=0, offset=1, ts=6)] v7 = sorted(v6, key=attrgetter('timestamp')) return (3,...
[ { "name": "v1", "input_types": [ "int", "int", "int" ], "output_type": "BinaryMessage", "code": "def v1(v2: int, v3: int, v4: int) -> BinaryMessage:\n return BinaryMessage(key=f'k_p{v2}_o{v3}'.encode('utf-8'), value=f'v_p{v2}_o{v3}'.encode('utf-8'), partition=v2, offset=v3, ...
[ "datetime", "operator" ]
[ "import datetime", "from operator import attrgetter" ]
4
import datetime from operator import attrgetter from typing import Iterable, Tuple from esque.io.messages import BinaryMessage from esque.io.stream_events import TemporaryEndOfPartition # partition, input, expected_output SortCase = Tuple[int, Iterable[BinaryMessage], Iterable[BinaryMessage]] def mk_binary_message(...
[ "v0 = Tuple[int, Iterable[BinaryMessage], Iterable[BinaryMessage]]" ]
v1
[ "str", "Type[v0]" ]
Optional[v0]
def v1(self, v2: str, v3: Type[v0]) -> Optional[v0]: v4: Optional[v0] = self.properties.get(v2) if v4 is not None: return v4 if self.additional_read_properties is not None: for v5 in self.additional_read_properties: v6: Optional[v0] = v5.get(v2) if v6 is not None: ...
[]
[]
[]
10
from abc import ABC, abstractmethod from typing import Generic, Iterable, List, Optional, Dict, Any, Type, TypeVar, Union import pystac class SummariesExtension: """Base class for extending the properties in :attr:`pystac.Collection.summaries` to include properties defined by a STAC Extension. This clas...
[ "v0 = TypeVar('P')" ]
v0
[ "str", "Optional[Any]", "bool" ]
None
def v0(self, v1: str, v2: Optional[Any], v3: bool=True) -> None: if v2 is None and v3: self.properties.pop(v1, None) else: self.properties[v1] = v2
[]
[]
[]
5
from abc import ABC, abstractmethod from typing import Generic, Iterable, List, Optional, Dict, Any, Type, TypeVar, Union from pystac import Collection, RangeSummary, STACObject, Summaries class SummariesExtension: """Base class for extending the properties in :attr:`pystac.Collection.summaries` to include p...
null
v0
[ "Any" ]
Dict[str, Any]
def v0(v1) -> Dict[str, Any]: v2 = {f.name: getattr(v1, f.name) for v3 in dataclasses.fields(v1)} return v2
[]
[ "dataclasses" ]
[ "import dataclasses" ]
3
"""Types and helper methods for transitions and trajectories.""" import dataclasses import logging import os import pathlib import pickle import warnings from typing import ( Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, overload, ) import numpy as np import torch ...
null
v1
[ "v0" ]
str
def v1(v2: v0) -> str: if isinstance(v2, bytes): return v2.decode() else: return str(v2)
[]
[]
[]
5
"""Types and helper methods for transitions and trajectories.""" import dataclasses import logging import os import pathlib import pickle import warnings from typing import ( Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, overload, ) import numpy as np import torch ...
[ "v0 = Union[str, bytes, os.PathLike]" ]
v0
[ "np.ndarray", "np.ndarray" ]
Any
def v0(v1: np.ndarray, v2: np.ndarray): if v1.shape != (len(v2),): raise ValueError(f'rewards must be 1D array, one entry for each action: {v1.shape} != ({len(v2)},)') if not np.issubdtype(v1.dtype, np.floating): raise ValueError(f'rewards dtype {v1.dtype} not a float')
[]
[ "numpy" ]
[ "import numpy as np" ]
5
"""Types and helper methods for transitions and trajectories.""" import dataclasses import logging import os import pathlib import pickle import warnings from typing import ( Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, overload, ) import numpy as np import torch ...
null
v0
[ "Sequence[Mapping[str, np.ndarray]]" ]
Mapping[str, Union[np.ndarray, th.Tensor]]
def v0(v1: Sequence[Mapping[str, np.ndarray]]) -> Mapping[str, Union[np.ndarray, th.Tensor]]: v2 = [{k: np.array(v) for (v3, v4) in sample.items() if v3 != 'infos'} for v5 in v1] v6 = th_data.dataloader.default_collate(v2) assert isinstance(v6, dict) v6['infos'] = [v5['infos'] for v5 in v1] return v...
[]
[ "numpy", "torch" ]
[ "import numpy as np", "import torch as th", "from torch.utils import data as th_data" ]
6
"""Types and helper methods for transitions and trajectories.""" import dataclasses import logging import os import pathlib import pickle import warnings from typing import ( Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, overload, ) import numpy as np import torch ...
null
v4
[ "v0" ]
Sequence[v1]
def v4(v5: v0) -> Sequence[v1]: with open(v5, 'rb') as v6: return pickle.load(v6)
[]
[ "pickle" ]
[ "import pickle" ]
3
"""Types and helper methods for transitions and trajectories.""" import dataclasses import logging import os import pathlib import pickle import warnings from typing import ( Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, overload, ) import numpy as np import torch ...
[ "v0 = Union[str, bytes, os.PathLike]", "@dataclasses.dataclass(frozen=True)\nclass v1(Trajectory):\n v2: np.ndarray\n 'Reward, shape (trajectory_len, ). dtype float.'\n\n def v3(self):\n \"\"\"Performs input validation, including for rews.\"\"\"\n super().__post_init__()\n _rews_vali...
v4
[ "v0", "Sequence[v1]" ]
None
def v4(v5: v0, v6: Sequence[v1]) -> None: v7 = pathlib.Path(v5) v7.parent.mkdir(parents=True, exist_ok=True) v8 = f'{v5}.tmp' with open(v8, 'wb') as v9: pickle.dump(v6, v9) os.replace(v8, v5) logging.info(f'Dumped demonstrations to {v5}.')
[]
[ "logging", "os", "pathlib", "pickle" ]
[ "import logging", "import os", "import pathlib", "import pickle" ]
8
"""Types and helper methods for transitions and trajectories.""" import dataclasses import logging import os import pathlib import pickle import warnings from typing import ( Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, overload, ) import numpy as np import torch ...
[ "v0 = Union[str, bytes, os.PathLike]", "@dataclasses.dataclass(frozen=True)\nclass v1(Trajectory):\n v2: np.ndarray\n 'Reward, shape (trajectory_len, ). dtype float.'\n\n def v3(self):\n \"\"\"Performs input validation, including for rews.\"\"\"\n super().__post_init__()\n _rews_vali...
v0
[ "int" ]
Tuple[int, int]
def v0(self, v1: int) -> Tuple[int, int]: v2 = 0 v3 = 0 for v4 in self.tree.children(v1): v2 += v4.data['allocation'].n_sub_elements v3 += v4.data['allocation'].n_sub_systems return (v2, v3)
[]
[]
[]
7
# -*- coding: utf-8 -*- # # ramstk.models.dbtables.programdb_allocation_table.py is part of The RAMSTK # Project # # All rights reserved. # Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com """RAMSTKAllocation Table Model.""" # Standard Library Imports from datetime imp...
null
v0
[ "int" ]
int
def v0(self, v1: int) -> int: v2 = 0 for v3 in self.tree.children(v1): v4 = v3.data['allocation'].get_attributes() v4['weight_factor'] = v4['int_factor'] * v4['soa_factor'] * v4['op_time_factor'] * v4['env_factor'] v2 += v4['weight_factor'] self.do_set_attributes(node_id=[v3.iden...
[]
[]
[]
8
# pylint: disable=cyclic-import # -*- coding: utf-8 -*- # # ramstk.models.allocation.table.py is part of The RAMSTK Project # # All rights reserved. # Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com """Allocation Package Table Model.""" # Standard Library Imports from typin...
null
v0
[ "namedtuple" ]
str
def v0(v1: namedtuple) -> str: v2 = v1.name v3 = f'{v2}' return v3
[]
[]
[]
4
import sys, os import logging import numpy as np import numpy.ma as ma import matplotlib.pyplot as plt from typing import Tuple, Optional from collections import namedtuple from matplotlib.patches import Patch from model_evaluation.statistics.statistical_methods import DayStatistics from model_evaluation.plotting.plot_...
null
v0
[]
None
def v0(self) -> None: self.register_intent_handler(intent_name='Default Fallback Intent', handler=self.handle_default_fallback) self.register_intent_handler(intent_name='Default Exit Intent', handler=self.handle_default_exit) self.register_intent_handler(intent_name='i.my_handled_intent', handler=self.refor...
[]
[]
[]
4
# Copyright 2021 ONDEWO GmbH # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
null
v0
[ "ty.int32" ]
None
def v0(v1: ty.int32) -> None: if v1 > 0: print('I love tvm')
[]
[]
[]
3
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v0
[ "str", "str" ]
Any
def v0(self, v1: str, v2: str=''): v3 = requests.post(self._server_url, data={'text': v1, 'desp': v2}) v3.raise_for_status()
[]
[ "requests" ]
[ "import requests", "from requests import HTTPError" ]
3
# coding: utf-8 import requests import json import logging import yagmail from requests import HTTPError CONFIG_FILE_NAME = "config.json" class Config: def __init__(self, config_file: str): with open(config_file, "r") as f: data = f.read() self._config = json.loads(data) for...
null
v0
[ "ArgumentParser" ]
Namespace
def v0(v1: ArgumentParser) -> Namespace: v2 = Namespace() for v3 in v1._actions: if v3.dest is not argparse.SUPPRESS: if not hasattr(v2, v3.dest): if v3.default is not argparse.SUPPRESS: setattr(v2, v3.dest, v3.default) for v4 in v1._defaults: ...
[]
[ "argparse" ]
[ "import argparse", "from argparse import ArgumentError, ArgumentParser, Namespace" ]
11
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "str" ]
Optional[int]
def v0(v1: str) -> Optional[int]: v1 = v1.strip() if not v1: return None v2 = v1[-1] if v2 == 's': v3 = 1 elif v2 == 'm': v3 = 60 elif v2 == 'h': v3 = 60 * 60 elif v2 == 'd': v3 = 24 * 60 * 60 else: raise ArgumentError('s', f"Invalid suffix...
[]
[ "argparse" ]
[ "import argparse", "from argparse import ArgumentError, ArgumentParser, Namespace" ]
16
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
null
v0
[ "str" ]
bool
def v0(self, v1: str) -> bool: v2 = self._get_filesystem(v1) return v2.exists(v1)
[]
[]
[]
3
import os import typing import fsspec from fsspec.core import split_protocol from fsspec.registry import known_implementations from flytekit.configuration import aws as _aws_config from flytekit.extend import DataPersistence, DataPersistencePlugins from flytekit.loggers import logger def s3_setup_args(): kwargs...
null
v0
[ "str", "str", "bool" ]
Any
def v0(self, v1: str, v2: str, v3: bool=False): v4 = self._get_filesystem(v1) if v3: (v1, v2) = self.recursive_paths(v1, v2) return v4.get(v1, v2, recursive=v3)
[]
[]
[]
5
import os import typing import fsspec from fsspec.core import split_protocol from fsspec.registry import known_implementations from flytekit.configuration import aws as _aws_config from flytekit.extend import DataPersistence, DataPersistencePlugins from flytekit.loggers import logger def s3_setup_args(): kwargs...
null
v0
[ "bool", "bool" ]
str
def v0(self, v1: bool, v2: bool, *v3) -> str: v3 = list(v3) if v2: v3 = v3.insert(0, self.default_prefix) v4 = f"{'/'.join(v3)}" if v1: return f'{self.default_protocol}://{v4}' return v4
[]
[]
[]
8
import os import typing import fsspec from fsspec.core import split_protocol from fsspec.registry import known_implementations from flytekit.configuration import aws as _aws_config from flytekit.extend import DataPersistence, DataPersistencePlugins from flytekit.loggers import logger def s3_setup_args(): kwargs...
null
v0
[ "str" ]
Optional[int]
def v0(self, v1: str) -> Optional[int]: for v2 in range(self.size - 1, -1, -1): if self.frames[v2].function == v1: return v2 return None
[]
[]
[]
5
# Copyright 2021 Zilliz. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
null
v0
[ "int", "int", "List[str]" ]
str
def v0(self, v1: int=None, v2: int=None, v3: List[str]=None) -> str: v1 = v1 or 0 v2 = v2 or self.size if v2 > self.size or v2 <= 0 or v1 >= self.size or (v1 < 0): raise IndexError(f'index range [{v1}, {v2}) out of frame range[0, {self.size})') if v1 >= v2: raise IndexError(f'end = {v2} ...
[]
[ "hashlib" ]
[ "import hashlib" ]
20
# Copyright 2021 Zilliz. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
null
v0
[ "str", "List[str]" ]
Any
def v0(self, v1: str, v2: List[str]): if 'data_source' in v1 or 'exog_ts' == v1 or 'custom' in v1: return [v1] v3 = v1 in self.models v4 = self.models if v3 else self.data_operations v5 = set.intersection(set(v4), set(v2)) if 'lagged' in v1: v5 = set.intersection({'lagged', 'sparse_l...
[]
[]
[]
11
from typing import List, Optional from fedot.core.repository.operation_types_repository import get_operations_for_task from fedot.core.utilities.data_structures import ComparableEnum as Enum class RemoveType(Enum): node_only = 'node_only' with_direct_children = 'with_direct_children' with_parents = 'with...
null
v0
[ "str", "Optional[List[str]]", "List[str]" ]
Any
def v0(self, v1: str, v2: Optional[List[str]], v3: List[str]): v4 = set.intersection(set(self.data_operations), set(v3)) if v1 in v4: v4.remove(v1) if v2: for v5 in v2: if v5 in v4: v4.remove(v5) return list(v4)
[]
[]
[]
9
from typing import List, Optional from fedot.core.repository.operation_types_repository import get_operations_for_task from fedot.core.utilities.data_structures import ComparableEnum as Enum class RemoveType(Enum): node_only = 'node_only' with_direct_children = 'with_direct_children' with_parents = 'with...
null
v0
[ "Tensor" ]
Tensor
def v0(v1: Tensor) -> Tensor: v2 = v1.shape[1] return torch.arange(0.0, v2 * 5.0).reshape(5, v2)
[]
[ "torch" ]
[ "import torch", "from torch import Tensor", "from torch.nn import Module" ]
3
#!/usr/bin/env python3 from typing import Callable, Tuple, Union import torch from torch import Tensor from torch.nn import Module from captum.attr._core.neuron.neuron_gradient_shap import NeuronGradientShap from captum.attr._core.neuron.neuron_integrated_gradients import ( NeuronIntegratedGradients, ) from ...h...
null
v0
[ "Any", "Any", "Any" ]
bool
def v0(v1, v2, v3=None) -> bool: if v3 is None: raise ValueError("'own' cannot be used as a global permission.") return v1(v2, v3)
[]
[]
[]
4
from functools import wraps from typing import Optional import warnings from django.utils.module_loading import import_string from csv_permissions.evaluators import make_evaluate_not_implemented from csv_permissions.evaluators import resolve_all_evaluator from csv_permissions.evaluators import resolve_empty_evaluator...
null