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
v8
[ "str" ]
time
def v8(v9: str) -> time: try: return v0(v9) except (TypeError, ValueError) as e: return time.fromisoformat(v9)
[ { "name": "v0", "input_types": [ "str" ], "output_type": "time", "code": "def v0(v1: str) -> time:\n if not isinstance(v1, str):\n raise TypeError(f'timestring must be a string, got {type(v1)}')\n v2 = 'AM'\n v3 = []\n v1 = v1.split(' ')\n if len(v1) > 1:\n v2 ...
[ "datetime" ]
[ "from datetime import date, datetime, time, timedelta" ]
5
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
null
v0
[ "str" ]
time
def v0(v1: str) -> time: if not isinstance(v1, str): raise TypeError(f'timestring must be a string, got {type(v1)}') v2 = 'AM' v3 = [] v1 = v1.split(' ') if len(v1) > 1: v2 = v1[1] v3 = v1[0].split(':') if len(v3) > 4: raise ValueError(f'Failed to parse timestring {v1...
[]
[ "datetime" ]
[ "from datetime import date, datetime, time, timedelta" ]
25
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
null
v21
[ "v1", "v0" ]
datetime
def v21(v22: v1, v23: v0) -> datetime: v24: dict[str, float] = {} if isinstance(v23, str): v23 = v9(v23) v24 = v2(v23) elif isinstance(v23, time): v24 = v2(v23) else: v24 = v2(v19(v23).time()) return v19(v22).replace(**v24)
[ { "name": "v2", "input_types": [ "v0" ], "output_type": "dict[str, float]", "code": "def v2(v3: v0) -> dict[str, float]:\n v4 = ['year', 'month', 'day']\n v5 = ['hour', 'minute', 'second', 'microsecond']\n v6 = []\n if isinstance(v3, str):\n v3 = read_timestring(v3)\n ...
[ "datetime", "numpy", "pandas" ]
[ "from datetime import date, datetime, time, timedelta", "import numpy as np", "import pandas as pd" ]
10
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
[ "v0 = Union[DatetimeLike, time]", "v1 = Union[pd.Timestamp, np.datetime64, date, datetime, str]" ]
v4
[ "v0" ]
str
def v4(v5: v0) -> str: if not isinstance(v5, time): v5 = v2(v5).time() v6 = 'AM' v7 = v5.hour v8 = v5.minute if v5.minute > 9 else f'0{v5.minute}' if v7 > 12: v6 = 'PM' v7 -= 12 return f'{v7}:{v8} {v6}'
[ { "name": "v2", "input_types": [ "v1" ], "output_type": "datetime", "code": "def v2(v3: v1) -> datetime:\n if isinstance(v3, datetime):\n return v3\n elif isinstance(v3, pd.Timestamp):\n return v3.to_pydatetime()\n elif isinstance(v3, np.datetime64):\n return ...
[ "datetime", "numpy", "pandas" ]
[ "from datetime import date, datetime, time, timedelta", "import numpy as np", "import pandas as pd" ]
10
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
[ "v0 = Union[DatetimeLike, time]", "v1 = Union[pd.Timestamp, np.datetime64, date, datetime, str]" ]
v1
[ "v0" ]
datetime
def v1(v2: v0) -> datetime: if isinstance(v2, datetime): return v2 elif isinstance(v2, pd.Timestamp): return v2.to_pydatetime() elif isinstance(v2, np.datetime64): return pd.Timestamp(v2).to_pydatetime() elif isinstance(v2, date): return datetime.combine(v2, datetime.min....
[]
[ "datetime", "numpy", "pandas" ]
[ "from datetime import date, datetime, time, timedelta", "import numpy as np", "import pandas as pd" ]
12
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
[ "v0 = Union[pd.Timestamp, np.datetime64, date, datetime, str]" ]
v25
[ "datetime", "Union[v0, timedelta, float]" ]
timedelta
def v25(v26: datetime, v27: Union[v0, timedelta, float]) -> timedelta: if isinstance(v27, str): try: v27 = v19(v26, v9(v27)) except ValueError: v27 = datetime.fromisoformat(v27) elif isinstance(v27, time): v27 = v19(v26, v27) elif isinstance(v27, (float, int))...
[ { "name": "v2", "input_types": [ "v0" ], "output_type": "dict[str, float]", "code": "def v2(v3: v0) -> dict[str, float]:\n v4 = ['year', 'month', 'day']\n v5 = ['hour', 'minute', 'second', 'microsecond']\n v6 = []\n if isinstance(v3, str):\n v3 = read_timestring(v3)\n ...
[ "datetime", "numpy", "pandas" ]
[ "from datetime import date, datetime, time, timedelta", "import numpy as np", "import pandas as pd" ]
17
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
[ "v0 = Union[DatetimeLike, time]", "v1 = Union[pd.Timestamp, np.datetime64, date, datetime, str]" ]
v11
[ "v0" ]
time
def v11(v12: v0) -> time: if isinstance(v12, str): return v1(v12) elif isinstance(v12, time): return v12 raise TypeError(f'Can not convert passed object {v12} to python time')
[ { "name": "v1", "input_types": [ "str" ], "output_type": "time", "code": "def v1(v2: str) -> time:\n try:\n return read_twelve_hour_timestring(v2)\n except (TypeError, ValueError) as e:\n return time.fromisoformat(v2)", "dependencies": [ "v3" ] }, { ...
[ "datetime" ]
[ "from datetime import date, datetime, time, timedelta" ]
6
# -*- coding: utf-8 -*- """Standard utility functions used throughout AlphaGradient""" # Standard Imports from __future__ import annotations from abc import ABC, abstractmethod import builtins from datetime import ( date, datetime, time, timedelta, ) import math from pathlib import Path # Third Party...
[ "v0 = Union[time, str]" ]
v0
[ "List[str]" ]
None
def v0(self, v1: List[str]) -> None: print('Command:', v1) subprocess.check_call(v1)
[]
[ "subprocess" ]
[ "import subprocess" ]
3
import distutils.ccompiler import os import os.path import platform import shutil import sys import subprocess from typing import Optional, List import setuptools import setuptools.msvc from setuptools import Extension from cupy_builder._context import Context import cupy_builder.install_build as build def _nvcc_ge...
null
v23
[ "v0" ]
str
def v23(v24: v0) -> str: v25 = v24.create_update_generator(collection_name='compromised/mule', limit=10) v25.__next__() return 'ok'
[]
[]
[]
4
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * """ IMPORTS """ from typing import Dict, Generator, List, Optional, Tuple, Union import dateparser import urllib3 # Disable insecure warnings urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ''' CON...
[ "class v0(BaseClient):\n\n def v1(self, v2: str, v3: Optional[str]=None, v4: Union[int, str]=None, v5: int=200) -> Generator:\n \"\"\"\n Creates generator of lists with feeds class objects for an update session\n (feeds are sorted in ascending order) `collection_name` with set parameters.\n\...
v0
[ "List" ]
Dict
def v0(v1: List) -> Dict: v2: Dict[str, Any] = {} for v3 in v1: v3 = v3.get('rawJSON') v4 = v3.get('type') if v4 == 'CVE': del v3['gibsoftwaremixed'] if v2.get(v4) is None: v2[v4] = [v3] else: v2[v4].append(v3) return v2
[]
[]
[]
12
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * """ IMPORTS """ from typing import Dict, Generator, List, Optional, Tuple, Union import dateparser import urllib3 # Disable insecure warnings urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ''' CON...
null
v0
[ "str", "Optional[str]", "Union[int, str]", "int" ]
Generator
def v0(self, v1: str, v2: Optional[str]=None, v3: Union[int, str]=None, v4: int=200) -> Generator: while True: v5 = {'df': v2, 'limit': v4, 'seqUpdate': v3} v5 = {key: value for (v6, v7) in v5.items() if v7} v8 = self._http_request(method='GET', url_suffix=v1 + '/updated', params=v5, timeout...
[]
[]
[]
10
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * """ IMPORTS """ from typing import Dict, Generator, List, Optional, Tuple, Union import dateparser import urllib3 # Disable insecure warnings urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ''' CON...
null
v0
[ "str", "str" ]
Dict
def v0(self, v1: str, v2: str) -> Dict: v3 = self._http_request(method='GET', url_suffix=v1 + '/' + v2, timeout=60.0, retries=4, status_list_to_retry=[429, 500]) return v3
[]
[]
[]
3
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * """ IMPORTS """ from typing import Dict, Generator, List, Optional, Tuple, Union import dateparser import urllib3 # Disable insecure warnings urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ''' CON...
null
v0
[ "int", "bool", "bool" ]
Any
def v0(self, v1: int, v2: bool, v3: bool): self.left_blinker_cnt = v1 if v2 else max(self.left_blinker_cnt - 1, 0) self.right_blinker_cnt = v1 if v3 else max(self.right_blinker_cnt - 1, 0) return (self.left_blinker_cnt > 0, self.right_blinker_cnt > 0)
[]
[]
[]
4
import os import time from cereal import car from common.kalman.simple_kalman import KF1D from common.realtime import DT_CTRL from selfdrive.car import gen_empty_fingerprint from selfdrive.config import Conversions as CV from selfdrive.controls.lib.events import Events from selfdrive.controls.lib.vehicle_model import V...
null
v0
[ "list" ]
tuple
def v0(v1: list) -> tuple: v2 = v1[0] v3 = v1[1] v4 = v1[2] if v2 < v3: return (v2, (v3, v4)) else: return (v3, (v2, v4))
[]
[]
[]
8
from pyspark import SparkContext import sys import time # Put node with smaller id as src of edge and node with bigger id as dst. def reOrderingSrcAndDstOfEgde(x:list)-> tuple: src = x[0] dst = x[1] probability = x[2] if src < dst: return (src,(dst,probability)) else: return (dst...
null
v0
[]
typing.Any
async def v0() -> typing.Any: v1 = await self.stream_send.receive() if v1 is None: self.task.result() return v1
[]
[]
[]
5
import asyncio import contextlib import http import inspect import io import json import math import queue import sys import types import typing from concurrent.futures import Future from urllib.parse import unquote, urljoin, urlsplit import anyio.abc import requests from anyio.streams.stapled import StapledObjectStre...
null
v0
[ "typing.Type[event_manager_.EventT_co]", "typing.Union[float, int, None]", "typing.Optional[event_manager_.PredicateT[event_manager_.EventT_co]]" ]
event_manager_.EventT_co
async def v0(self, v1: typing.Type[event_manager_.EventT_co], /, v2: typing.Union[float, int, None], v3: typing.Optional[event_manager_.PredicateT[event_manager_.EventT_co]]=None) -> event_manager_.EventT_co: self._check_if_alive() return await self._event_manager.wait_for(v1, timeout=v2, predicate=v3)
[]
[]
[]
3
# -*- coding: utf-8 -*- # cython: language_level=3 # Copyright (c) 2020 Nekokatt # Copyright (c) 2021-present davfsa # # 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, inc...
null
v0
[ "snowflakes.SnowflakeishOr[guilds.PartialGuild]", "typing.Optional[snowflakes.SnowflakeishOr[channels.GuildVoiceChannel]]", "undefined.UndefinedOr[bool]", "undefined.UndefinedOr[bool]" ]
None
async def v0(self, v1: snowflakes.SnowflakeishOr[guilds.PartialGuild], v2: typing.Optional[snowflakes.SnowflakeishOr[channels.GuildVoiceChannel]], *, v3: undefined.UndefinedOr[bool]=undefined.UNDEFINED, v4: undefined.UndefinedOr[bool]=undefined.UNDEFINED) -> None: self._check_if_alive() v5 = self._get_shard(v1)...
[]
[]
[]
4
# -*- coding: utf-8 -*- # cython: language_level=3 # Copyright (c) 2020 Nekokatt # Copyright (c) 2021-present davfsa # # 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, inc...
null
v0
[ "snowflakes.SnowflakeishOr[guilds.PartialGuild]", "undefined.UndefinedOr[bool]", "str", "int", "undefined.UndefinedOr[snowflakes.SnowflakeishSequence[users_.User]]", "undefined.UndefinedOr[str]" ]
None
async def v0(self, v1: snowflakes.SnowflakeishOr[guilds.PartialGuild], *, v2: undefined.UndefinedOr[bool]=undefined.UNDEFINED, v3: str='', v4: int=0, v5: undefined.UndefinedOr[snowflakes.SnowflakeishSequence[users_.User]]=undefined.UNDEFINED, v6: undefined.UndefinedOr[str]=undefined.UNDEFINED) -> None: self._check_...
[]
[]
[]
4
# -*- coding: utf-8 -*- # cython: language_level=3 # Copyright (c) 2020 Nekokatt # Copyright (c) 2021-present davfsa # # 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, inc...
null
v1
[ "Optional[v0]" ]
Optional[v0]
def v1(self, v2: Optional[v0]=None) -> Optional[v0]: if len(self.items) > 0: return self.items[-1] return v2
[]
[]
[]
4
from typing import Generic, TypeVar, List, Optional T = TypeVar('T') class Stack(Generic[T]): def __init__(self): self.items: List[T] = [] def empty(self) -> bool: return len(self.items) == 0 def push(self, item: T): self.items.append(item) def pop(self) -> T: retu...
[ "v0 = TypeVar('T')" ]
v0
[ "Optional[str]" ]
Any
def v0(self, v1: Optional[str]): v2 = self._get_destination(v1) v3 = self._backend.get_image_series_values(self._container_id, self._container_type, self._path, 0, 1).totalItemCount for v4 in range(0, v3): self._backend.download_file_series_by_index(self._container_id, self._container_type, self._pa...
[]
[]
[]
5
# # Copyright (c) 2020, Neptune Labs Sp. z o.o. # # 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 agr...
null
v0
[ "Optional[str]" ]
Any
def v0(self, v1: Optional[str]): v2 = self._get_destination(v1) v3 = self._backend.get_image_series_values(self._container_id, self._container_type, self._path, 0, 1).totalItemCount if v3 > 0: self._backend.download_file_series_by_index(self._container_id, self._container_type, self._path, v3 - 1, v...
[]
[]
[]
7
# # Copyright (c) 2020, Neptune Labs Sp. z o.o. # # 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 agr...
null
v0
[ "Optional[str]" ]
Any
def v0(self, v1: Optional[str]): v2 = v1 if v1 is None: v2 = os.path.join('neptune', self._path[-1]) pathlib.Path(os.path.abspath(v2)).mkdir(parents=True, exist_ok=True) return v2
[]
[ "os", "pathlib" ]
[ "import os", "import pathlib" ]
6
# # Copyright (c) 2020, Neptune Labs Sp. z o.o. # # 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 agr...
null
v27
[ "biom.Table", "int", "int", "int", "int", "qiime2.Metadata", "str", "bool" ]
biom.Table
def v27(v28: biom.Table, v29: int=0, v30: int=None, v31: int=0, v32: int=None, v33: qiime2.Metadata=None, v34: str=None, v35: bool=False) -> biom.Table: v0(table=v28, min_frequency=v29, max_frequency=v30, min_nonzero=v31, max_nonzero=v32, metadata=v33, where=v34, axis='observation', exclude_ids=v35) return v28
[ { "name": "v0", "input_types": [ "Any", "Any", "Any", "Any", "Any", "Any", "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3, v4, v5, v6, v7, v8, v9=False):\n if v2 == 0 and v3 is None and (v4 == 0) and (v5 is None) a...
[ "numpy" ]
[ "import numpy as np" ]
3
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2020, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
null
v0
[ "pd.Series", "biom.Table", "qiime2.Metadata", "str", "bool" ]
pd.Series
def v0(v1: pd.Series, v2: biom.Table=None, v3: qiime2.Metadata=None, v4: str=None, v5: bool=False) -> pd.Series: if v2 is not None and v3 is not None: raise ValueError('Filtering with metadata and filtering with a table are mutually exclusive.') elif v2 is None and v3 is None: raise ValueError('...
[]
[]
[]
15
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2020, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
null
v0
[ "str", "str" ]
None
def v0(v1: str, v2: str) -> None: (v3, v4) = os.path.split(v2) while True: v5 = os.path.join(v3, '.{}.{:010x}'.format(v4, random.randrange(1 << 40))) try: os.symlink(v1, v5) except FileExistsError: continue break try: os.rename(v5, v2) exce...
[]
[ "os", "random" ]
[ "import os", "import random" ]
14
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "str" ]
argparse.Namespace
def v0(v1: str) -> argparse.Namespace: v2 = argparse.ArgumentParser(description=v1) v2.add_argument('--threshold', dest='threshold_days', type=int, default=14, nargs='?', metavar='<days>', help='Any cache which is not in use by a deployment not older than threshold days(current installation in dev) and older th...
[]
[ "argparse" ]
[ "import argparse" ]
9
#!/usr/bin/env python3 import argparse import datetime import functools import hashlib import logging import os import pwd import re import shlex import shutil import subprocess import sys import tempfile import time import json import uuid import configparser from typing import Sequence, Set, Any, Dict, List DEPLOYM...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = '0.0.0' for v3 in os.listdir(v1): v4 = os.path.join(v1, v3) if v3.startswith('zulip-server') and os.path.isdir(v4): with open(os.path.join(v4, 'version.py')) as v5: v6 = re.search('ZULIP_VERSION = "(.*)"', v5.read()) if v6:...
[]
[ "os", "re" ]
[ "import os", "import re" ]
11
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "str", "str" ]
bool
def v0(v1: str, v2: str) -> bool: if v2 > '1.4.3' and v1 <= '1.3.10': return True return False
[]
[]
[]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v1
[]
pwd.struct_passwd
def v1() -> pwd.struct_passwd: v2 = os.stat(v0()).st_uid if v2 != 0: return pwd.getpwuid(v2) return pwd.getpwnam('zulip')
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n return os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')))", "dependencies": [] } ]
[ "os", "pwd" ]
[ "import os", "import pwd" ]
5
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v3
[]
pwd.struct_passwd
def v3() -> pwd.struct_passwd: try: return pwd.getpwnam('postgres') except KeyError: return v1()
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n return os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')))", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "pwd.struct_passwd", ...
[ "os", "pwd" ]
[ "import os", "import pwd" ]
5
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v3
[ "bool" ]
None
def v3(v4: bool=False) -> None: v5 = v1() os.setgid(v5.pw_gid) if v4: os.setresuid(v5.pw_uid, v5.pw_uid, os.getuid()) else: os.setuid(v5.pw_uid) os.environ['HOME'] = v5.pw_dir
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n return os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')))", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "pwd.struct_passwd", ...
[ "os", "pwd" ]
[ "import os", "import pwd" ]
8
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v9
[ "bool" ]
str
def v9(v10: bool=False) -> str: v11 = v0() v12 = os.path.join(os.path.realpath(os.path.dirname(v11)), '.zulip-dev-uuid') if os.path.exists(v12): with open(v12) as v13: v14 = v13.read().strip() elif v10: v14 = str(uuid.uuid4()) v5(['sh', '-c', 'echo "$1" > "$2"', '-', ...
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n return os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')))", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "bool", "code": "de...
[ "os", "shlex", "subprocess", "sys", "uuid" ]
[ "import os", "import shlex", "import subprocess", "import sys", "import uuid" ]
14
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "str", "str" ]
None
def v0(v1: str, v2: str) -> None: v3 = os.path.dirname(v2) if not os.path.exists(v3): os.makedirs(v3) v4 = logging.Formatter('%(asctime)s: %(message)s') v5 = logging.FileHandler(v2) v5.setFormatter(v4) v6 = logging.getLogger('zulip.management') v6.addHandler(v5) v6.setLevel(loggi...
[]
[ "logging", "os" ]
[ "import logging", "import os" ]
11
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v4
[ "str", "Set[str]", "int" ]
Set[str]
def v4(v5: str, v6: Set[str], v7: int) -> Set[str]: v8 = set() v9 = v0(v7) for v10 in os.listdir(v5): v11 = os.path.join(v5, v10) if v11 in v6: continue if os.path.getctime(v11) < v9: v8.add(v11) return v8
[ { "name": "v0", "input_types": [ "int" ], "output_type": "int", "code": "def v0(v1: int) -> int:\n v2 = datetime.datetime.now() - datetime.timedelta(days=v1)\n v3 = int(time.mktime(v2.utctimetuple()))\n return v3", "dependencies": [] } ]
[ "datetime", "os" ]
[ "import datetime", "import os" ]
10
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v28
[ "str", "Set[str]", "str", "argparse.Namespace" ]
None
def v28(v29: str, v30: Set[str], v31: str, v32: argparse.Namespace) -> None: v33 = {os.path.join(v29, cache) for v34 in os.listdir(v29)} v35 = v0(v29, v30, v32.threshold_days) v36 = v33 - v35 v13(v35, v36, v31, v32.dry_run, v32.verbose, v32.no_headings) if v32.verbose: print('Done!')
[ { "name": "v0", "input_types": [ "str", "Set[str]", "int" ], "output_type": "Set[str]", "code": "def v0(v1: str, v2: Set[str], v3: int) -> Set[str]:\n v4 = set()\n v5 = get_threshold_timestamp(v3)\n for v6 in os.listdir(v1):\n v7 = os.path.join(v1, v6)\n ...
[ "datetime", "os", "shlex", "subprocess", "sys" ]
[ "import datetime", "import os", "import shlex", "import subprocess", "import sys" ]
7
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = hashlib.sha1() v3 = ['static/assets/zulip-emoji/zulip.png', 'tools/setup/emoji/emoji_map.json', 'tools/setup/emoji/build_emoji', 'tools/setup/emoji/emoji_setup_utils.py', 'tools/setup/emoji/emoji_names.py'] for v4 in v3: v5 = os.path.join(v1, v4) with open(v5, 'r...
[]
[ "hashlib", "json", "os", "re" ]
[ "import hashlib", "import json", "import os", "import re" ]
18
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v8
[ "Set[str]", "Set[str]", "str", "bool", "bool", "bool" ]
None
def v8(v9: Set[str], v10: Set[str], v11: str, v12: bool, v13: bool, v14: bool) -> None: if v12: print('Performing a dry run...') if not v14: print('Cleaning unused {}s...'.format(v11)) for v15 in v9: if v13: print('Cleaning unused {}: {}'.format(v11, v15)) if not ...
[ { "name": "v0", "input_types": [], "output_type": "bool", "code": "def v0() -> bool:\n if 'posix' in os.name and os.geteuid() == 0:\n return True\n return False", "dependencies": [] }, { "name": "v1", "input_types": [ "Sequence[str]" ], "output_type": "None...
[ "os", "shlex", "subprocess", "sys" ]
[ "import os", "import shlex", "import subprocess", "import sys" ]
13
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "Sequence[str]", "Sequence[str]" ]
str
def v0(v1: Sequence[str], v2: Sequence[str]) -> str: v3 = hashlib.sha1() for v4 in v1: with open(v4, 'rb') as v5: v3.update(v5.read()) for v6 in v2: v3.update(v6.encode('utf-8')) return v3.hexdigest()
[]
[ "hashlib" ]
[ "import hashlib" ]
8
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v23
[ "str", "Sequence[str]", "Sequence[str]" ]
bool
def v23(v24: str, v25: Sequence[str], v26: Sequence[str]=[]) -> bool: v27 = os.path.join(v8(), v24) try: with open(v27) as v28: v29 = v28.read() except FileNotFoundError: return True v30 = v0(v25, v26) return v30 != v29
[ { "name": "v0", "input_types": [ "Sequence[str]", "Sequence[str]" ], "output_type": "str", "code": "def v0(v1: Sequence[str], v2: Sequence[str]) -> str:\n v3 = hashlib.sha1()\n for v4 in v1:\n with open(v4, 'rb') as v5:\n v3.update(v5.read())\n for v6 in v2...
[ "hashlib", "os", "shlex", "subprocess", "sys", "uuid" ]
[ "import hashlib", "import os", "import shlex", "import subprocess", "import sys", "import uuid" ]
9
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v23
[ "str", "Sequence[str]", "Sequence[str]" ]
None
def v23(v24: str, v25: Sequence[str], v26: Sequence[str]=[]) -> None: v27 = os.path.join(v8(), v24) v28 = v0(v25, v26) with open(v27, 'w') as v29: v29.write(v28) print('New digest written to: ' + v27)
[ { "name": "v0", "input_types": [ "Sequence[str]", "Sequence[str]" ], "output_type": "str", "code": "def v0(v1: Sequence[str], v2: Sequence[str]) -> str:\n v3 = hashlib.sha1()\n for v4 in v1:\n with open(v4, 'rb') as v5:\n v3.update(v5.read())\n for v6 in v2...
[ "hashlib", "os", "shlex", "subprocess", "sys", "uuid" ]
[ "import hashlib", "import os", "import shlex", "import subprocess", "import sys", "import uuid" ]
6
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[]
bool
def v0() -> bool: if 'posix' in os.name and os.geteuid() == 0: return True return False
[]
[ "os" ]
[ "import os" ]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v4
[ "List[str]" ]
None
def v4(v5: List[str], **v6: Any) -> None: v7 = v6.pop('sudo_args', []) if not v0(): v5 = ['sudo', *v7, '--', *v5] v1(v5, **v6)
[ { "name": "v0", "input_types": [], "output_type": "bool", "code": "def v0() -> bool:\n if 'posix' in os.name and os.geteuid() == 0:\n return True\n return False", "dependencies": [] }, { "name": "v1", "input_types": [ "Sequence[str]" ], "output_type": "None...
[ "os", "shlex", "subprocess", "sys" ]
[ "import os", "import shlex", "import subprocess", "import sys" ]
5
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v3
[]
None
def v3() -> None: v4 = os.path.abspath(sys.argv[0]) if v2(): v5 = pwd.getpwuid(v1()) v6 = "{shortname} should not be run as root. Use `su {user}` to switch to the 'zulip'\nuser before rerunning this, or use \n su {user} -c '{name} ...'\nto switch users and run this as a single command.".format(...
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n return os.path.realpath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "int", "cod...
[ "os", "pwd", "sys" ]
[ "import os", "import pwd", "import sys" ]
7
#!/usr/bin/env python3 import argparse import datetime import hashlib import logging import os import pwd import re import shlex import shutil import subprocess import sys import tempfile import time import json import uuid import configparser if False: # See https://zulip.readthedocs.io/en/latest/testing/mypy.htm...
null
v1
[ "bool" ]
None
def v1(v2: bool=False) -> None: v3 = os.path.abspath(sys.argv[0]) if v2: v3 = v3.replace('scripts/lib/upgrade', 'scripts/upgrade') if not v0(): print('{} must be run as root.'.format(v3)) sys.exit(1)
[ { "name": "v0", "input_types": [], "output_type": "bool", "code": "def v0() -> bool:\n if 'posix' in os.name and os.geteuid() == 0:\n return True\n return False", "dependencies": [] } ]
[ "os", "sys" ]
[ "import os", "import sys" ]
7
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "configparser.RawConfigParser", "str", "str", "str" ]
str
def v0(v1: configparser.RawConfigParser, v2: str, v3: str, v4: str='') -> str: if v1.has_option(v2, v3): return v1.get(v2, v3) return v4
[]
[]
[]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "configparser.RawConfigParser", "str", "str", "str" ]
None
def v0(v1: configparser.RawConfigParser, v2: str, v3: str, v4: str) -> None: if not v1.has_section(v2): v1.add_section(v2) v1.set(v2, v3, v4)
[]
[]
[]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[]
configparser.RawConfigParser
def v0() -> configparser.RawConfigParser: v1 = configparser.RawConfigParser() v1.read('/etc/zulip/zulip.conf') return v1
[]
[ "configparser" ]
[ "import configparser" ]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v16
[ "str" ]
str
def v16(v17: str) -> str: v18 = '{}/{}'.format(v1(), v17) os.makedirs(v18, exist_ok=True) return v18
[ { "name": "v0", "input_types": [], "output_type": "str", "code": "def v0() -> str:\n return os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')))", "dependencies": [] }, { "name": "v1", "input_types": [ "bool" ], "output_type": "str"...
[ "os", "shlex", "subprocess", "sys", "uuid" ]
[ "import os", "import shlex", "import subprocess", "import sys", "import uuid" ]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = SplitResult('', v1, '', '', '') assert v2.hostname is not None return '[' + v2.hostname + ']' if ':' in v2.hostname else v2.hostname
[]
[ "urllib" ]
[ "from urllib.parse import SplitResult" ]
4
#!/usr/bin/env python3 import argparse import configparser import datetime import functools import hashlib import json import logging import os import pwd import random import re import shlex import shutil import subprocess import sys import time import uuid from typing import Any, Dict, List, Sequence, Set from urllib...
null
v0
[ "str", "discord.Embed", "typing.List[discord.Embed]", "bool", "discord.File", "typing.List[discord.File]", "discord.AllowedMentions", "bool", "float", "typing.List[dict]" ]
model.SlashMessage
async def v0(self, v1: str='', *, v2: discord.Embed=None, v3: typing.List[discord.Embed]=None, v4: bool=False, v5: discord.File=None, v6: typing.List[discord.File]=None, v7: discord.AllowedMentions=None, v8: bool=False, v9: float=None, v10: typing.List[dict]=None) -> model.SlashMessage: if self.deferred and self._d...
[]
[]
[]
4
import datetime import typing from typing import TYPE_CHECKING from warnings import warn import discord from discord.ext import commands from discord.utils import snowflake_time from . import error, http, model from .dpy_overrides import ComponentMessage if TYPE_CHECKING: # circular import sucks for typehinting ...
null
v14
[ "v0", "Optional[int]" ]
bool
def v14(v15: v0, v16: Optional[int]) -> bool: if v16 is None: return False v17 = v15.epoch_idx % v16 == 0 v18 = v15.edge_path_idx == 0 v19 = v15.edge_chunk_idx == 0 return v17 and v18 and v19
[]
[]
[]
7
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE.txt file in the root directory of this source tree. import logging import math import time from collections import defaultdict from funct...
[ "class v0(MetadataProvider):\n\n def __init__(self, v1: int, v2: List[str], v3: int, *, v4: int=0) -> None:\n self.num_epochs = v1\n self.edge_paths = v2\n self.num_edge_chunks = v3\n self.iteration_idx = v4\n\n @property\n def v5(self) -> int:\n return self.iteration_idx...
v0
[]
None
def v0(self) -> None: if self.barrier_group is not None: td.barrier(group=self.barrier_group)
[]
[ "torch" ]
[ "import torch", "import torch.distributed as td", "from torch.optim import Optimizer" ]
3
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE.txt file in the root directory of this source tree. import logging import math import time from collections import defaultdict from funct...
null
v0
[ "str" ]
Tuple[int, int]
def v0(self, v1: str='full') -> Tuple[int, int]: v2 = self.trade_calendar.get_data_cal_range(rtype=v1) if self.outer_trade_decision is None: raise ValueError(f'There is not limitation for strategy {self}') v3 = self.outer_trade_decision.get_data_cal_range_limit(rtype=v1) return (max(v2[0], v3[0]...
[]
[]
[]
6
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from qlib.backtest.exchange import Exchange from qlib.backtest.position import BasePosition from typing import List, Tuple, Union from ..model.base imp...
null
v2
[ "v0[v1]" ]
Iterator[v1]
def v2(self, v3: v0[v1]) -> Iterator[v1]: for v4 in v3.Names(): v5 = v3.GetType(v4) if self._artifact_name in v5.supported_artifacts: yield v3.Create(v4)
[]
[]
[]
5
#!/usr/bin/env python """Generic parsers (for GRR server and client code).""" from typing import Iterator from typing import Text from typing import Type from typing import TypeVar from grr_response_core.lib import factory from grr_response_core.lib import rdfvalue from grr_response_core.lib.parsers import abstract fr...
[ "v0 = factory.Factory", "v1 = TypeVar('_P', bound=Parser)" ]
v0
[ "List[int]" ]
int
def v0(self, v1: List[int]) -> int: (v2, v3) = (min(v1), max(v1)) for v4 in range(v2, 1, -1): if v3 % v4 == 0 and v2 % v4 == 0: return v4 return 1
[]
[]
[]
6
from typing import List class Solution: def findGCD(self, nums: List[int]) -> int: a, b = min(nums), max(nums) for i in range(a, 1, -1): if b % i == 0 and a % i == 0: return i return 1
null
v0
[]
None
def v0(self) -> None: v1 = '/_synapse/admin/v2/users/@unknown_person:unknown_domain/delete_devices' v2 = self.make_request('POST', v1, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.BAD_REQUEST, v2.code, msg=v2.json_body) self.assertEqual('Can only lookup local users', v2.json_body['error...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
5
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = {'display_name': 'new display'} self.get_success(self.handler.update_device(self.other_user, self.other_user_device_id, v1)) v2 = self.make_request('PUT', self.url, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.OK, v2.code, msg=v2.json_body) v2 = self.make_...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
8
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = self.make_request('PUT', self.url, access_token=self.admin_user_tok, content={'display_name': 'new displayname'}) self.assertEqual(HTTPStatus.OK, v1.code, msg=v1.json_body) v1 = self.make_request('GET', self.url, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.OK...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
6
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = self.make_request('GET', self.url, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.OK, v1.code, msg=v1.json_body) self.assertEqual(self.other_user, v1.json_body['user_id']) self.assertIn('user_id', v1.json_body) self.assertIn('device_id', v1.json_body) se...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
9
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = self.get_success(self.handler.get_devices_by_user(self.other_user)) v2 = len(v1) self.assertEqual(1, v2) v3 = self.make_request('DELETE', self.url, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.OK, v3.code, msg=v3.json_body) v1 = self.get_success(self.h...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
8
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = self.make_request('GET', self.url, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.OK, v1.code, msg=v1.json_body) self.assertEqual(0, v1.json_body['total']) self.assertEqual(0, len(v1.json_body['devices']))
[]
[ "http" ]
[ "from http import HTTPStatus" ]
5
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = 5 for v2 in range(v1): self.login('user', 'pass') v3 = self.make_request('GET', self.url, access_token=self.admin_user_tok) self.assertEqual(HTTPStatus.OK, v3.code, msg=v3.json_body) self.assertEqual(v1, v3.json_body['total']) self.assertEqual(v1, len(v3.json_b...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
15
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = self.make_request('POST', self.url, access_token=self.admin_user_tok, content={'devices': ['unknown_device1', 'unknown_device2']}) self.assertEqual(HTTPStatus.OK, v1.code, msg=v1.json_body)
[]
[ "http" ]
[ "from http import HTTPStatus" ]
3
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[]
None
def v0(self) -> None: v1 = 5 for v2 in range(v1): self.login('user', 'pass') v3 = self.get_success(self.handler.get_devices_by_user(self.other_user)) self.assertEqual(v1, len(v3)) v4 = [] for v5 in v3: v4.append(str(v5['device_id'])) v6 = self.make_request('POST', self.url, a...
[]
[ "http" ]
[ "from http import HTTPStatus" ]
13
# Copyright 2020 Dirk Klimpel # # 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,...
null
v0
[ "float", "int" ]
str
def v0(self, v1: float, v2: int) -> str: v3 = floor(v1 * v2) v4 = v1 * v2 % 1 v5 = floor(v4 * self.part_width) v6 = self.chars[v5] if v2 - v3 - 1 < 0: v6 = '' v7 = self.brackets[0] + self.chars[-1] * v3 + v6 + self.chars[0] * (v2 - v3 - 1) + self.brackets[1] return v7
[]
[ "math" ]
[ "from math import floor" ]
9
import sys from math import floor from time import time, localtime from shutil import get_terminal_size from platform import system from typing import Union from .func import get_stdout class ProgressBar: def __init__(self, bar_type: str) -> None: self.machine = False self.hide = False ...
null
v6
[ "Path", "Set[Union[Path, str]]" ]
Any
def v6(v7: Path, v8: Set[Union[Path, str]]): v9 = [] for v10 in v8: if isinstance(v10, Path): v9.append(v7 / v10) elif isinstance(v10, str): v9 += list(v7.glob(v10)) else: warn(f'{v10} is not a Path object or a string glob-pattern') for v11 in v9: ...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3):\n os.chmod(v2, stat.S_IWRITE)\n v1(v2)", "dependencies": [] }, { "name": "v4", "input_types": [ "Path" ], "output_type": "Any", "co...
[ "os", "pathlib", "shutil", "stat", "warnings" ]
[ "import os", "import stat", "from pathlib import Path", "from shutil import move, rmtree", "from warnings import warn" ]
11
import os import stat from pathlib import Path from shutil import move, rmtree from typing import Optional, Set, Union from warnings import warn from cookiecutter.generate import generate_files from git import Repo from .cookiecutter import CookiecutterContext, generate_cookiecutter_context from .cruft import CruftSt...
null
v0
[]
bool
def v0(self) -> bool: if (len(self.episodeTitle) > 0 or len(self.showTitle) > 0 or len(self.showTitle2) > 0) and len(self.download_url) > 0: return True else: return False
[]
[]
[]
5
import re from vsmetaEncoder import vsmetaInfo from datetime import datetime, date class VsMetaInfoGenerator(vsmetaInfo.VsMetaInfo): def __init__(self, feedItem): super(VsMetaInfoGenerator, self).__init__() self.feedItem = feedItem self.download_url = '' # parse feedItem ...
null
v0
[ "str", "List", "asyncio.Queue" ]
Any
async def v0(self, v1: str, v2: List, v3: asyncio.Queue): v4 = self.get_hashable_key_for_rpc_call(v1, v2) self.subscriptions[v4].append(v3) if v4 in self.cache: v5 = self.cache[v4] else: v5 = await self.send_request(v1, v2) self.cache[v4] = v5 await v3.put(v2 + [v5])
[]
[]
[]
9
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: if not self.interface: return if self.interface.debug or self.interface.network.debug: self.interface.logger.debug(v1)
[]
[]
[]
5
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
null
v0
[ "int", "Any", "Any" ]
Any
async def v0(self, v1: int, v2=None, *, v3=False): v4 = v1 // 2016 if v3 and v4 in self._requested_chunks: return self.logger.info(f'requesting chunk from height {v1}') v5 = 2016 if v2 is not None: v5 = min(v5, v2 - v4 * 2016 + 1) v5 = max(v5, 0) try: self._reques...
[]
[]
[]
18
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
null
v0
[]
Optional[str]
def v0(self) -> Optional[str]: v1 = self.session if not v1: return None v2 = v1.remote_address() if not v2: return None return str(v2.host)
[]
[]
[]
8
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
null
v0
[ "int" ]
bool
def v0(self, v1: int) -> bool: v2: Optional[Unit] = self.unit_dict.get(v1, None) return v2 is not None and (not v2.is_memory)
[]
[]
[]
3
from collections import deque from typing import Dict, Set, Deque, List, Optional from sc2.data import Race from sc2.position import Point2 from sharpy.events import UnitDestroyedEvent from sharpy.interfaces import IMemoryManager from sharpy.managers.core import ManagerBase from sc2.ids.unit_typeid import UnitTypeId f...
null
v0
[ "pd.DataFrame", "float" ]
Any
def v0(v1: pd.DataFrame, v2: float=0.05): (v3, v4) = friedmanchisquare(*v1.transpose().to_numpy()) v5 = list(v1.columns) v6 = rankdata(-v1.to_numpy(), axis=1).mean(0) v7 = pd.DataFrame({'mean_rank': v6, 'mean': v1.mean(), 'std': v1.std(), 'median': v1.median(), 'mad': v1.mad()}, index=v5).sort_values('m...
[]
[ "numpy", "pandas", "scipy", "statsmodels" ]
[ "import numpy as np", "import pandas as pd", "from scipy.stats import friedmanchisquare, rankdata", "from statsmodels.stats.libqsturng import qsturng" ]
10
from functools import partial from typing import Callable, List, Union import numpy as np import pandas as pd from scipy.stats import friedmanchisquare, rankdata from sklearn.metrics.pairwise import pairwise_distances from statsmodels.stats.libqsturng import qsturng Matrix = List[List[float]] def friedman_nemenyi(t...
null
v0
[ "Union[Callable, str]" ]
Any
def v0(v1: Union[Callable, str], **v2): if callable(v1): return partial(v1, **v2) else: if v1 != 'minkowski' and 'p' in v2: del v2['p'] if v1 != 'mahalanobis' and 'VI' in v2: del v2['VI'] return partial(pairwise_distances, metric=v1, **v2)
[]
[ "functools", "sklearn" ]
[ "from functools import partial", "from sklearn.metrics.pairwise import pairwise_distances" ]
9
from functools import partial from typing import Callable, List, Union import numpy as np import pandas as pd from scipy.stats import friedmanchisquare, rankdata from sklearn.metrics.pairwise import pairwise_distances from statsmodels.stats.libqsturng import qsturng Matrix = List[List[float]] def friedman_nemenyi(t...
null
v0
[ "np.ndarray", "np.ndarray", "bool" ]
Any
def v0(v1: np.ndarray, v2: np.ndarray, v3: bool=False): v4 = np.expand_dims(np.mean(v1, axis=0), 1) v5 = np.expand_dims(np.mean(v2, axis=0), 1) v6 = np.cov(v1, rowvar=False) v7 = np.cov(v2, rowvar=False) v8 = (v6 + v7) / 2 (v9, v10) = np.linalg.slogdet(v6) (v9, v11) = np.linalg.slogdet(v7) ...
[]
[ "numpy" ]
[ "import numpy as np" ]
15
from functools import partial from typing import Callable, List, Union import numpy as np import pandas as pd from scipy.stats import friedmanchisquare, rankdata from sklearn.metrics.pairwise import pairwise_distances from statsmodels.stats.libqsturng import qsturng Matrix = List[List[float]] def friedman_nemenyi(t...
null
v0
[ "np.ndarray", "Union[List[int], np.ndarray]" ]
Any
def v0(v1: np.ndarray, v2: Union[List[int], np.ndarray]): v2 = np.array(v2) v3 = v2.max() + 1 v4 = np.bincount(v2) v5 = v1.mean(0) v6 = np.empty((v3, v1.shape[1])) for v7 in range(v3): v6[v7, :] = v1[v2 == v7].mean(0) v8 = np.sum(v4[:, None] * (v6 - v5) ** 2, axis=0) v9 = np.sum(...
[]
[ "numpy" ]
[ "import numpy as np" ]
14
from functools import partial from typing import Callable, List, Union import numpy as np import pandas as pd from scipy.stats import friedmanchisquare, rankdata from sklearn.metrics.pairwise import pairwise_distances from statsmodels.stats.libqsturng import qsturng Matrix = List[List[float]] def friedman_nemenyi(t...
null
v3
[ "np.ndarray", "Union[List[int], np.ndarray]", "str", "str", "Union[Callable, str]", "int" ]
Any
def v3(v4: np.ndarray, v5: Union[List[int], np.ndarray], v6: str='mean', v7: str='cent', v8: Union[Callable, str]='l2', v9: int=2): v5 = np.array(v5, dtype=int) v10 = v5.max() + 1 v11 = v0(v8, p=v9) v12 = np.zeros(v10) for v13 in range(v10): v14 = v4[v5 == v13] if v6 == 'max': ...
[ { "name": "v0", "input_types": [ "Union[Callable, str]" ], "output_type": "Any", "code": "def v0(v1: Union[Callable, str], **v2):\n if callable(v1):\n return partial(v1, **v2)\n else:\n if v1 != 'minkowski' and 'p' in v2:\n del v2['p']\n if v1 != 'maha...
[ "functools", "numpy", "sklearn" ]
[ "from functools import partial", "import numpy as np", "from sklearn.metrics.pairwise import pairwise_distances" ]
25
from functools import partial from typing import Callable, List, Union import numpy as np import pandas as pd from scipy.stats import friedmanchisquare, rankdata from sklearn.metrics.pairwise import pairwise_distances from statsmodels.stats.libqsturng import qsturng Matrix = List[List[float]] def friedman_nemenyi(t...
null
v0
[ "np.ndarray" ]
Any
def v0(v1: np.ndarray): v2 = np.unique(v1) (v3, v4) = v1.shape v5 = np.stack([np.sum(v1 == c, 0) for v6 in v2], 1) v7 = np.sum(v5, axis=0) / (v4 * v3) assert np.isclose(np.sum(v7), 1) v8 = np.sum(v7 ** 2) v9 = (np.sum(v5 ** 2, 1) - v3) / (v3 * (v3 - 1)) v10 = np.mean(v9) return (v10 ...
[]
[ "numpy" ]
[ "import numpy as np" ]
10
from functools import partial from typing import Callable, List, Union import numpy as np import pandas as pd from scipy.stats import friedmanchisquare, rankdata from sklearn.metrics.pairwise import pairwise_distances from statsmodels.stats.libqsturng import qsturng Matrix = List[List[float]] def friedman_nemenyi(t...
null
v0
[]
argparse.Namespace
def v0() -> argparse.Namespace: v1 = argparse.ArgumentParser() v1.add_argument('config_path', type=str) v1.add_argument('helm_values', type=str) v1.add_argument('--log_level', type=str, choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'], default='DEBUG') return v1.parse_args()
[]
[ "argparse" ]
[ "import argparse" ]
6
#!/usr/bin/env python3 # Copyright Istio Authors # # 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 ag...
null
v0
[ "torch.Tensor" ]
torch.Tensor
def v0(self, v1: torch.Tensor) -> torch.Tensor: (v2, v3, v4, v5) = v1.shape v1 = self.conv1(v1) v1 = self.conv2(v1) v1 = self.conv3(v1) v6 = math.floor((v5 // 2 + 2 - self.WW // 2) / (self.WS // 2) + 1) v1 = self.conv4(v1) assert v1.shape[-1] == v6 v1 = v1.squeeze().permute(0, 2, 1) ...
[]
[ "math", "torch" ]
[ "import math", "import torch", "import torch.nn as nn", "import torch.nn.functional as F" ]
16
from typing import Any, Dict import argparse import math import torch import torch.nn as nn import torch.nn.functional as F CONV_DIM = 64 FC_DIM = 128 WINDOW_WIDTH = 28 WINDOW_STRIDE = 28 class ConvBlock(nn.Module): """ Simple 3x3 conv with padding size 1 (to leave the input size unchanged), followed by a Re...
null
v0
[ "Tuple[int, ...]", "Set[Tuple[int, ...]]", "Set[Tuple[int, ...]]" ]
List[Tuple[Tuple[int, ...], Tuple[int, ...]]]
def v0(v1: Tuple[int, ...], v2: Set[Tuple[int, ...]], v3: Set[Tuple[int, ...]]) -> List[Tuple[Tuple[int, ...], Tuple[int, ...]]]: v1 = tuple(v1) v4 = set() v5 = [] for v6 in range(len(v1)): for v7 in v2: for v8 in [-1, 1]: v9 = v7[v6] + v8 if v9 >= v1[...
[]
[]
[]
22
""" Utilities and base functions for Services. """ import abc import datetime from typing import Any, Dict, List, Optional, Set, Tuple from pydantic import validator from qcelemental.models import ComputeError from ..interface.models import ObjectId, ProtoModel from ..interface.models.rest_models import TaskQueuePOS...
null
v0
[]
bool
def v0(self) -> bool: if len(self.required_tasks) == 0: return True v1 = self.storage_socket.get_procedures(id=list(self.required_tasks.values()), include=['status', 'error']) v2 = set((x['status'] for v3 in v1['data'])) if v2 == {'COMPLETE'}: return True elif 'ERROR' in v2: ...
[]
[]
[]
20
""" Utilities and base functions for Services. """ import abc import datetime from typing import Any, Dict, List, Optional, Set, Tuple from pydantic import validator from qcelemental.models import ComputeError from ..interface.models import ObjectId, ProtoModel from ..interface.models.rest_models import TaskQueuePOS...
null
v0
[]
Dict[str, Any]
def v0(self) -> Dict[str, Any]: v1 = {} for (v2, v3) in self.required_tasks.items(): v1[v2] = self.storage_socket.get_procedures(id=v3)['data'][0] return v1
[]
[]
[]
5
""" Utilities and base functions for Services. """ import abc import datetime from typing import Any, Dict, List, Optional, Set, Tuple from pydantic import validator from qcelemental.models import ComputeError from ..interface.models import ObjectId, ProtoModel from ..interface.models.rest_models import TaskQueuePOS...
null
v0
[]
str
def v0(self) -> str: v1 = self.get_connection(self.conn_id) v2 = v1.extra_dejson v3 = v2.get('extra__kubernetes__namespace', 'default') return v3
[]
[]
[]
5
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
null
v6
[ "list", "int" ]
Any
def v6(v7: list, v8: int): v9 = v8 v10 = v7[len(v7) - 1] v11 = dict() for (v12, v13) in enumerate(v7): v11[str(v12)] = v13 def v14(v15) -> int: v16 = [v15 for v15 in v15['data'].values()][::-1] v17 = [] for (v18, v19) in enumerate(v16): if v19 == v15['val...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "int", "code": "def v0(v1) -> int:\n v2 = [v1 for v1 in v1['data'].values()][::-1]\n v3 = []\n for (v4, v5) in enumerate(v2):\n if v5 == v1['val']:\n v3.append(len(v2) - v4)\n if len(v3) == 2:\n ...
[]
[]
28
import functools import time def timer(function): @functools.wraps(function) def wrapper(*args, **kwargs) -> float: time_list = [] ans = None for i in range(0, 10): start = time.perf_counter() ans = function(*args, **kwargs) end = time.perf_counter() ...
null
v3
[ "list", "int" ]
Any
def v3(v4: list, v5: int): v6 = dict() v7 = v4[len(v4) - 1] def v8(v9, v10): try: v6[v9] = (v6[v9][1], v10) except KeyError: v6[v9] = (None, v10) for (v11, v12) in enumerate(v4): v6[str(v12)] = (None, v11) for v11 in range(len(v4), v5): try: ...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n try:\n indexer[v1] = (indexer[v1][1], v2)\n except KeyError:\n indexer[v1] = (None, v2)", "dependencies": [] } ]
[]
[]
23
import functools import time def timer(function): @functools.wraps(function) def wrapper(*args, **kwargs) -> float: time_list = [] ans = None for i in range(0, 10): start = time.perf_counter() ans = function(*args, **kwargs) end = time.perf_counter() ...
null
v0
[ "Any" ]
int
def v0(v1) -> int: v2 = [v1 for v1 in v1['data'].values()][::-1] v3 = [] for (v4, v5) in enumerate(v2): if v5 == v1['val']: v3.append(len(v2) - v4) if len(v3) == 2: break return v3[0] - v3[1]
[]
[]
[]
9
import functools import time def timer(function): @functools.wraps(function) def wrapper(*args, **kwargs) -> float: time_list = [] ans = None for i in range(0, 10): start = time.perf_counter() ans = function(*args, **kwargs) end = time.perf_counter() ...
null
v1
[ "torch.Tensor", "Optional[List[v0]]", "int" ]
Tuple[torch.Tensor, List[v0]]
def v1(self, v2: torch.Tensor, v3: Optional[List[v0]]=None, v4: int=0) -> Tuple[torch.Tensor, List[v0]]: if v3 is None: v5: Optional[torch.Tensor] = None v3 = [(v5, v5)] * len(self.layers) v6: List[v0] = [] v7 = v2 v8 = 0 for v9 in self.layers: v10 = v3[v8] v11 = v7.u...
[]
[ "torch" ]
[ "import torch", "from torch.nn import *" ]
19
from typing import Tuple, Optional, List, Union import torch from torch.nn import * import math def gmm(x: torch.Tensor, w: torch.Tensor) -> torch.Tensor: return torch.einsum('ndo,bnd->bno', w, x) class GraphLinear(Module): def __init__(self, in_features: int, out_features: int): super().__init__() ...
[ "v0 = Tuple[Optional[torch.Tensor], Optional[torch.Tensor]]" ]
v0
[ "str", "int" ]
str
def v0(self, v1: str, v2: int) -> str: if v2 <= 0: return '' if v2 == 1: return v1 v3 = '' for v4 in range(v2): v5 = v4 v6 = v2 * 2 - 2 while v5 < len(v1): if v4 == 0 or (v4 == v2 - 1 and v5): v3 += v1[v5] v5 += v6 ...
[]
[]
[]
21
# -*- coding: utf-8 -*- """ @Time : 2020/10/21 10:39 @Auth : Qi @IDE : PyCharm @Title: 6. Z 字形变换 @Link : https://leetcode-cn.com/problems/zigzag-conversion/ """ class Solution: def convert(self, s: str, numRows: int) -> str: if numRows <= 0: return '' if numRows == 1: retu...
null
v0
[ "Union[None, str]" ]
str
def v0(self, v1: Union[None, str]=None) -> str: v2 = v1 if v1 is not None else '' v3 = self.url for (v4, v5) in self.get_path_params().items(): v3 = v3.replace(f'{{{v4}}}', v5) v2 += v3 return v2
[]
[]
[]
7
# Auto-generated at 2021-09-27T17:01:26.691956+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
[]
dict
def v0(self) -> dict: v1 = {} if hasattr(self, 'category_path'): v1['categoryPath'] = self.category_path if hasattr(self, 'namespace'): v1['namespace'] = self.namespace return v1
[]
[]
[]
7
# 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 # pylint: disable=duplicate-code # pylint: disable=li...
null
v0
[]
bool
def v0(self) -> bool: if not hasattr(self, 'body') or self.body is None: return False if not hasattr(self, 'namespace') or self.namespace is None: return False if not hasattr(self, 'user_id') or self.user_id is None: return False return True
[]
[]
[]
8
# Auto-generated at 2021-09-27T17:01:25.593031+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: ...
null
v49
[ "str" ]
v0
def v49(self, v50: str) -> v0: self.namespace = v50 return self
[]
[]
[]
3
# Auto-generated at 2021-09-27T17:01:26.691956+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(Operation):\n v1: str = '/notification/namespaces/{namespace}/freeform'\n v2: str = 'POST'\n v3: List[str] = ['application/json']\n v4: List[str] = ['application/json']\n v5: Optional[str] = 'bearer'\n v6: str = None\n v7: ModelFreeFormNotificationRequest\n v8: str\n\n @property...
v0
[]
None
async def v0(self) -> None: await self.bot.wait_until_ready() while not self.bot.is_closed(): for v1 in await self.get_banned_members(): v2 = self.bot.get_guild(v1['guild']) if v2 is None: continue v3 = await self.bot.fetch_user(v1['member']) ...
[]
[ "asyncio" ]
[ "import asyncio" ]
11
from __future__ import annotations import asyncio from datetime import datetime from typing import TYPE_CHECKING, Union, Optional, List, Dict, Any import discord from .base import DatabaseChecker from .punishments import Punisher if TYPE_CHECKING: from .punishments import Punishment from discord.ext import ...
null
v0
[ "Union[int, float]", "discord.Member", "str" ]
None
async def v0(self, v1: Union[int, float], v2: discord.Member, v3: str) -> None: await asyncio.sleep(v1) if await self.unban(v2): await self.call_event('on_unban', v2, v3)
[]
[ "asyncio" ]
[ "import asyncio" ]
4
from __future__ import annotations import asyncio from datetime import datetime from typing import TYPE_CHECKING, Union, Optional, List, Dict, Any import discord from .base import DatabaseChecker from .punishments import Punisher if TYPE_CHECKING: from .punishments import Punishment from discord.ext import ...
null
v0
[ "list" ]
Any
def v0(self, v1: list): if not isinstance(v1, list) or len(v1) != 2: raise ValueError('A `MatchingLayer` layer should be called on a list of 2 inputs.') self._shape1 = v1[0] self._shape2 = v1[1] for v2 in (0, 2): if self._shape1[v2] != self._shape2[v2]: raise ValueError(f'Inc...
[]
[]
[]
8
"""An implementation of Matching Layer.""" import typing import tensorflow as tf from tensorflow.keras import layers class MatchingLayer(layers.Layer): """ Layer that computes a matching matrix between samples in two tensors. :param normalize: Whether to L2-normalize samples along the dot produc...
null
v3
[ "list" ]
typing.Any
def v3(self, v4: list, **v5) -> typing.Any: v6 = v4[0] v7 = v4[1] if self._matching_type == 'dot': if self._normalize: v6 = tf.math.l2_normalize(v6, axis=2) v7 = tf.math.l2_normalize(v7, axis=2) return tf.expand_dims(tf.einsum('abd,acd->abc', v6, v7), 3) else: ...
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n return tf.concat([v1, v2], axis=3)", "dependencies": [] } ]
[ "tensorflow" ]
[ "import tensorflow as tf", "from tensorflow.keras import layers" ]
30
"""An implementation of Matching Layer.""" import typing import tensorflow as tf from tensorflow.keras import layers class MatchingLayer(layers.Layer): """ Layer that computes a matching matrix between samples in two tensors. :param normalize: Whether to L2-normalize samples along the dot produc...
null
v0
[ "list" ]
tuple
def v0(self, v1: list) -> tuple: if not isinstance(v1, list) or len(v1) != 2: raise ValueError('A `MatchingLayer` layer should be called on a list of 2 inputs.') v2 = list(v1[0]) v3 = list(v1[1]) if len(v2) != 3 or len(v3) != 3: raise ValueError('A `MatchingLayer` layer should be called ...
[]
[]
[]
17
"""An implementation of Matching Layer.""" import typing import tensorflow as tf from tensorflow.keras import layers class MatchingLayer(layers.Layer): """ Layer that computes a matching matrix between samples in two tensors. :param normalize: Whether to L2-normalize samples along the dot produc...
null
v0
[ "List[str]", "List[List[str]]" ]
Tuple[int, ...]
def v0(v1: List[str], v2: List[List[str]]) -> Tuple[int, ...]: v3 = [len(c.split('@')[0]) for v4 in v1] for v5 in v2: for v6 in range(len(v5)): v3[v6] = max(len(v5[v6]), v3[v6]) return tuple(v3)
[]
[]
[]
6
import inspect import io import json import logging as logginglib import sys from datetime import datetime from typing import Any, Callable, Dict, List, Optional, Set, TextIO, Tuple from typing_extensions import Literal from hpc.autoscale import hpclogging as logging from hpc.autoscale.codeanalysis import hpcwrapclas...
null
v7
[ "List[str]", "List[List[str]]", "Optional[TextIO]", "str" ]
None
def v7(v8: List[str], v9: List[List[str]], v10: Optional[TextIO]=None, v11: str='table') -> None: v11 = v11 or 'table' v10 = v10 or sys.stdout v12 = [c.split('@')[0] for v13 in v8] if v11.lower() == 'json': json.dump([dict(zip(v12, row)) for v14 in v9], v10, indent=2) else: v15 = v0(...
[ { "name": "v0", "input_types": [ "List[str]", "List[List[str]]" ], "output_type": "Tuple[int, ...]", "code": "def v0(v1: List[str], v2: List[List[str]]) -> Tuple[int, ...]:\n v3 = [len(c.split('@')[0]) for v4 in v1]\n for v5 in v2:\n for v6 in range(len(v5)):\n ...
[ "json", "sys" ]
[ "import json", "import sys" ]
14
import inspect import io import json import logging as logginglib import sys from datetime import datetime from typing import Any, Callable, Dict, List, Optional, Set, TextIO, Tuple from typing_extensions import Literal from hpc.autoscale import hpclogging as logging from hpc.autoscale.codeanalysis import hpcwrapclas...
null