name
stringclasses
293 values
input_types
listlengths
0
49
output_type
stringlengths
1
180
code
stringlengths
37
97.8k
dependencies
listlengths
0
6
lib_used
listlengths
0
11
imports
listlengths
0
40
line_count
int64
3
155
full_code
stringlengths
51
996k
input_type_defs
listlengths
1
11
v0
[ "str" ]
Dict
def v0(self, v1: str) -> Dict: v2 = self.trace_records[v1] v3 = defaultdict(set) for v4 in v2: for (v5, v6) in v4.arg_types.items(): v3[v5].add(v6) return v3
[]
[ "collections" ]
[ "from collections import defaultdict" ]
7
import inspect import typing import torch from typing import Optional, Iterable, List, Dict from collections import defaultdict _IS_MONKEYTYPE_INSTALLED = True try: import monkeytype # type: ignore[import] from monkeytype import trace as monkeytype_trace from monkeytype.db.base import CallTraceThunk, Call...
null
v0
[ "str" ]
Dict
def v0(self, v1: str) -> Dict: v2 = self.analyze(v1) for (v3, v4) in v2.items(): v5 = ' ' for v6 in v4: if inspect.getmodule(v6) == typing: v7 = str(v6) v5 += v7.replace('typing.', '') + ',' elif v6 is torch.nn.parameter.Parameter: ...
[]
[ "inspect", "torch", "typing" ]
[ "import inspect", "import typing", "import torch", "from typing import Optional, Iterable, List, Dict" ]
18
import inspect import typing import torch from typing import Optional, Iterable, List, Dict from collections import defaultdict _IS_MONKEYTYPE_INSTALLED = True try: import monkeytype # type: ignore[import] from monkeytype import trace as monkeytype_trace from monkeytype.db.base import CallTraceThunk, Call...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: with open(v1, 'r') as v2: v3 = json.load(v2) if 'inter_message_delay' in v3: self.inter_message_delay = v3['inter_message_delay'] if 'reset_delay' in v3: self.reset_delay = v3['reset_delay']
[]
[ "json" ]
[ "import json" ]
7
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[]
None
def v0(self) -> None: self.fail += 1 self.logger.error('Test Fail')
[]
[]
[]
3
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[]
None
def v0(self) -> None: v1 = self._get_json() if v1 is not None: if 'result' in v1: if v1['result'] == 'ok': self.IncrementOkCount() return self.IncrementFailCount()
[]
[]
[]
8
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[ "Any", "Any" ]
None
def v0(self, v1, v2) -> None: v3 = self._get_json() if v3 is not None: if 'result' in v3: if v3['result'] == 'ok': if v2 is None: if v1 in v3: self.IncrementOkCount() return elif isinstance(v2...
[]
[]
[]
17
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[]
None
def v0(self, **v1) -> None: v2 = False v3 = 0 v4 = self._get_json() if v4 is not None: if 'result' in v4: if v4['result'] == 'ok': v2 = True for (v5, v6) in v1.items(): if v6 is None: if v5 not in v4: ...
[]
[]
[]
21
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[ "Any", "Any", "Any" ]
None
def v0(self, v1, v2, v3) -> None: v4 = self._get_json() if v4 is not None: if 'result' in v4: v5 = v4['result'] if isinstance(v5, int): if v5 >= v2 and v5 <= v3: self.IncrementOkCount() return self.IncrementFailCount()
[]
[]
[]
10
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[]
list
def v0(self) -> list: v1 = self._get_json() if v1 is not None: if 'result' in v1: v2 = v1['result'] if isinstance(v2, list): self.IncrementOkCount() return v2 self.IncrementFailCount() return [0, '']
[]
[]
[]
10
""" BT510 commands (serial or BLE). This is a subset of the jtester commands used for verification. """ import time import json import random import string import logging from jsonrpcclient.requests import Request class jtester: def __init__(self, fname="config.json"): """ JSON tester that is independen...
null
v0
[ "int" ]
int
def v0(v1: int) -> int: v2: list = [] for v3 in range(1, v1): if v3 % 3 == 0 or v3 % 5 == 0: v2.append(v3) return sum(v2)
[]
[]
[]
6
""" @param: n -> int : Upper Limit of the range """ def multiples(n: int) -> int: num: list = [] for i in range(1, n): if (i % 3 == 0) or (i % 5 == 0): num.append(i) return sum(num) if __name__ == '__main__': t: int = int(input()) for _x in range(t): n: int = int(input(...
null
v0
[ "str" ]
Tuple[List[str], List[str]]
def v0(self, v1: str) -> Tuple[List[str], List[str]]: v2 = v1.replace('<>', '').split('\n') v3 = re.split('\\n|<>', v1) return (v2, v3)
[]
[ "re" ]
[ "import re" ]
4
import copy import os import re from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import ujson from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown, mdiff from zerver.lib.actions import ( do_add_alert_words, do_rem...
null
v0
[]
None
def v0(self) -> None: (v1, v2) = self.load_markdown_tests() for (v3, v4) in v1.items(): v5 = f'''Test "{v3}" shouldn't be ignored.''' v6 = v4.get('ignore', False) self.assertFalse(v6, v5)
[]
[]
[]
6
import copy import os import re from textwrap import dedent from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import orjson from django.conf import settings from django.test import override_settings from markdown import Markdown from zerver.lib.actions import ( do_add_alert_words,...
null
v2
[]
None
def v2(self) -> None: v3 = 'To bitcoin:1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa or not to bitcoin' v4 = v0(v3) self.assertEqual(v4, '<p>To <a href="bitcoin:1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" target="_blank" title="bitcoin:1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa">bitcoin:1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa</a> or not t...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bugdown.convert(v1, message_realm=get_realm('zulip'))", "dependencies": [] } ]
[]
[]
4
# -*- coding: utf-8 -*- from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown from zerver.lib.actions import ( do_set_user_display_setting, do_remove_realm_emoji, do_set_alert_words, get_realm, ) from zerver.lib.alert_words import alert_word...
null
v2
[]
None
def v2(self) -> None: v3 = 'Check out the debate: http://www.youtube.com/watch?v=hx1mjT73xYE' v4 = v0(v3) self.assertEqual(v4, '<p>Check out the debate: <a href="http://www.youtube.com/watch?v=hx1mjT73xYE">http://www.youtube.com/watch?v=hx1mjT73xYE</a></p>\n<div class="youtube-video message_inline_image"><a...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bugdown.convert(content=v1, message_realm=get_realm('zulip'))", "dependencies": [] } ]
[]
[]
19
import copy import os import re from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import ujson from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown, mdiff from zerver.lib.actions import ( do_add_alert_words, do_rem...
null
v2
[]
None
def v2(self) -> None: v3 = 'Test: https://github.com/zulip/zulip/blob/master/static/images/logo/zulip-icon-128x128.png' v4 = v0(v3) self.assertEqual(v4, '<p>Test: <a href="https://github.com/zulip/zulip/blob/master/static/images/logo/zulip-icon-128x128.png" target="_blank" title="https://github.com/zulip/zu...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bugdown.convert(v1, message_realm=get_realm('zulip'))", "dependencies": [] } ]
[]
[]
7
# -*- coding: utf-8 -*- from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown from zerver.lib.actions import ( do_set_user_display_setting, do_remove_realm_emoji, do_set_alert_words, get_realm, ) from zerver.lib.alert_words import alert_word...
null
v8
[]
None
def v8(self) -> None: def v9(v10: str) -> str: return f'<a href="{v10}">{v10}</a>' v11 = '<a href="https://twitter.com/Twitter">@Twitter</a> meets @seepicturely at #tcdisrupt cc.<a href="https://twitter.com/boscomonkey">@boscomonkey</a> <a href="https://twitter.com/episod">@episod</a> <a href="http://t...
[ { "name": "v0", "input_types": [ "str", "str", "str" ], "output_type": "str", "code": "def v0(v1: str, v2: str, v3: str='') -> str:\n return f'<div class=\"inline-preview-twitter\"><div class=\"twitter-tweet\"><a href=\"{v1}\"><img class=\"twitter-avatar\" src=\"https://exte...
[]
[]
57
import copy import os import re from textwrap import dedent from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import orjson from django.conf import settings from django.test import override_settings from markdown import Markdown from zerver.lib.actions import ( do_add_alert_words,...
null
v2
[]
None
def v2(self) -> None: v3 = '☕' v4 = v0(v3) self.assertEqual(v4, '<p><span aria-label="coffee" class="emoji emoji-2615" role="img" title="coffee">:coffee:</span></p>') v3 = '☕☕' v4 = v0(v3) self.assertEqual(v4, '<p><span aria-label="coffee" class="emoji emoji-2615" role="img" title="coffee">:coff...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bugdown.convert(content=v1, message_realm=get_realm('zulip'))", "dependencies": [] } ]
[]
[]
7
import copy import os import re from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import ujson from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown, mdiff from zerver.lib.actions import ( do_add_alert_words, do_rem...
null
v2
[]
None
def v2(self) -> None: v3 = '☕' v4 = v0(v3) v3 = ':coffee:' v5 = v0(v3) self.assertEqual(v5, v4)
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bugdown.convert(content=v1, message_realm=get_realm('zulip'))", "dependencies": [] } ]
[]
[]
6
import copy import os import re from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import ujson from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown, mdiff from zerver.lib.actions import ( do_add_alert_words, do_rem...
null
v0
[ "int", "int" ]
List[str]
def v0(self, v1: int, v2: int) -> List[str]: v3 = ['x' * v2] * v1 return v3
[]
[]
[]
3
import copy import os import re from typing import Any, Dict, List, Optional, Set, Tuple from unittest import mock import ujson from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown, mdiff from zerver.lib.actions import ( do_add_alert_words, do_rem...
null
v2
[]
None
def v2(self) -> None: v3 = '[My favorite image](https://example.com/testimage.png)' v4 = v0(v3) self.assertEqual(v4, '<p><a href="https://example.com/testimage.png" target="_blank" title="https://example.com/testimage.png">My favorite image</a></p>\n<div class="message_inline_image"><a href="https://example...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bugdown.convert(v1, message_realm=get_realm('zulip'))", "dependencies": [] } ]
[]
[]
4
# -*- coding: utf-8 -*- from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown from zerver.lib.actions import ( do_set_user_display_setting, do_remove_realm_emoji, do_set_alert_words, get_realm, ) from zerver.lib.alert_words import alert_word...
null
v0
[]
None
def v0(self) -> None: v1 = 'That is a **bold** statement' v2 = self.api_post(self.example_email('othello'), '/api/v1/messages/render', dict(content=v1)) self.assert_json_success(v2) self.assertEqual(v2.json()['rendered'], u'<p>That is a <strong>bold</strong> statement</p>')
[]
[]
[]
5
# -*- coding: utf-8 -*- from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown from zerver.lib.actions import ( do_set_user_display_setting, do_remove_realm_emoji, do_set_alert_words, get_realm, ) from zerver.lib.alert_words import alert_word...
null
v0
[ "str", "str", "str" ]
str
def v0(v1: str, v2: str, v3: str='') -> str: if v2[:4] == 'http': v4 = v2 elif '@' in v2: v4 = 'mailto:' + v2 else: v4 = 'http://' + v2 return v1 % ('<a href="%s">%s</a>' % (v4, v2),)
[]
[]
[]
8
import copy import os import re from typing import Any, Dict, List, Optional, Set, Tuple, cast from unittest import mock import ujson from django.conf import settings from django.test import TestCase, override_settings from zerver.lib import bugdown, mdiff from zerver.lib.actions import ( do_add_alert_words, ...
null
v0
[ "bool" ]
None
def v0(self, v1: bool) -> None: self._score += -2 if v1 else 1 if self._score < 10: self._score = 0
[]
[]
[]
4
from hangul_romanize import Transliter from hangul_romanize.rule import academic class Word: """ Object representation of a word record that can update the success_rating of that record. """ _romanize = Transliter(academic).translit def __init__(self, _id: int, english: str, korean: str, score: i...
null
v0
[ "bool" ]
None
def v0(self, v1: bool) -> None: if not v1: self._score += 2 elif 10 < self._score: self._score -= 1 if self._score < 10: self._score = 0
[]
[]
[]
7
from hangul_romanize import Transliter from hangul_romanize.rule import academic class Word: """ Object representation of a word record that can update the success_rating of that record. """ _romanize = Transliter(academic).translit def __init__(self, _id: int, english: str, korean: str, score: i...
null
v1
[ "v0", "Any" ]
v0
def v1(self, v2: v0, v3=False) -> v0: if self.decode_responses or v3: if isinstance(v2, memoryview): return v2.tobytes().decode(self.encoding, self.encoding_errors) if isinstance(v2, bytes): return v2.decode(self.encoding, self.encoding_errors) return v2
[]
[]
[]
7
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
[ "v0 = Union[EncodedT, DecodedT]" ]
v0
[ "float" ]
Any
async def v0(self, v1: float=0): if not self.is_connected: await self.connect() return await self._parser.can_read(v1)
[]
[]
[]
4
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
null
v0
[ "int" ]
bytes
async def v0(self, v1: int) -> bytes: v1 += 2 if v1 > self.length: await self._read_from_socket(v1 - self.length) self._buffer.seek(self.bytes_read) v2 = self._buffer.read(v1) self.bytes_read += len(v2) if self.bytes_read == self.bytes_written: self.purge() return v2[:-2]
[]
[]
[]
10
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
null
v0
[]
Iterable[Tuple[str, Union[str, int]]]
def v0(self) -> Iterable[Tuple[str, Union[str, int]]]: v1 = [('path', self.path), ('db', self.db)] if self.client_name: v1.append(('client_name', self.client_name)) return v1
[]
[]
[]
5
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
null
v0
[ "bool" ]
Any
async def v0(self, v1: bool=True): self._checkpid() async with self._lock: v2 = await asyncio.gather(*(connection.disconnect() for v3 in self._connections), return_exceptions=True) v4 = next((r for v5 in v2 if isinstance(v5, BaseException)), None) if v4: raise v4
[]
[ "asyncio" ]
[ "import asyncio" ]
7
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
null
v0
[ "Union[bytes, str, Iterable[Union[bytes, str]]]" ]
Any
async def v0(self, v1: Union[bytes, str, Iterable[Union[bytes, str]]]): self._writer.writelines(v1) await self._writer.drain()
[]
[]
[]
3
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
null
v0
[]
ssl.SSLContext
def v0(self) -> ssl.SSLContext: if not self.context: v1 = ssl.create_default_context() v1.check_hostname = self.check_hostname v1.verify_mode = self.cert_reqs if self.certfile and self.keyfile: v1.load_cert_chain(certfile=self.certfile, keyfile=self.keyfile) if se...
[]
[ "ssl" ]
[ "import ssl" ]
11
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
null
v79
[ "v0" ]
Any
async def v79(self, v80: v0): self._checkpid() if not self.owns_connection(v80): await v80.disconnect() self.pool.put_nowait(None) return try: self.pool.put_nowait(v80) except asyncio.QueueFull: pass
[]
[ "asyncio" ]
[ "import asyncio" ]
10
import asyncio import errno import inspect import io import os import socket import ssl import threading import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, TypeVar, ...
[ "class v0:\n v1 = ('pid', 'host', 'port', 'db', 'username', 'client_name', 'password', 'socket_timeout', 'socket_connect_timeout', 'socket_keepalive', 'socket_keepalive_options', 'socket_type', 'retry_on_timeout', 'health_check_interval', 'next_health_check', 'last_active_at', 'encoder', 'ssl_context', '_reader'...
v0
[ "Real" ]
int
def v0(self, v1: Real) -> int: v2 = 0 for (v3, v4) in self.mempool_fees: v2 += v4 if v3 <= v1: break return v2
[]
[]
[]
7
import json import threading import time import os import stat from decimal import Decimal from typing import Union, Optional from numbers import Real from copy import deepcopy from . import util from .util import (user_dir, make_dir, NoDynamicFeeEstimates, format_fee_satoshis, quantize_feerate) fr...
null
v0
[ "Any" ]
int
def v0(self, v1) -> int: v2 = self.depth_target(v1) return self.depth_target_to_fee(v2)
[]
[]
[]
3
import json import threading import time import os import stat from decimal import Decimal from typing import Union, Optional from numbers import Real from copy import deepcopy from . import util from .util import (user_dir, make_dir, NoDynamicFeeEstimates, format_fee_satoshis, quantize_feerate) fr...
null
v0
[ "pd.DataFrame" ]
np.array
def v0(v1: pd.DataFrame) -> np.array: v2 = [] for (v3, v4) in v1.iterrows(): v2.append((v4['Latitude'], v4['Longitude'])) return np.array(v2)
[]
[ "numpy" ]
[ "import numpy as np" ]
5
from pathlib import Path from typing import Tuple, List, Dict import pandas as pd import numpy as np from tsfresh.utilities.dataframe_functions import roll_time_series def get_path(df: pd.DataFrame) -> np.array: out = [] for index, row in df.iterrows(): out.append((row["Latitude"], row["Longitude"]))...
null
v0
[ "str", "Dict[str, List[pd.DataFrame]]" ]
None
def v0(v1: str, v2: Dict[str, List[pd.DataFrame]]) -> None: v3: Path for (v4, v5) in v2.items(): v3 = Path(v1).joinpath(v4[:v4.find('-')], v4[v4.find('-') + 1:]) v3.mkdir(parents=True, exist_ok=True) for (v6, v7) in enumerate(v5): v7.to_csv(v3.joinpath('timeseries-' + str(v6)...
[]
[ "pathlib" ]
[ "from pathlib import Path" ]
7
from pathlib import Path from typing import Tuple, List, Dict import pandas as pd import numpy as np from tsfresh.utilities.dataframe_functions import roll_time_series def get_path(df: pd.DataFrame) -> np.array: out = [] for index, row in df.iterrows(): out.append((row["Latitude"], row["Longitude"]))...
null
v0
[ "str" ]
Tuple[pd.DataFrame, pd.Series, pd.Series]
def v0(v1: str) -> Tuple[pd.DataFrame, pd.Series, pd.Series]: v2 = pd.DataFrame() v3 = pd.Series() v4 = pd.Series() v5: pd.DataFrame v6: int = 0 for v7 in {'deck', 'stem'}: for v8 in {'single', 'double'}: for v9 in Path(v1).joinpath(v7, v8).iterdir(): v5 = pd....
[]
[ "pandas", "pathlib" ]
[ "from pathlib import Path", "import pandas as pd" ]
18
from pathlib import Path from typing import Tuple, List, Dict import pandas as pd import numpy as np from tsfresh.utilities.dataframe_functions import roll_time_series def get_path(df: pd.DataFrame) -> np.array: out = [] for index, row in df.iterrows(): out.append((row["Latitude"], row["Longitude"]))...
null
v0
[ "np.array", "np.array" ]
Any
def v0(v1: np.array, v2: np.array): v1 = (v1 - np.mean(v1)) / np.std(v1) v2 = (v2 - np.mean(v2)) / np.std(v2) v3 = np.correlate(v1, v2, 'full') v4 = len(v3) - min(len(v1), len(v1)) v5 = v3.argmax() v6 = np.abs(v4 - v5) if v6 == 0: v7 = v3[::-1] v8 = v7.argmax() v9 = n...
[]
[ "numpy" ]
[ "import numpy as np" ]
13
from pathlib import Path from typing import Tuple, List, Dict import pandas as pd import numpy as np from tsfresh.utilities.dataframe_functions import roll_time_series def get_path(df: pd.DataFrame) -> np.array: out = [] for index, row in df.iterrows(): out.append((row["Latitude"], row["Longitude"]))...
null
v0
[ "np.ndarray" ]
torch.Tensor
def v0(self, v1: np.ndarray) -> torch.Tensor: if len(v1.shape) == 1: v1 = np.reshape(v1, (-1, 1)) if self.detection: v2 = np.concatenate((self._inverse_sigmoid(v1[:, 0]).reshape(-1, 1), v1[:, 1:]), axis=1) elif self._is_binary_classification(): v2 = self._inverse_sigmoid(v1) else...
[]
[ "numpy", "torch" ]
[ "import numpy as np", "import torch", "import torch.distributions.constraints as constraints" ]
10
# Copyright (C) 2019-2021 Ruhr West University of Applied Sciences, Bottrop, Germany # AND Elektronische Fahrwerksysteme GmbH, Gaimersheim Germany # # This Source Code Form is subject to the terms of the Apache License 2.0 # If a copy of the APL2 was not distributed with this # file, You can obtain one at https://www.a...
null
v0
[ "pd.DataFrame", "str", "str" ]
None
def v0(v1: pd.DataFrame, v2: str, v3: str) -> None: v4 = px.scatter_mapbox(v1, lat=v2, lon=v3, color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=10, mapbox_style='carto-positron') v4.show()
[]
[ "plotly" ]
[ "import plotly.express as px" ]
3
#!/usr/bin/env python # coding: utf-8 # # Loading data import pandas as pd import plotly.express as px from tqdm import tqdm import functools import numpy as np from difflib import SequenceMatcher from oauthlib.oauth2 import BackendApplicationClient from requests_oauthlib import OAuth2Session from datetime import d...
null
v0
[]
None
def v0() -> None: print('Beginning commune file download with requests') v1 = os.path.join('.', 'data') if not os.path.exists(v1): os.mkdir(v1) v2 = 'https://www.bfs.admin.ch/bfsstatic/dam/assets/11467406/master' v3 = requests.get(v2) with open(os.path.join('.', 'data', 'commune.xlsx'), ...
[]
[ "os", "requests" ]
[ "import requests", "import os" ]
10
#!/usr/bin/env python # coding: utf-8 # # Loading data import pandas as pd import plotly.express as px from tqdm import tqdm import functools import numpy as np from difflib import SequenceMatcher from oauthlib.oauth2 import BackendApplicationClient from requests_oauthlib import OAuth2Session from datetime import d...
null
v47
[ "str" ]
v0
def v47(self, v48: str) -> v0: self.client_name = v48 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-iam-service (5.10.1) # pylint: disable=dup...
[ "class v0(Model):\n v1: str\n v2: str\n v3: List[AccountcommonPermission]\n v4: str\n v5: str\n\n def v6(self, v7: str) -> v0:\n self.client_id = v7\n return self\n\n def v8(self, v9: str) -> v0:\n self.client_name = v9\n return self\n\n def v10(self, v11: List[Ac...
v47
[ "str" ]
v0
def v47(self, v48: str) -> v0: self.namespace = v48 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-iam-service (5.10.1) # pylint: disable=dup...
[ "class v0(Model):\n v1: str\n v2: str\n v3: List[AccountcommonPermission]\n v4: str\n v5: str\n\n def v6(self, v7: str) -> v0:\n self.client_id = v7\n return self\n\n def v8(self, v9: str) -> v0:\n self.client_name = v9\n return self\n\n def v10(self, v11: List[Ac...
v47
[ "str" ]
v0
def v47(self, v48: str) -> v0: self.redirect_uri = v48 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-iam-service (5.10.1) # pylint: disable=dup...
[ "class v0(Model):\n v1: str\n v2: str\n v3: List[AccountcommonPermission]\n v4: str\n v5: str\n\n def v6(self, v7: str) -> v0:\n self.client_id = v7\n return self\n\n def v8(self, v9: str) -> v0:\n self.client_name = v9\n return self\n\n def v10(self, v11: List[Ac...
v0
[ "bool" ]
dict
def v0(self, v1: bool=False) -> dict: v2: dict = {} if hasattr(self, 'client_id'): v2['ClientId'] = str(self.client_id) elif v1: v2['ClientId'] = '' if hasattr(self, 'client_name'): v2['ClientName'] = str(self.client_name) elif v1: v2['ClientName'] = '' if hasattr...
[]
[]
[]
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-iam-service (5.10.1) # pylint: disable=dup...
null
v0
[ "Union[str, 'TextHolder']", "Any", "Any", "Any" ]
Any
def v0(self, v1: Union[str, 'TextHolder'], v2=True, v3=True, v4=True): v5 = str(v1) if v3 and (not v5): return self if not v5.endswith('\n') and v2: v5 += '\n' if v4: self.text += self._ident * self.ident_text + v5 else: self.text += v5 return self
[]
[]
[]
11
# encoding: utf-8 from typing import Optional, Union class Indent: class IdentStart: def __init__(self, text): self.text = text class IdentEnd: def __init__(self, text): self.text = text class IdentEndLater: def __init__(self, text): self.text ...
null
v0
[ "int", "str" ]
Any
def v0(self, v1: int=1, v2: str=None): if v2 is None: v2 = self.ident_text v3 = self.text if v3.endswith('\n'): v3 = v3[:-1] return '\n'.join([v2 * v1 + i for v4 in v3.split('\n')])
[]
[]
[]
7
# encoding: utf-8 from typing import Optional, Union class Indent: class IdentStart: def __init__(self, text): self.text = text class IdentEnd: def __init__(self, text): self.text = text class IdentEndLater: def __init__(self, text): self.text ...
null
v0
[ "torch.Tensor" ]
'Flow'
def v0(self, v1: torch.Tensor) -> 'Flow': self._context = v1 return self
[]
[]
[]
3
# Copyright (c) Meta Platforms, Inc from typing import Any, Dict, Optional, Union import flowtorch import torch import torch.distributions as dist from torch import Tensor from torch.distributions.utils import _sum_rightmost class Flow(torch.nn.Module, dist.Distribution, metaclass=flowtorch.LazyMeta): _default_...
null
v0
[ "Any" ]
bool
def v0(self, v1) -> bool: v2 = "START\\s(t'\\d{4}(-\\d{2}){2}T\\d{2}(:\\d{2}){2}(\\.\\d+)?Z')\\sSTOP" v3 = re.search(v2, v1) return bool(v3)
[]
[ "re" ]
[ "import re" ]
4
from stix_shifter_utils.modules.base.stix_transmission.base_sync_connector import BaseSyncConnector from stix_shifter_utils.stix_transmission.utils.RestApiClient import RestApiClient from stix2matcher.matcher import Pattern from stix2matcher.matcher import MatchListener from stix2validator import validate_instance impo...
null
v0
[ "np.ndarray", "complex", "float", "float" ]
np.ndarray
def v0(v1: np.ndarray, v2: complex, v3: float, v4: float=0) -> np.ndarray: v5 = v1 * v3 + v4 / np.pi return v2 * (2 * (2 * np.floor(v5) - np.floor(2 * v5)) + 1).astype(np.complex_)
[]
[ "numpy" ]
[ "import numpy as np" ]
3
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v10
[ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ]
np.ndarray
def v10(v11, v12: float, v13: float, v14: float, v15: Optional[float]=None, v16: bool=False, v17: bool=False) -> np.ndarray: if v15 is None: v15 = 2 * (v13 + 1) v18 = v0(np.array([-v15 / 2]), v12, v13, v14) v11 -= v18 v19 = 1.0 if v16: v19 = v12 / (v12 - v18) if v12 - v18 != 0 else 1...
[ { "name": "v0", "input_types": [ "np.ndarray", "complex", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]", "code": "def v0(v1: np.ndarray, v2: complex, v3: float, v4: float, v5: Opt...
[ "numpy" ]
[ "import numpy as np" ]
12
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
null
v10
[ "np.ndarray", "complex", "float", "float", "Optional[float]", "bool", "bool" ]
Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]
def v10(v11: np.ndarray, v12: complex, v13: float, v14: float, v15: Optional[float]=None, v16: bool=False, v17: bool=False) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]: v11 = np.asarray(v11, dtype=np.complex_) v18 = (v11 - v13) / v14 v19 = v12 * np.exp(-v18 ** 2 / 2).astype(np.complex_) if v15 i...
[ { "name": "v0", "input_types": [ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "np.ndarray", "code": "def v0(v1, v2: float, v3: float, v4: float, v5: Optional[float]=None, v6: bool=False, v7: bool=False) -> np.ndar...
[ "numpy" ]
[ "import numpy as np" ]
9
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v20
[ "np.ndarray", "complex", "float", "float", "bool", "Optional[float]", "bool" ]
np.ndarray
def v20(v21: np.ndarray, v22: complex, v23: float, v24: float, v25: bool=False, v26: Optional[float]=None, v27: bool=False) -> np.ndarray: (v28, v29) = v10(v21, amp=v22, center=v23, sigma=v24, zeroed_width=v26, rescale_amp=v27, ret_x=True) v30 = -v29 / v24 * v28 if v25: return (v30, v28) return ...
[ { "name": "v0", "input_types": [ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "np.ndarray", "code": "def v0(v1, v2: float, v3: float, v4: float, v5: Optional[float]=None, v6: bool=False, v7: bool=False) -> np.ndar...
[ "numpy" ]
[ "import numpy as np" ]
6
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v14
[ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ]
np.ndarray
def v14(v15, v16: float, v17: float, v18: float, v19: Optional[float]=None, v20: bool=False, v21: bool=False) -> np.ndarray: if v19 is None: v19 = 2 * (v17 + 1) v22 = v0(np.array([v19 / 2]), v16, 0, v18) v15 -= v22 v23 = 1.0 if v20: v23 = v16 / (v16 - v22) if v16 - v22 != 0 else 1.0 ...
[ { "name": "v0", "input_types": [ "np.ndarray", "complex", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]", "code": "def v0(v1: np.ndarray, v2: complex, v3: float, v4: float, v5: Opt...
[ "numpy" ]
[ "import numpy as np" ]
12
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v14
[ "np.ndarray", "complex", "float", "float", "Optional[float]", "bool", "bool" ]
Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]
def v14(v15: np.ndarray, v16: complex, v17: float, v18: float, v19: Optional[float]=None, v20: bool=False, v21: bool=False) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]: v15 = np.asarray(v15, dtype=np.complex_) v22 = (v15 - v17) / v18 v23 = v16 * v10(v22).astype(np.complex_) if v19 is not None: ...
[ { "name": "v0", "input_types": [ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "np.ndarray", "code": "def v0(v1, v2: float, v3: float, v4: float, v5: Optional[float]=None, v6: bool=False, v7: bool=False) -> np.ndar...
[ "numpy" ]
[ "import numpy as np" ]
9
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v24
[ "np.ndarray", "complex", "float", "float", "bool" ]
np.ndarray
def v24(v25: np.ndarray, v26: complex, v27: float, v28: float, v29: bool=False) -> np.ndarray: (v30, v31) = v10(v25, amp=v26, center=v27, sigma=v28, ret_x=True) v32 = -v30 * np.tanh(v31) / v28 if v29: return (v32, v30) return v32
[ { "name": "v0", "input_types": [ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "np.ndarray", "code": "def v0(v1, v2: float, v3: float, v4: float, v5: Optional[float]=None, v6: bool=False, v7: bool=False) -> np.ndar...
[ "numpy" ]
[ "import numpy as np" ]
6
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v23
[ "np.ndarray", "complex", "float", "float", "float", "Optional[float]" ]
np.ndarray
def v23(v24: np.ndarray, v25: complex, v26: float, v27: float, v28: float, v29: Optional[float]=None) -> np.ndarray: v30 = v26 - v27 / 2 v31 = v26 + v27 / 2 if v29: if v29 < v27: raise PulseError('zeroed_width cannot be smaller than square_width.') v32 = v29 - v27 else: ...
[ { "name": "v0", "input_types": [ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "np.ndarray", "code": "def v0(v1, v2: float, v3: float, v4: float, v5: Optional[float]=None, v6: bool=False, v7: bool=False) -> np.ndar...
[ "functools", "numpy", "qiskit" ]
[ "import functools", "import numpy as np", "from qiskit.pulse.exceptions import PulseError" ]
12
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v31
[ "np.ndarray", "complex", "float", "float", "float", "Optional[float]", "bool" ]
np.ndarray
def v31(v32: np.ndarray, v33: complex, v34: float, v35: float, v36: float, v37: Optional[float]=None, v38: bool=False) -> np.ndarray: (v39, v40) = v20(v32, amp=v33, center=v34, sigma=v35, ret_gaussian=True, zeroed_width=v37, rescale_amp=v38) return v40 + 1j * v36 * v39
[ { "name": "v0", "input_types": [ "Any", "float", "float", "float", "Optional[float]", "bool", "bool" ], "output_type": "np.ndarray", "code": "def v0(v1, v2: float, v3: float, v4: float, v5: Optional[float]=None, v6: bool=False, v7: bool=False) -> np.ndar...
[ "numpy" ]
[ "import numpy as np" ]
3
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v0
[ "nox.Session" ]
None
def v0(v1: nox.Session, *v2: str) -> None: v1.install('--upgrade', 'wheel') v1.install('--upgrade', *v2)
[]
[]
[]
3
# -*- coding: utf-8 -*- # cython: language_level=3 # BSD 3-Clause License # # Copyright (c) 2020-2021, Faster Speeding # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of sour...
null
v0
[ "nox.Session", "str", "str | None" ]
str | None
def v0(v1: nox.Session, v2: str, *v4: str, v3: str | None=None) -> str | None: v5 = iter(v1.posargs) v6 = {v2, *v4} for v7 in v5: if v7 in v6: return next(v5, v3)
[]
[]
[]
6
# -*- coding: utf-8 -*- # cython: language_level=3 # BSD 3-Clause License # # Copyright (c) 2020-2021, Faster Speeding # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of sour...
null
v0
[ "Tensor" ]
Tensor
def v0(self, v1: Tensor) -> Tensor: v1 = self.quant(v1) v1 = self._forward_impl(v1) v1 = self.dequant(v1) return v1
[]
[]
[]
5
from typing import Any, Type, Union, List import torch import torch.nn as nn from torch import Tensor from torch.quantization import fuse_modules from torchvision.models.resnet import Bottleneck, BasicBlock, ResNet, model_urls from ..._internally_replaced_utils import load_state_dict_from_url from .utils import _repl...
null
v5
[ "str" ]
str
def v5(v6: str) -> str: v7 = urlparse(v6) (v8, v9) = v0(v6) return 'https://{}/{}/{}'.format(v7.netloc, v8, v9)
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Tuple[str, str]", "code": "def v0(v1: str) -> Tuple[str, str]:\n v2 = urlparse(v1)\n (v3, v4) = v2.path[1:].split('/')[:2]\n return (v3, v4)", "dependencies": [] } ]
[ "urllib" ]
[ "from urllib.parse import urlparse" ]
4
import yaml import os import shutil import re import toml from typing import List, Set, Tuple, Pattern, Match from urllib.parse import urlparse from pathlib import Path CHECKOUT_DIR = "checkouts" GIT_CLONE_CMD = "git clone {{}} ./{}/{{}}/{{}}".format(CHECKOUT_DIR) RE_EXTRACT_TITLE: Pattern[str] = re.compile("([#\s]*)(...
null
v0
[ "str" ]
Tuple[str, str]
def v0(v1: str) -> Tuple[str, str]: v2 = urlparse(v1) (v3, v4) = v2.path[1:].split('/')[:2] return (v3, v4)
[]
[ "urllib" ]
[ "from urllib.parse import urlparse" ]
4
import yaml import os import shutil import re import toml from typing import List, Set, Tuple, Pattern, Match from urllib.parse import urlparse from pathlib import Path CHECKOUT_DIR = "checkouts" GIT_CLONE_CMD = "git clone {{}} ./{}/{{}}/{{}}".format(CHECKOUT_DIR) RE_EXTRACT_TITLE: Pattern[str] = re.compile("([#\s]*)(...
null
v0
[ "List[str]" ]
Any
def v0(v1: List[str]): with open('content/.gitignore', 'w') as v2: v2.write('# THIS FILE IS AUTO-GENERATED. DO NOT MODIFY BY HAND\n\n') for v3 in v1: v2.write(os.path.relpath(v3, 'content') + '\n')
[]
[ "os" ]
[ "import os" ]
5
import yaml import os import shutil import re import toml from typing import List, Set, Tuple, Pattern, Match from urllib.parse import urlparse from pathlib import Path CHECKOUT_DIR = "checkouts" GIT_CLONE_CMD = "git clone {{}} ./{}/{{}}/{{}}".format(CHECKOUT_DIR) RE_EXTRACT_TITLE: Pattern[str] = re.compile("([#\s]*)(...
null
v61
[ "str", "str", "str", "dict", "bool", "str", "str" ]
str
def v61(v62: str, v63: str, v64: str, v65: dict={}, v66: bool=True, v67: str='', v68: str='') -> str: v69 = os.path.basename(v63) v70 = os.path.join(v64, v69) v71 = os.path.abspath(os.path.join('content/docs/latest', v70)) v72 = Path(os.path.dirname(v71)) v72.mkdir(parents=True, exist_ok=True) v...
[ { "name": "v0", "input_types": [ "str", "str", "str", "str", "str" ], "output_type": "str", "code": "def v0(v1: str, v2: str, v3: str, v4: str, v5: str) -> str:\n if v1.startswith(os.path.sep):\n v6 = v1[1:]\n else:\n v7 = os.path.dirname(v3)\n ...
[ "os", "pathlib", "shutil" ]
[ "import os", "import shutil", "from pathlib import Path" ]
22
import yaml import os import shutil import re import toml from typing import List, Set, Tuple, Pattern, Match from urllib.parse import urlparse from pathlib import Path CHECKOUT_DIR = "checkouts" GIT_CLONE_CMD = "git clone {{}} ./{}/{{}}/{{}}".format(CHECKOUT_DIR) RE_EXTRACT_TITLE: Pattern[str] = re.compile("([#\s]*)(...
null
v0
[ "str", "str", "str", "str", "str" ]
str
def v0(v1: str, v2: str, v3: str, v4: str, v5: str) -> str: if v1.startswith(os.path.sep): v6 = v1[1:] else: v7 = os.path.dirname(v3) v6 = os.path.join(v7, v1) v8 = os.path.join(v2, v6) v9 = Path(os.path.join('./static/img/checkouts', v4, v5, v6)) v9.parent.mkdir(parents=True...
[]
[ "os", "pathlib", "shutil" ]
[ "import os", "import shutil", "from pathlib import Path" ]
12
import yaml import os import shutil import re import toml from typing import List, Set, Tuple, Pattern, Match from urllib.parse import urlparse from pathlib import Path CHECKOUT_DIR = "checkouts" GIT_CLONE_CMD = "git clone {{}} ./{}/{{}}/{{}}".format(CHECKOUT_DIR) RE_EXTRACT_TITLE: Pattern[str] = re.compile("([#\s]*)(...
null
v0
[ "'TreeNode'", "'TreeNode'", "'TreeNode'" ]
'TreeNode'
def v0(self, v1: 'TreeNode', v2: 'TreeNode', v3: 'TreeNode') -> 'TreeNode': if v2.val <= v1.val <= v3.val or v3.val <= v1.val <= v2.val: return v1 if v1.val < v2.val and v1.val < v3.val: return self.lowestCommonAncestor(v1.right, v2, v3) if v1.val > v2.val and v1.val > v3.val: return...
[]
[]
[]
7
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': # 介于二者之间 if p.val <= root.val <= q.val or q.val <= root.val <= p.val: ...
null
v0
[ "int", "Optional[Dict[str, Any]]" ]
MultipartParameters
def v0(v1: int, v2: Optional[Dict[str, Any]]=None) -> MultipartParameters: v3: Dict[str, Any] = {'type': v1} if v2 is not None: v3['data'] = v2 return MultipartParameters(payload=v3, multipart=None, files=None)
[]
[ "http" ]
[ "from ..http import Route, handle_message_parameters, MultipartParameters, HTTPClient" ]
5
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz 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 the rights to use, copy, modify, merg...
null
v3
[ "str" ]
v0
def v3(self, v4: str) -> v0: v5 = self.conn.get('/ncc/ads/' + v4) return v5
[]
[]
[]
3
from nevada.Common.Connector import * from typing import List import jsonpickle import json class AdFieldObject: def __init__(self, json_def=None): if type(json_def) is str: json_def = json.loads(json_def) s = json_def self.pc_display = None if 'pc' not in s else self.pc_display...
[ "class v0:\n\n def __init__(self, v1):\n if type(v1) is str:\n v1 = json.loads(v1)\n v2 = v1\n self.ad = None if 'ad' not in v2 else AdFieldObject(v2['ad'])\n self.adattr = None if 'adattr' not in v2 else v2['adattr']\n self.customerId = None if 'customerId' not in v...
v0
[ "str" ]
Any
def v0(self, v1: str): self.conn.delete('/ncc/ads/' + v1) return True
[]
[]
[]
3
from nevada.Common.Connector import * from typing import List import jsonpickle import json class AdFieldObject: def __init__(self, json_def=None): if type(json_def) is str: json_def = json.loads(json_def) s = json_def self.pc_display = None if 'pc' not in s else self.pc_display...
null
v3
[ "str", "str", "bool" ]
v0
def v3(self, v4: str, v5: str, v6: bool) -> v0: v7 = {'ids': v4, 'targetAdgroupId': v5, 'userLock': v6} v8 = self.conn.put('/ncc/ads', None, v7) return v8
[]
[]
[]
4
from nevada.Common.Connector import * from typing import List import jsonpickle import json class AdFieldObject: def __init__(self, json_def=None): if type(json_def) is str: json_def = json.loads(json_def) s = json_def self.pc_display = None if 'pc' not in s else self.pc_display...
[ "class v0:\n\n def __init__(self, v1):\n if type(v1) is str:\n v1 = json.loads(v1)\n v2 = v1\n self.ad = None if 'ad' not in v2 else AdFieldObject(v2['ad'])\n self.adattr = None if 'adattr' not in v2 else v2['adattr']\n self.customerId = None if 'customerId' not in v...
v0
[ "types.Message" ]
str
def v0(v1: types.Message) -> str: try: v2 = v1.text.split(' ')[-1] except KeyError: v2 = None return v2
[]
[]
[]
6
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
null
v0
[ "types.Message" ]
None
async def v0(self, v1: types.Message) -> None: v2 = 'Stay up-to-date on LIGO/Virgo gravitational wave events!\n\nYou can /subscribe to automatically receive a message whenever a new event is measured, or an existing event is updated. Use /unsubscribe to stop receiving messages.\n\nFurthermore you can check out the ...
[]
[]
[]
3
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
null
v0
[ "types.Message" ]
None
async def v0(self, v1: types.Message) -> None: v2 = list(self.events.latest)[0] await self.send_event_info(v1.chat.id, v2)
[]
[]
[]
3
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
null
v0
[ "types.CallbackQuery" ]
None
async def v0(self, v1: types.CallbackQuery) -> None: await v1.answer() v2 = v1.data logging.debug(f'answer_data={v2}') v3 = v1.from_user.id v4 = self.event_keyboards[v3].visible_keys if v2 in v4: (v5, v6) = v2.split('_') await self.send_event_info(v3, v5) else: await ...
[]
[ "logging" ]
[ "import logging" ]
11
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
null
v0
[ "types.Message" ]
None
async def v0(self, v1: types.Message) -> None: v2 = Counter([info['most_likely'] for v3 in self.events.data.values()]) v4 = v2['BBH'] v5 = v2['BNS'] v6 = v2['NSBH'] v7 = v2['MassGap'] v8 = v2['Terrestrial'] v9 = f'Observational run 3 has detected *{len(self.events.data)}* events since April ...
[]
[ "collections" ]
[ "from collections import Counter, defaultdict" ]
9
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
null
v0
[ "types.Message" ]
None
async def v0(self, v1: types.Message) -> None: v2 = v1.chat.id if not self.subscribers.is_in_list(v2): await self.send_message(v2, 'You are not subscribed.') else: self.subscribers.remove(v1.chat.id) await self.send_message(v2, 'You will no longer receive the latest event updates.')
[]
[]
[]
7
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
null
v0
[ "Callable[[list[list[int]]], None]", "tuple[list[list[int]]]", "list[list[int]]" ]
None
def v0(v1: Callable[[list[list[int]]], None], v2: tuple[list[list[int]]], v3: list[list[int]]) -> None: (v4,) = v2 v1(v4) assert v4 == v3, (v4, v3)
[]
[]
[]
4
from typing import Callable class Solution: def setZeroes(self, matrix: list[list[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" first_column_zero = False for row in matrix: for j, cell in enumerate(row): if cell != 0: ...
null
v0
[ "list[list[int]]" ]
None
def v0(self, v1: list[list[int]]) -> None: v2 = False for v3 in v1: for (v4, v5) in enumerate(v3): if v5 != 0: continue v3[0] = 0 if v4 == 0: v2 = True else: v1[0][v4] = 0 for (v6, v3) in enumerate(v1[1:]...
[]
[]
[]
24
from typing import Callable class Solution: def setZeroes(self, matrix: list[list[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" first_column_zero = False for row in matrix: for j, cell in enumerate(row): if cell != 0: ...
null
v0
[ "TapasTokenizer", "Any" ]
Any
def v0(self, v1: TapasTokenizer, v2=5): v3 = [v1.decode([i], clean_up_tokenization_spaces=False) for v4 in range(len(v1))] if v2 == 0: v5 = {} else: v5 = {v3[0]: [v3[tok] for v6 in range(1, v2)]} v7 = pd.DataFrame.from_dict(v5) return v7
[]
[ "pandas" ]
[ "import pandas as pd" ]
8
# 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
[ "TapasTokenizer", "Any" ]
Any
def v0(self, v1: TapasTokenizer, v2=5): v3 = [v1.decode([i], clean_up_tokenization_spaces=False) for v4 in range(len(v1))] v5 = self.get_table(v1, length=v2 - 3) v6 = ' '.join(v3[:3]) return (v5, v6)
[]
[]
[]
5
# 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
[ "TapasTokenizer", "Any", "Any", "Any", "bool", "bool", "bool" ]
Any
def v0(self, v1: TapasTokenizer, v2=False, v3=20, v4=5, v5: bool=False, v6: bool=True, v7: bool=False): v8 = [v1.decode([i], clean_up_tokenization_spaces=False) for v9 in range(len(v1))] if v5: v10 = pd.DataFrame.from_dict({}) v11 = ' '.join(v8[:v4]) else: v12 = {v8[0]: [v8[tok] for ...
[]
[ "pandas" ]
[ "import pandas as pd" ]
16
# 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
[ "str" ]
os.path
def v0(v1: str) -> os.path: try: v2 = sys._MEIPASS except AttributeError: v2 = os.path.abspath('.') return os.path.join(v2, v1)
[]
[ "os", "sys" ]
[ "import os", "import sys" ]
6
from PyQt5.QtGui import QImage, QTextDocument, QIcon, QKeySequence, QFont from PyQt5.QtWidgets import QTextEdit, QApplication, QMainWindow, QAction, QMessageBox, QVBoxLayout, QWidget, \ QStatusBar, QToolBar, QFontComboBox, QComboBox, QActionGroup, QFileDialog, QColorDialog, QDialog, QStyle from PyQt5.QtCore import ...
null
v6
[ "Dict[str, Any]", "bool", "bool" ]
None
def v6(v7: Dict[str, Any], v8: bool=False, v9: bool=False) -> None: v10 = {'service': {'security': {'transport_encryption': {'enabled': v8, 'allow_plaintext': v9}}}} v0(v7, v10)
[ { "name": "v0", "input_types": [ "Dict[str, Any]", "Dict[str, Any]" ], "output_type": "None", "code": "def v0(v1: Dict[str, Any], v2: Dict[str, Any]) -> None:\n with tempfile.NamedTemporaryFile('w', suffix='.json') as v3:\n v4 = v3.name\n log.info('Writing updated op...
[ "json", "tempfile" ]
[ "import json", "import tempfile" ]
3
import json import logging import pytest import tempfile from typing import Any, Dict, Iterator, Optional import sdk_cmd import sdk_install import sdk_jobs import sdk_plan import sdk_utils from security import transport_encryption from tests import config log = logging.getLogger(__name__) @pytest.fixture(scope="m...
null
v0
[ "str" ]
Any
def v0(self, v1: str): if v1 not in self.channel_names: raise ValueError(f'Channel {v1} not foundin channel names') else: return tuple((i for (v2, v3) in enumerate(self.channel_names) if v3 == v1))
[]
[]
[]
5
from datetime import timedelta from typing import Any, Dict, Optional, Sequence from physlearn.names import DataBaseName, LabelType, NonSignalDataType, SignalType from physlearn.typing import Array class Signal: """A signal base class. Args: start_time: The time from the beginning of the record until ...
null
v1
[ "Callable[[v0], Any]", "v0" ]
v0
def v1(v2: Callable[[v0], Any], v3: v0) -> v0: v2(v3) return v3
[]
[]
[]
3
from __future__ import annotations import inspect import sys from functools import partial, reduce from importlib import import_module from operator import attrgetter, not_ from textwrap import dedent from types import MethodType from typing import Any, Callable, Dict, Generic, TypeVar, Union, overload from .utils im...
[ "v0 = TypeVar('_T')" ]
v0
[ "Any" ]
bool
def v0(self, v1) -> bool: try: v2 = self.get(v1) return True except ValueError: return False
[]
[]
[]
6
import sys sys.path.insert(0, '../linked_list') from link_list import LinkList # noqa E402 import json # noqa E402 class HashTable(): # Big O time == O(1) # :: worst case is O(n), if small hash array or terrible collisions # storage for HashTable _data = [] def __init__(self, hashtableSize=102...
null
v0
[ "Any" ]
bool
def v0(v1) -> bool: try: json.loads(str(v1).replace("'", '"')) return True except Exception: return False
[]
[ "json" ]
[ "import json" ]
6
from enum import Enum import pandas as pd from typing import Dict import json class SupportedDataTypes(Enum): number_type = 1 string_type = 2 list_type = 3 bool_type = 4 def is_bool(value) -> bool: return str(value).lower() in ["true", "false"] def is_number(value) -> bool: try: fl...
null
v19
[ "str" ]
v0
def v19(self, v20: str) -> v0: self.description = v20 return self
[]
[]
[]
3
# Auto-generated at 2021-09-27T17:12:33.419763+08:00 # from: Justice Lobby Service (1.33.0) # Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # pylint: disable=duplicate-code # pylin...
[ "class v0(Model):\n v1: str\n v2: str\n\n def v3(self, v4: str) -> v0:\n self.description = v4\n return self\n\n def v5(self, v6: str) -> v0:\n self.topic = v6\n return self\n\n def v7(self, v8: bool=False) -> dict:\n v9 = {}\n if hasattr(self, 'description')...
v19
[ "str" ]
v0
def v19(self, v20: str) -> v0: self.message = v20 return self
[]
[]
[]
3
# Auto-generated at 2021-09-27T17:12:31.712498+08:00 # from: Justice Iam Service (4.1.0) # Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # pylint: disable=duplicate-code # pylint: ...
[ "class v0(Model):\n v1: int\n v2: str\n\n def v3(self, v4: int) -> v0:\n self.code = v4\n return self\n\n def v5(self, v6: str) -> v0:\n self.message = v6\n return self\n\n def v7(self, v8: bool=False) -> dict:\n v9 = {}\n if hasattr(self, 'code') and self.co...
v0
[ "bool" ]
dict
def v0(self, v1: bool=False) -> dict: v2 = {} if hasattr(self, 'description') and self.description: v2['description'] = str(self.description) elif v1: v2['description'] = str() if hasattr(self, 'topic') and self.topic: v2['topic'] = str(self.topic) elif v1: v2['topic'...
[]
[]
[]
11
# Auto-generated at 2021-09-27T17:12:33.419763+08:00 # from: Justice Lobby Service (1.33.0) # Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # pylint: disable=duplicate-code # pylin...
null
v0
[ "list", "bool", "int" ]
Any
def v0(v1: list, v2: bool=True, v3: int=math.inf): assert type(v1) == list, 'Raw Data should be in list data type' print(v3) v4 = list() for v5 in v1: if v2: v6 = word_tokenize(v5) else: v6 = ['<sos>'] + v5.split(' ') + ['<eos>'] v4.append(v6) if l...
[]
[ "nltk" ]
[ "from nltk import word_tokenize" ]
13
import codecs import math from Model.EngHindiDataPreprocess import config, EnglishTokenizer as ENG_Tok, HindiTokenizer as HIN_TOK, \ IndicTokenizer as IND_TOK from nltk import word_tokenize from Model.EngHindiDataPreprocess import config def load_data_sp(path): with codecs.open(path, encoding='utf-8') as f: ...
null
v0
[ "list" ]
Any
def v0(v1: list): global max_length for v2 in v1: if len(v2) > max_length: v3 = len(v2)
[]
[]
[]
5
import codecs import math from Model.EngHindiDataPreprocess import config, EnglishTokenizer as ENG_Tok, HindiTokenizer as HIN_TOK, \ IndicTokenizer as IND_TOK from nltk import word_tokenize from Model.EngHindiDataPreprocess import config def load_data_sp(path): with codecs.open(path, encoding='utf-8') as f: ...
null
v0
[]
Optional[str]
def v0(self) -> Optional[str]: if self.token_provider: return self.token_provider.get_token() elif self.tenant_id and self.client_id and self.secret and self.kusto_cluster_name and self.kusto_database_name and self.kusto_info_log_table and self.kusto_warning_log_table and self.kusto_error_log_table: ...
[]
[]
[]
8
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. import msal from typing import Optional, TYPE_CHECKING from cdm.enums import EnvironmentType, AzureCloudEndpoint if TYPE_CHECKING: from cdm.utilities.network....
null
v0
[]
Optional[dict]
def v0(self) -> Optional[dict]: v1 = ['https://{0}.kusto.windows.net/.default'.format(self.kusto_cluster_name)] self._build_context() v2 = self._context.acquire_token_for_client(scopes=v1) if v2 and 'error' in v2: v3 = v2['error'] if 'error_description' in v2: v3 += ' error_d...
[]
[]
[]
12
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. import msal from typing import Optional, TYPE_CHECKING from cdm.enums import EnvironmentType, AzureCloudEndpoint if TYPE_CHECKING: from cdm.utilities.network....
null
v0
[ "bytes" ]
Any
def v0(self, v1: bytes): if self.anonymous: return (None, None) if self.key_type == 'ed25519': v2 = self.sk.sign(v1) return (self._der_pubkey, v2) elif self.key_type == 'secp256k1': v2 = self.sk.sign(v1) return (self._der_pubkey, v2)
[]
[]
[]
9
import hashlib from ecdsa.curves import Ed25519, SECP256k1 from .principal import Principal import ecdsa class Identity: def __init__(self, privkey = "", type = "ed25519", anonymous = False): privkey = bytes(bytearray.fromhex(privkey)) self.anonymous = anonymous if anonymous: r...
null
v0
[ "Any" ]
bool
def v0(self, v1) -> bool: v2 = {} v3 = v1.mkldnn_enabled() v2['use_mkldnn'] = v3 v4 = v1.use_gpu() return str(v2)
[]
[]
[]
6
# Copyright (c) 2021 PaddlePaddle Authors. 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 appli...
null
v0
[]
bool
def v0(self) -> bool: for v1 in self.valid_places: if self.get_target() in v1[0]: return True return False
[]
[]
[]
5
# Copyright (c) 2021 PaddlePaddle Authors. 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 appli...
null
v0
[]
Tuple[Optional[str], Any]
def v0(self) -> Tuple[Optional[str], Any]: v1 = self._step() self.finished = True return v1
[]
[]
[]
4
""" Copyright (c) Facebook, Inc. and its affiliates. """ import logging from typing import Dict, Tuple, Any, Optional from .dialogue_object import DialogueObject from memory_nodes import ObjectNode, RewardNode from .interpreter_helper import interpret_reference_object, ErrorWithResponse class PutMemoryHandler(Dialo...
null
v0
[]
Tuple[Optional[str], Any]
def v0(self) -> Tuple[Optional[str], Any]: assert self.action_dict['dialogue_type'] == 'PUT_MEMORY' v1 = self.action_dict['upsert']['memory_data']['memory_type'] if v1 == 'REWARD': return self.handle_reward() elif v1 == 'TRIPLE': return self.handle_triple() else: raise NotImp...
[]
[]
[]
9
""" Copyright (c) Facebook, Inc. and its affiliates. """ import logging from typing import Dict, Tuple, Any, Optional from .dialogue_object import DialogueObject from memory_nodes import ObjectNode, RewardNode from .interpreter_helper import interpret_reference_object, ErrorWithResponse class PutMemoryHandler(Dialo...
null