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" ]
Any
def v0(self, v1: str, *v2, **v3): v4 = self.get_installers().get(v1) if not v4: raise ValueError('no installer for package %s' % v1) return v4(*v2, **v3)
[]
[]
[]
5
#!/usr/bin/env python import functools import glob import logging import os import platform import re import shutil import stat import sys import tempfile import time from pathlib import Path from typing import Callable, Dict, List, Tuple import requests from plugin import Plugin, PluginManager from localstack import...
null
v0
[ "str" ]
dict
def v0(v1: str) -> dict: try: with open(v1, 'r') as v2: return json.load(v2) except FileNotFoundError: return None
[]
[ "json" ]
[ "import json" ]
6
# # Copyright 2018 Joachim Lusiardi # # 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 wri...
null
v0
[ "str", "dict" ]
Any
def v0(v1: str, v2: dict): with open(v1, 'w') as v3: json.dump(v2, v3, indent=4)
[]
[ "json" ]
[ "import json" ]
3
# # Copyright 2018 Joachim Lusiardi # # 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 wri...
null
v0
[ "str", "str" ]
str
def v0(v1: str, v2: str) -> str: v3 = len(v1) v4 = [] for v5 in range(v3): v4.append(str(int(v1[v5]) ^ int(v2[v5]))) return ''.join(v4[::-1])
[]
[]
[]
6
# qubit number=3 # total number=60 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from...
null
v0
[ "str", "str" ]
str
def v0(v1: str, v2: str) -> str: v3 = len(v1) v4 = 0 for v5 in range(v3): v4 += int(v1[v5]) * int(v2[v5]) return str(v4 % 2)
[]
[]
[]
6
# qubit number=3 # total number=60 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from...
null
v12
[ "str" ]
Any
def v12(v13: str): v14 = '011' v15 = '1' return v6(v0(v14, v13), v15)
[ { "name": "v0", "input_types": [ "str", "str" ], "output_type": "str", "code": "def v0(v1: str, v2: str) -> str:\n v3 = len(v1)\n v4 = 0\n for v5 in range(v3):\n v4 += int(v1[v5]) * int(v2[v5])\n return str(v4 % 2)", "dependencies": [] }, { "name": "v6"...
[]
[]
4
# qubit number=3 # total number=60 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from...
null
v12
[ "str" ]
Any
def v12(v13: str): v14 = '000' v15 = '0' return v6(v0(v14, v13), v15)
[ { "name": "v0", "input_types": [ "str", "str" ], "output_type": "str", "code": "def v0(v1: str, v2: str) -> str:\n v3 = len(v1)\n v4 = 0\n for v5 in range(v3):\n v4 += int(v1[v5]) * int(v2[v5])\n return str(v4 % 2)", "dependencies": [] }, { "name": "v6"...
[]
[]
4
# qubit number=3 # total number=60 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from...
null
v8
[ "v0" ]
Any
def v8(self, v9: v0): v10 = self.choices[self.iter] self.iter += 1 if self.iter >= len(self.choices): self.iter = 0 v11 = re.findall('~([a-z0-9]+)\\b', v10, re.I) if v11: for v12 in v11: v13 = v9.get(v12) if v13: v10 = re.sub('~{}'.format(v12),...
[]
[ "re" ]
[ "import re" ]
13
from typing import List import random import re class Concept: def __init__(self, name: str, options: List[str]): self.name = name.lower() self.options = options def next(self): return random.choice(self.options) def render_to(self, template): return [template.format(opti...
[ "class v0:\n\n def __init__(self, v1: List[Concept]=[]):\n self.concepts = v1\n\n def v2(self, v3: str, v4: List[str]):\n self.concepts.append(Concept(v3, v4))\n\n def v5(self, v6):\n v6 = v6.lower()\n for v7 in self.concepts:\n if v7.name == v6:\n retu...
v8
[ "str", "v0" ]
Any
def v8(self, v9: str, v10: v0): for v11 in self.scope: if v11.triggers and (not v11.proposal): if v9.lower() in v11.triggers: return v11
[]
[]
[]
5
from typing import List import random import re class Concept: def __init__(self, name: str, options: List[str]): self.name = name.lower() self.options = options def next(self): return random.choice(self.options) def render_to(self, template): return [template.format(opti...
[ "class v0:\n\n def __init__(self, v1: List[Concept]=[]):\n self.concepts = v1\n\n def v2(self, v3: str, v4: List[str]):\n self.concepts.append(Concept(v3, v4))\n\n def v5(self, v6):\n v6 = v6.lower()\n for v7 in self.concepts:\n if v7.name == v6:\n retu...
v8
[ "v0" ]
Any
def v8(self, v9: v0): v10 = [] for v11 in self.triggers: v12 = re.findall('~([a-z0-9]+)\\b', v11, re.I) if v12: for v13 in v12: v14 = v9.get(v13) if v14: v15 = v11.replace('~{}'.format(v13), '{}') v10.extend(v14....
[]
[ "re" ]
[ "import re" ]
13
from typing import List import random import re class Concept: def __init__(self, name: str, options: List[str]): self.name = name.lower() self.options = options def next(self): return random.choice(self.options) def render_to(self, template): return [template.format(opti...
[ "class v0:\n\n def __init__(self, v1: List[Concept]=[]):\n self.concepts = v1\n\n def v2(self, v3: str, v4: List[str]):\n self.concepts.append(Concept(v3, v4))\n\n def v5(self, v6):\n v6 = v6.lower()\n for v7 in self.concepts:\n if v7.name == v6:\n retu...
v0
[]
bool
def v0(self) -> bool: if self.ws: return self.ws.is_ratelimited() return False
[]
[]
[]
4
""" 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
v0
[ "Callable[..., Coroutine[Any, Any, Any]]", "str" ]
None
async def v0(self, v1: Callable[..., Coroutine[Any, Any, Any]], v2: str, *v3: Any, **v4: Any) -> None: try: await v1(*v3, **v4) except asyncio.CancelledError: pass except Exception: try: await self.on_error(v2, *v3, **v4) except asyncio.CancelledError: ...
[]
[ "asyncio" ]
[ "import asyncio" ]
10
""" 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
v0
[ "Callable[..., Coroutine[Any, Any, Any]]", "str" ]
asyncio.Task
def v0(self, v1: Callable[..., Coroutine[Any, Any, Any]], v2: str, *v3: Any, **v4: Any) -> asyncio.Task: v5 = self._run_event(v1, v2, *v3, **v4) v6 = self.loop.create_task(v5) v6.set_name(f'discord.py: {v2}') return v6
[]
[]
[]
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
v0
[ "str" ]
None
async def v0(self, v1: str, *v2: Any, **v3: Any) -> None: print(f'Ignoring exception in {v1}', file=sys.stderr) traceback.print_exc()
[]
[ "sys", "traceback" ]
[ "import sys", "import traceback" ]
3
""" 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
v0
[ "Optional[int]", "bool" ]
None
async def v0(self, v1: Optional[int], *, v2: bool=False) -> None: if not v2: await asyncio.sleep(5.0)
[]
[ "asyncio" ]
[ "import asyncio" ]
3
""" 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
v0
[]
None
async def v0(self) -> None: if self._closed: return self._closed = True for v1 in self.voice_clients: try: await v1.disconnect(force=True) except Exception: pass if self.ws is not None and self.ws.open: await self.ws.close(code=1000) await self...
[]
[]
[]
13
""" 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
v0
[]
None
def v0(self) -> None: self._closed = False self._ready.clear() self._connection.clear() self.http.recreate()
[]
[]
[]
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
v0
[ "str", "bool" ]
None
async def v0(self, v1: str, *, v2: bool=True) -> None: await self.login(v1) await self.connect(reconnect=v2)
[]
[]
[]
3
""" 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
v2
[ "str", "Optional[Callable[..., bool]]", "Optional[float]" ]
Any
def v2(self, v3: str, *, v4: Optional[Callable[..., bool]]=None, v5: Optional[float]=None) -> Any: v6 = self.loop.create_future() if v4 is None: def v7(*v8): return True v4 = v7 v9 = v3.lower() try: v10 = self._listeners[v9] except KeyError: v10 = [] ...
[ { "name": "v0", "input_types": [], "output_type": "Any", "code": "def v0(*v1):\n return True", "dependencies": [] } ]
[ "asyncio" ]
[ "import asyncio" ]
15
""" 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
v13
[ "str" ]
Iterator[int]
def v13(v14: str) -> Iterator[int]: v15 = v5(filepath=v14) for v16 in v15: yield int(v16)
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Iterator[str]", "code": "def v0(v1: str) -> Iterator[str]:\n v2 = logging.getLogger(LOGGER_NAME)\n v2.info('Reading input from %s', v1)\n with open(v1, 'r') as v3:\n for v4 in v3:\n v4 = v4.strip()\n ...
[ "logging" ]
[ "import logging" ]
4
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[ "Any" ]
dict
def v0(v1) -> dict: v2 = re.match('(\\w+) (\\w+)', 'Isaac Newton, physicist') v2 = re.match('#(\\d+) @ (\\d+),(\\d+): (\\d+)x(\\d+)', v1) v3 = {'id': v2.group(1), 'from_left': v2.group(2), 'from_top': v2.group(3), 'width': v2.group(4), 'height': v2.group(5)} return v3
[]
[ "re" ]
[ "import re" ]
5
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[ "List[str]" ]
int
def v0(v1: List[str]) -> int: v1 = [str(x) for v2 in v1] v3 = ''.join(v1) v4 = int(v3, 2) return v4
[]
[]
[]
5
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[ "int", "int", "int", "int", "str" ]
Any
def v0(self, v1: int, v2: int, v3: int, v4: int, v5: str): if v1 + v3 > self.max_x: self.max_x = v1 + v3 print(f'Adjusting width to {self.max_x}') if v2 + v4 > self.max_y: self.max_y = v2 + v4 print(f'Adjusting height to {self.max_y}') for v6 in range(v3): for v7 in r...
[]
[]
[]
14
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[ "int", "int", "int", "int", "str" ]
bool
def v0(self, v1: int, v2: int, v3: int, v4: int, v5: str) -> bool: for v6 in range(v3): for v7 in range(v4): v8 = v6 + v1 v9 = v7 + v2 v10 = f'{v8}:{v9}' v11 = self.cell_dict[v10] if len(v11) != 1: return False return True
[]
[]
[]
10
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[]
str
def v0(self) -> str: v1 = self.get_filepath() self._logger.info("Reading raw data from '%s'", v1) with open(v1, 'r') as v2: v3 = v2.read() return v3
[]
[]
[]
6
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[]
Iterator[str]
def v0(self) -> Iterator[str]: v1 = self.get_filepath() self._logger.info("Reading lines from '%s'", v1) with open(v1, 'r') as v2: for v3 in v2: v3 = v3.strip() yield v3
[]
[]
[]
7
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[]
List[str]
def v0(self) -> List[str]: for v1 in self.get_lines(): for v2 in v1: yield v2
[]
[]
[]
4
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[]
Iterator[int]
def v0(self) -> Iterator[int]: for v1 in self.get_lines(): yield float(v1)
[]
[]
[]
3
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[]
Iterator[str]
def v0(self) -> Iterator[str]: for v1 in self.get_lines(): v1 = v1.strip() v2 = v1.split(',') for v3 in v2: v4 = v3.strip() if v4: yield v4
[]
[]
[]
8
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v0
[]
Iterator[int]
def v0(self) -> Iterator[int]: v1 = self.get_comma_separated_values() for v2 in v1: yield int(v2)
[]
[]
[]
4
import argparse import re import logging import requests from typing import Iterator from typing import List LOGGER_NAME="advent" def init_logging(is_verbose: bool): """ Creates standard logging for the logger_name passed in """ logger = logging.getLogger(LOGGER_NAME) logger.setLevel(logging....
null
v19
[ "v0", "Sequence[int]" ]
v0
def v19(v20: v0, v21: Sequence[int]) -> v0: v22 = tuple(range(len(v21), len(v21) + onp.ndim(v20))) return v15(v20, tuple(v21) + onp.shape(v20), v22)
[ { "name": "v2", "input_types": [ "Any", "Any", "Any" ], "output_type": "Any", "code": "def v2(v3, *, v4, v5):\n _check_shapelike('broadcast_in_dim', 'shape', v4)\n _check_shapelike('broadcast_in_dim', 'broadcast_dimensions', v5)\n v6 = onp.ndim(v3)\n if v6 != len(v5...
[ "numpy" ]
[ "import numpy as onp" ]
3
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "v0 = Any", "v1 = Sequence[int]" ]
v1
[ "v0", "Optional[int]", "Optional[int]", "int", "int" ]
v0
def v1(v2: v0, v3: Optional[int], v4: Optional[int], v5: int=1, v6: int=0) -> v0: v7 = [0] * v2.ndim v8 = list(v2.shape) v9 = [1] * v2.ndim v10 = v2.shape[v6] v11 = int(v3) if v3 is not None else 0 v12 = int(v4) if v4 is not None else v10 if v11 < 0: v11 = v11 + v10 if v12 < 0: ...
[]
[]
[]
16
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "v0 = Any" ]
v20
[ "v0", "int", "int", "bool" ]
v0
def v20(v21: v0, v22: int, v23: int=0, v24: bool=True) -> v0: (v22, v23) = (int(v22), int(v23)) v25 = v21.shape[v23] v26 = v22 + v25 if v22 < 0 else v22 if not 0 <= v26 < v25: v27 = 'index {} is out of bounds for axis {} with size {}' raise IndexError(v27.format(v22, v23, v25)) v28 =...
[ { "name": "v2", "input_types": [ "v0", "v1", "Optional[Sequence[int]]" ], "output_type": "v0", "code": "def v2(v3: v0, v4: v1, v5: Optional[Sequence[int]]=None) -> v0:\n v4 = canonicalize_shape(v4)\n v4 = tuple(v4)\n v6 = onp.shape(v3) == v4\n v7 = v5 is None or tup...
[ "numpy" ]
[ "import numpy as onp" ]
12
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "v0 = Any", "v1 = Sequence[int]" ]
v0
[ "Optional[str]" ]
Optional[str]
def v0(v1: Optional[str]) -> Optional[str]: if v1: return v1.replace('_', '-') else: return None
[]
[]
[]
5
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: self.build_info = self.create_build_info() self.imagedir = '_images' self.secnumbers: Dict[str, Tuple[int, ...]] = {} self.current_docname: str = None self.init_templates() self.init_highlighter() self.init_css_files() self.init_js_files() v1 = self.get_builder_...
[]
[]
[]
18
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
str
def v0(self) -> str: if self.config.html_style is not None: return self.config.html_style elif self.theme: return self.theme.get_config('theme', 'stylesheet') else: return 'default.css'
[]
[]
[]
7
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: self.css_files = [] self.add_css_file('pygments.css', priority=200) self.add_css_file(self._get_style_filename(), priority=200) for (v1, v2) in self.app.registry.css_files: self.add_css_file(v1, **v2) for (v1, v2) in self.get_builder_config('css_files', 'html'): ...
[]
[]
[]
9
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: self.script_files = [] self.add_js_file('documentation_options.js', id='documentation_options', data_url_root='', priority=200) self.add_js_file('jquery.js', priority=200) self.add_js_file('underscore.js', priority=200) self.add_js_file('_sphinx_javascript_frameworks_compat.js'...
[]
[]
[]
14
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: self.finish_tasks.add_task(self.gen_indices) self.finish_tasks.add_task(self.gen_pages_from_extensions) self.finish_tasks.add_task(self.gen_additional_pages) self.finish_tasks.add_task(self.copy_image_files) self.finish_tasks.add_task(self.copy_download_files) self.finish_t...
[]
[]
[]
10
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: for v1 in self.events.emit('html-collect-pages'): for (v2, v3, v4) in v1: self.handle_page(v2, v3, v4)
[]
[]
[]
4
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: with open(path.join(self.outdir, '_static', 'pygments.css'), 'w') as v1: v1.write(self.highlighter.get_stylesheet()) if self.dark_highlighter: with open(path.join(self.outdir, '_static', 'pygments_dark.css'), 'w') as v1: v1.write(self.dark_highlighter.get_styles...
[]
[ "os" ]
[ "import os", "from os import path" ]
6
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: if self.theme: self.theme.cleanup()
[]
[]
[]
3
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: if self.indexer: self.finish_tasks.add_task(self.dump_search_index) self.finish_tasks.add_task(self.dump_inventory)
[]
[]
[]
4
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[ "str" ]
bool
def v0(v1: str) -> bool: if v1 in self.env.all_docs: return True elif v1 == 'search' and self.search: return True elif v1 == 'genindex' and self.get_builder_config('use_index', 'html'): return True return False
[]
[]
[]
8
"""Several HTML builders.""" import html import os import posixpath import re import sys from datetime import datetime from os import path from typing import IO, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Type from urllib.parse import quote from docutils import nodes from docutils.core import publish_...
null
v0
[]
None
def v0(self) -> None: if self._run_on_save: self.request_rerun(self._client_state) else: self._enqueue_file_change_message()
[]
[]
[]
5
# Copyright 2018-2022 Streamlit Inc. # # 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 wr...
null
v0
[ "bool" ]
None
def v0(self, v1: bool) -> None: self._run_on_save = v1 self._enqueue_session_state_changed_message()
[]
[]
[]
3
# Copyright 2018-2022 Streamlit Inc. # # 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 wr...
null
v0
[ "(int, float)" ]
(int, float)
def v0(self, v1: (int, float)) -> (int, float): self.__input_validation(v1) self.__value = self.__value ** v1 return self.__value
[]
[]
[]
4
class Calculator: """" This calculator performs the following basic mathematical operations: * Addition * Subtraction * Division * Multiplication * nth root of number * exponent Attributes ---------- __value : (int or float) the calculator memory value Methods ...
null
v0
[]
(int, float)
def v0(self) -> (int, float): self.__value = 0 return self.__value
[]
[]
[]
3
class Calculator: """" This calculator performs the following basic mathematical operations: * Addition * Subtraction * Division * Multiplication * nth root of number * exponent Attributes ---------- __value : (int or float) the calculator memory value Methods ...
null
v0
[ "str" ]
int
def v0(v1: str) -> int: if v1.startswith('0x'): return int(v1, base=16) elif v1.startswith('"'): return int.from_bytes(v1[1:-1].encode('ascii'), 'big') return int(v1)
[]
[]
[]
6
# -*- coding: utf-8 -*- # NOTES: # - this file is all about the trust model for the HODL contracts. TRUST NO ONE. VALIDATE ALL. from __future__ import annotations import dataclasses import decimal import re import time import typing as th import hddcoin.hodl from clvm_tools.binutils import disassemble, int_to_bytes ...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: if v1.startswith('0x'): return v1 elif v1.startswith('"'): return '0x' + v1[1:-1].encode('ascii').hex() return hex(int(v1))
[]
[]
[]
6
# -*- coding: utf-8 -*- # NOTES: # - this file is all about the trust model for the HODL contracts. TRUST NO ONE. VALIDATE ALL. from __future__ import annotations import dataclasses import decimal import re import time import typing as th import hddcoin.hodl from clvm_tools.binutils import disassemble, int_to_bytes ...
null
v0
[ "Tensor", "Tensor" ]
Tensor
def v0(v1: Tensor, v2: Tensor) -> Tensor: assert v1.shape[:-2] == v2.shape[:-2] assert v1.shape[-2] == v1.shape[-1] == v2.shape[-2] assert v2.shape[-1] == 1 (v3, v4) = (v1.shape[:-2], v1.shape[-2]) v5 = torch.zeros(v3 + (1, v4), dtype=v1.dtype, device=v1.device) v6 = torch.ones(v3 + (1, 1), dtyp...
[]
[ "torch" ]
[ "import torch", "from torch import Tensor" ]
9
from typing import Tuple import torch from torch import Tensor def homogeneous(A: Tensor, b: Tensor) -> Tensor: """ Converts heterogeneous matrix into homogeneous matrix. :param A: Heterogeneous matrix of shape [*, N, N]. :param b: Heterogeneous vector of shape [*, N, 1]. :return: Homogeneous mat...
null
v0
[ "Tensor" ]
Tuple[Tensor, Tensor]
def v0(v1: Tensor) -> Tuple[Tensor, Tensor]: assert v1.shape[-2] == v1.shape[-1] v2 = v1.shape[-2] - 1 (v3, v4) = v1.split([v2, 1], dim=-2) (v5, v6) = v3.split([v2, 1], dim=-1) (v7, v8) = v4.split([v2, 1], dim=-1) (v5, v6) = (v5 / v8, v6 / v8) return (v5, v6)
[]
[]
[]
8
from typing import Tuple import torch from torch import Tensor def homogeneous(A: Tensor, b: Tensor) -> Tensor: """ Converts heterogeneous matrix into homogeneous matrix. :param A: Heterogeneous matrix of shape [*, N, N]. :param b: Heterogeneous vector of shape [*, N, 1]. :return: Homogeneous mat...
null
v0
[ "Tensor", "Tensor", "Tensor" ]
Tensor
def v0(v1: Tensor, v2: Tensor, v3: Tensor) -> Tensor: assert v1.ndim == v2.ndim == v3.ndim assert v1.shape[-2] == v2.shape[-2] == v2.shape[-1] == v3.shape[-2] assert v1.shape[-1] == v3.shape[-1] == 1 v4 = v2 @ v1 + v3 return v4
[]
[]
[]
6
from typing import Tuple import torch from torch import Tensor def homogeneous(A: Tensor, b: Tensor) -> Tensor: """ Converts heterogeneous matrix into homogeneous matrix. :param A: Heterogeneous matrix of shape [*, N, N]. :param b: Heterogeneous vector of shape [*, N, 1]. :return: Homogeneous mat...
null
v0
[ "Tensor" ]
Tensor
def v0(v1: Tensor) -> Tensor: (v2, v3) = (v1.shape[-2], v1.shape[-1]) return torch.eye(v2, v3, dtype=v1.dtype, device=v1.device).expand_as(v1)
[]
[ "torch" ]
[ "import torch", "from torch import Tensor" ]
3
from typing import Tuple import torch from torch import Tensor def homogeneous(A: Tensor, b: Tensor) -> Tensor: """ Converts heterogeneous matrix into homogeneous matrix. :param A: Heterogeneous matrix of shape [*, N, N]. :param b: Heterogeneous vector of shape [*, N, 1]. :return: Homogeneous mat...
null
v0
[ "Tensor" ]
Any
def v0(v1: Tensor): assert v1.shape[-1] == 1 v2 = v1.shape[-2] return torch.eye(v2, dtype=v1.dtype, device=v1.device) * v1
[]
[ "torch" ]
[ "import torch", "from torch import Tensor" ]
4
from typing import Tuple import torch from torch import Tensor def homogeneous(A: Tensor, b: Tensor) -> Tensor: """ Converts heterogeneous matrix into homogeneous matrix. :param A: Heterogeneous matrix of shape [*, N, N]. :param b: Heterogeneous vector of shape [*, N, 1]. :return: Homogeneous mat...
null
v0
[ "int", "Any" ]
QuantumCircuit
def v0(v1: int, v2) -> QuantumCircuit: v3 = QuantumRegister(v1, 'ofc') v4 = QuantumRegister(1, 'oft') v5 = QuantumCircuit(v3, v4, name='Of') for v6 in range(2 ** v1): v7 = np.binary_repr(v6, v1) if v2(v7) == '1': for v8 in range(v1): if v7[v8] == '0': ...
[]
[ "numpy", "qiskit" ]
[ "import qiskit", "from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister", "from qiskit import BasicAer, execute, transpile", "from qiskit.test.mock import FakeVigo", "import numpy as np" ]
15
# qubit number=4 # total number=40 import cirq import qiskit from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from math import log2 import numpy as np import networkx as nx def bitwise_...
null
v9
[ "int", "Any" ]
QuantumCircuit
def v9(v10: int, v11) -> QuantumCircuit: v12 = QuantumRegister(v10, 'qc') v13 = ClassicalRegister(v10, 'qm') v14 = QuantumCircuit(v12, v13) v14.cx(v12[0], v12[3]) v14.cx(v12[0], v12[3]) v14.x(v12[3]) v14.cx(v12[0], v12[3]) v14.cx(v12[0], v12[3]) v14.h(v12[1]) v14.h(v12[2]) v1...
[ { "name": "v0", "input_types": [ "int", "Any" ], "output_type": "QuantumCircuit", "code": "def v0(v1: int, v2) -> QuantumCircuit:\n v3 = QuantumRegister(v1, 'ofc')\n v4 = QuantumRegister(1, 'oft')\n v5 = QuantumCircuit(v3, v4, name='Of')\n for v6 in range(2 ** v1):\n ...
[ "numpy", "qiskit" ]
[ "import qiskit", "from qiskit.providers.aer import QasmSimulator", "from qiskit.test.mock import FakeVigo", "from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister", "from qiskit import BasicAer, execute, transpile", "import numpy as np" ]
46
# qubit number=4 # total number=49 import cirq import qiskit from qiskit.providers.aer import QasmSimulator from qiskit.test.mock import FakeVigo from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import ...
null
v0
[ "str" ]
None
def v0(v1: str) -> None: if os.path.exists(v1): shutil.rmtree(v1)
[]
[ "os", "shutil" ]
[ "import shutil", "import os" ]
3
# -*- coding: utf-8 -*- from django.conf import settings from django.utils.timezone import now as timezone_now from zerver.data_import.slack import ( get_slack_api_data, get_admin, get_guest, get_user_timezone, fetch_shared_channel_users, users_to_zerver_userprofile, get_subscription, c...
null
v0
[ "dict", "bool", "str" ]
dict
def v0(self, v1: dict, v2: bool, v3: str=None) -> dict: if 'events_when_hit' not in v1: v1['events_when_hit'] = ['counter_' + self.name + '_hit'] v1['events_when_hit'].append('logicblock_' + self.name + '_hit') return super().validate_and_parse_config(v1, v2, v3)
[]
[]
[]
5
"""Logic Blocks devices.""" from typing import Any, List from mpf.core.delays import DelayManager from mpf.core.device_monitor import DeviceMonitor from mpf.core.events import event_handler from mpf.core.machine import MachineController from mpf.core.mode import Mode from mpf.core.mode_device import ModeDevice from mp...
null
v0
[ "int" ]
Any
def v0(self, v1: int=None, **v2): del kwargs if not self.enabled: return if v1 is not None and v1 != self._state.value: return self.debug_log('Processing Hit') self._state.value += 1 self._post_hit_events(step=self._state.value) if self._state.value >= len(self.config['events...
[]
[]
[]
11
"""Logic Blocks devices.""" from typing import Any, List from mpf.core.delays import DelayManager from mpf.core.device_monitor import DeviceMonitor from mpf.core.events import event_handler from mpf.core.machine import MachineController from mpf.core.mode import Mode from mpf.core.mode_device import ModeDevice from mp...
null
v0
[ "List", "int" ]
List
def v0(v1: List, v2: int) -> List: v3 = len(v1) assert len(v1) >= v2 v4 = 0 v5 = v1[:v2] assert len(v5) == v2 for v6 in range(0, v3): v4 = v4 + v1[v6]['priority'] if v6 < v2: continue v7 = v1[v6]['priority'] / v4 v8 = random.random() if v8 <= v...
[]
[ "random" ]
[ "import random" ]
16
""" OONI Probe Services API - URL prioritization """ from typing import List import random import time from flask import Blueprint, current_app, request from flask.json import jsonify prio_bp = Blueprint("prio", "probe_services_prio") # TODO add unit tests test_items = {} last_update_time = 0 def update_url_pri...
null
v0
[ "List" ]
List
def v0(v1: List) -> List: if not v1 or v1 is None: return [] return [x.to_dict() for v2 in v1]
[]
[]
[]
4
from typing import Tuple, List from flask import jsonify from flask.wrappers import Response def wrapped_response(data: dict = None, status: int = 200, message: str = "") -> Tuple[Response, int]: """ Create a wrapped response to have uniform json response objects """ if type(data) is not dict and da...
null
v37
[ "List[str]", "int", "int", "int", "int", "Any" ]
Any
def v37(v38: List[str], v39: int, v40: int, v41: int, v42: int, v43=10000): if v39 <= 0: raise ValueError('client_batch_size must be a positive integer; you have passed {}'.format(v39)) elif v40 <= 0: raise ValueError('client_epochs_per_round must be a positive integer; you have passed {}'.forma...
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2, v3):\n return v1.padded_batch(v3, padded_shapes=[v2 + 1]).map(split_input_target, num_parallel_calls=tf.data.experimental.AUTOTUNE)", "dependencies": [ "v27" ]...
[ "numpy", "tensorflow" ]
[ "import numpy as np", "import tensorflow as tf" ]
22
# Lint as: python3 # Copyright 2019, The TensorFlow Federated 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 ...
null
v32
[ "Path" ]
None
def v32(v33: Path) -> None: if sys.platform == 'win32' or sys.platform == 'cygwin': return None (v34, v35) = v0(v33) v36 = v20(v34, v35) if len(v36): print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') print('@ WARNING: UNPROTECTED SSL FILE! ...
[ { "name": "v0", "input_types": [ "Path" ], "output_type": "Tuple[List[Path], List[Path]]", "code": "def v0(v1: Path) -> Tuple[List[Path], List[Path]]:\n from littlelambocoin.ssl.create_ssl import get_mozilla_ca_crt\n v2: List[Path] = []\n v3: List[Path] = []\n try:\n v4:...
[ "pathlib", "sys" ]
[ "import sys", "from pathlib import Path" ]
13
import os import stat import sys from littlelambocoin.util.config import load_config, traverse_dict from littlelambocoin.util.permissions import octal_mode_string, verify_file_permissions from logging import Logger from pathlib import Path from typing import Dict, List, Optional, Set, Tuple DEFAULT_PERMISSIONS_CERT_FI...
null
v40
[ "Path" ]
None
def v40(v41: Path) -> None: if sys.platform == 'win32' or sys.platform == 'cygwin': return None v42: bool = False v43: bool = False (v44, v45) = v8(v41) v46 = v28(v44, v45) for (v47, v48, v49) in v46: (v50, v51) = v0(v47, v48, v49) if v51: v42 = True i...
[ { "name": "v0", "input_types": [ "Path", "int", "int" ], "output_type": "Tuple[bool, bool]", "code": "def v0(v1: Path, v2: int, v3: int) -> Tuple[bool, bool]:\n if sys.platform == 'win32' or sys.platform == 'cygwin':\n return (True, False)\n v4: bool = True\n v5...
[ "os", "pathlib", "sys" ]
[ "import os", "import sys", "from pathlib import Path" ]
19
import os import stat import sys from stai.util.config import load_config, traverse_dict from stai.util.permissions import octal_mode_string, verify_file_permissions from logging import Logger from pathlib import Path from typing import Dict, List, Optional, Set, Tuple DEFAULT_PERMISSIONS_CERT_FILE: int = 0o644 DEFAUL...
null
v0
[ "str", "str" ]
Any
def v0(v1: str, v2: str=None): if v2: v3 = hmac.new(v2, msg=v1, digestmod=hashlib.sha256).digest() v4 = base64.b64encode(v3).decode() else: v5 = hashlib.sha256() v5.update(v1) v4 = v5.hexdigest() return v4
[]
[ "base64", "hashlib", "hmac" ]
[ "import hmac", "import hashlib", "import base64" ]
9
# -*- coding: utf-8 -*- import hmac import hashlib import base64 """ unit : utils descritption: Collection of functions used in all projetcts author : Alcindo Schleder version : 1.0.0 package : i-City Identification Plataform """ def isnumber(value): try: float(valu...
null
v5
[ "str", "Any", "bool", "bool" ]
Any
def v5(v6: str, v7, v8: bool=False, v9: bool=False): v10 = getattr(v7, v6) if isinstance(v10, property) or type(v10).__name__ == 'getset_descriptor': if v8: def v11(self): return getattr(self._data, v6) v11.__name__ = v6 v11.__doc__ = v10.__doc__ ...
[ { "name": "v0", "input_types": [], "output_type": "Any", "code": "def v0(self):\n return getattr(self._data, name)", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "Any", "code": "def v1(self):\n v2 = getattr(self._data, name)\n if wrap:\n ...
[ "pandas" ]
[ "from pandas.compat.numpy import function as nv", "from pandas.errors import AbstractMethodError", "from pandas.util._decorators import cache_readonly, doc", "from pandas.core.dtypes.cast import find_common_type, infer_dtype_from", "from pandas.core.dtypes.common import is_dtype_equal, is_object_dtype, pand...
43
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
null
v26
[ "List[str]", "Any", "bool", "bool" ]
Any
def v26(v27: List[str], v28, v29: bool=False, v30: bool=False): def v31(cls): for v32 in v27: v33 = v7(v32, v28, cache=v29, wrap=v30) setattr(cls, v32, v33) return cls return v31
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n if isinstance(v1, Index):\n return v1._data\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [], "output_type": "Any", "code": "def v2(self):\n r...
[ "pandas" ]
[ "from pandas.compat.numpy import function as nv", "from pandas.errors import AbstractMethodError", "from pandas.util._decorators import cache_readonly, doc", "from pandas.core.dtypes.cast import find_common_type, infer_dtype_from", "from pandas.core.dtypes.common import is_dtype_equal, is_object_dtype, pand...
8
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
null
v5
[ "str" ]
Any
def v5(v6: str): def v7(self, v8): if isinstance(v8, ABCSeries): v8 = v8._values v8 = v0(v8) v9 = getattr(self._data, v6) return v9(v8) v7.__name__ = v6 return v7
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n if isinstance(v1, Index):\n return v1._data\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [ "Any" ], "output_type": "Any", "code": "def...
[ "pandas" ]
[ "from pandas.compat.numpy import function as nv", "from pandas.errors import AbstractMethodError", "from pandas.util._decorators import cache_readonly, doc", "from pandas.core.dtypes.cast import find_common_type, infer_dtype_from", "from pandas.core.dtypes.common import is_dtype_equal, is_object_dtype, pand...
10
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
null
v10
[ "str" ]
Any
def v10(v11: str): def v12(self, v13): if isinstance(v13, Index) and is_object_dtype(v13.dtype) and (type(v13) is not Index): return NotImplemented v14 = getattr(self._data, v11) v15 = v14(v0(v13)) return v2(self, v13, v15) v12.__name__ = v11 return v12
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n if isinstance(v1, Index):\n return v1._data\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [ "Any", "Any" ], "output_type": "Any", ...
[ "pandas" ]
[ "from pandas.compat.numpy import function as nv", "from pandas.errors import AbstractMethodError", "from pandas.util._decorators import cache_readonly, doc", "from pandas.core.dtypes.cast import find_common_type, infer_dtype_from", "from pandas.core.dtypes.common import is_dtype_equal, is_object_dtype, pand...
10
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
null
v1
[ "int", "Any" ]
v0
def v1(self: v0, v2: int, v3) -> v0: v4 = self._data try: v5 = v4._validate_scalar(v3) except (ValueError, TypeError): (v6, v7) = infer_dtype_from(v3, pandas_dtype=True) v6 = find_common_type([self.dtype, v6]) return self.astype(v6).insert(v2, v3) else: v8 = np.co...
[]
[ "numpy", "pandas" ]
[ "import numpy as np", "from pandas.compat.numpy import function as nv", "from pandas.errors import AbstractMethodError", "from pandas.util._decorators import cache_readonly, doc", "from pandas.core.dtypes.cast import find_common_type, infer_dtype_from", "from pandas.core.dtypes.common import is_dtype_equa...
12
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
[ "v0 = TypeVar('_T', bound='NDArrayBackedExtensionIndex')" ]
v0
[ "Any", "Any" ]
Index
def v0(self, v1, v2) -> Index: v3 = self._data.copy() try: v3.putmask(v1, v2) except (TypeError, ValueError): return self.astype(object).putmask(v1, v2) return type(self)._simple_new(v3, name=self.name)
[]
[]
[]
7
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
null
v1
[ "np.ndarray", "v0" ]
v0
def v1(self: v0, v2: np.ndarray, v3: v0) -> v0: v4 = get_op_result_name(self, v3) v5 = self._data._from_backing_data(v2) return type(self)._simple_new(v5, name=v4)
[]
[ "pandas" ]
[ "from pandas.compat.numpy import function as nv", "from pandas.errors import AbstractMethodError", "from pandas.util._decorators import cache_readonly, doc", "from pandas.core.dtypes.cast import find_common_type, infer_dtype_from", "from pandas.core.dtypes.common import is_dtype_equal, is_object_dtype, pand...
4
""" Shared methods for Index subclasses backed by ExtensionArray. """ from typing import ( Hashable, List, Type, TypeVar, Union, ) import numpy as np from pandas.compat.numpy import function as nv from pandas.errors import AbstractMethodError from pandas.util._decorators import ( cache_readonl...
[ "v0 = TypeVar('_T', bound='NDArrayBackedExtensionIndex')" ]
v0
[ "List[str]", "Dict[str, timedelta]" ]
None
def v0(self, v1: List[str], v2: Dict[str, timedelta]) -> None: for (v3, v4) in v2.items(): if v3 in v1: self.reading_durations[v3] = v4
[]
[]
[]
4
""" sphinx.ext.duration ~~~~~~~~~~~~~~~~~~~ Measure durations of Sphinx processing. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from datetime import datetime, timedelta from itertools import islice from operator import itemgetter fr...
null
v0
[ "Tuple", "str", "str" ]
Any
def v0(self, v1: Tuple, v2: str, v3: str): if len(v1) < 2 or len(v1) > 3: raise ValueError('Coordinate must be a tuple contains (x, y) or (x, y, z) coordinates') if len(v1) == 2: v4 = f'x={v1[0]}&y={v1[1]}' else: v4 = f'x={v1[0]}&y={v1[1]}&z={v1[2]}' v4 += f'&s_srs={v2}&t_srs={v3...
[]
[ "json", "requests" ]
[ "import requests", "import json" ]
12
import requests from abc import ABC, abstractmethod from typing import Tuple, List import json class CoordinateConverter(ABC): def __init__(self): super().__init__() @abstractmethod def convert_coordinate(self, coordinate: Tuple, base_system_code, target_system_code): pass @abstractm...
null
v0
[ "List[Tuple]", "Any", "Any" ]
Any
def v0(self, v1: List[Tuple], v2, v3): if len(v1[0]) < 2 or len(v1[0]) > 3: raise ValueError('Coordinates must be a list of tuple contains (x, y) or (x, y, z) coordinates') v4 = 'data=' for (v5, v6) in enumerate(v1): v4 += ','.join([str(c) for v7 in v6]) if v5 != len(v6) - 1: ...
[]
[ "json", "requests" ]
[ "import requests", "import json" ]
17
import requests from abc import ABC, abstractmethod from typing import Tuple, List import json class CoordinateConverter(ABC): def __init__(self): super().__init__() @abstractmethod def convert_coordinate(self, coordinate: Tuple, base_system_code, target_system_code): pass @abstractm...
null
v26
[ "config.Loader", "str" ]
Optional[Callable[..., Generator[Dict[str, Any], Dict[str, Any], None]]]
def v26(v27: config.Loader, v28: str) -> Optional[Callable[..., Generator[Dict[str, Any], Dict[str, Any], None]]]: v0(v27) v29 = v28.find(':') if v29 <= 0: return None v30 = v28[:v29] return getattr(v27, '_downloaders').get(v30, None)
[ { "name": "v0", "input_types": [ "config.Loader" ], "output_type": "Any", "code": "def v0(v1: config.Loader):\n v2 = getattr(v1, '_downloaders', None)\n if v2:\n return v2\n v2 = {'https': aria2c_downloader, 'http': aria2c_downloader, 'ftp': aria2c_downloader, 's3': awscli_...
[ "contextlib", "hashlib", "os", "tempfile" ]
[ "import os", "import tempfile", "import hashlib", "from contextlib import ExitStack" ]
7
""" Downloading input files from URIs, with plugin modules for different URI schemes Download URI plugins are installed & registered using the setuptools entry point group "miniwdl.plugin.file_download", with name equal to the URI scheme (e.g. "gs" or "s3"). The plugin entry point should be a context manager, which t...
null
v0
[ "config.Loader", "logging.Logger", "str" ]
Generator[Dict[str, Any], Dict[str, Any], None]
def v0(v1: config.Loader, v2: logging.Logger, v3: str, **v4) -> Generator[Dict[str, Any], Dict[str, Any], None]: v5 = '\n task aria2c {\n input {\n String uri\n Int connections = 10\n }\n command <<<\n set -euxo pipefail\n mkdir __out\n ...
[]
[]
[]
4
""" Downloading input files from URIs, with plugin modules for different URI schemes Download URI plugins are installed & registered using the setuptools entry point group "miniwdl.plugin.file_download", with name equal to the URI scheme (e.g. "gs" or "s3"). The plugin entry point should be a context manager, which t...
null
v0
[ "config.Loader", "logging.Logger", "str" ]
Generator[Dict[str, Any], Dict[str, Any], None]
def v0(v1: config.Loader, v2: logging.Logger, v3: str, **v4) -> Generator[Dict[str, Any], Dict[str, Any], None]: if v3 == 'gs://8675309': raise RuntimeError("don't change your number") v5 = '\n task gsutil_cp {\n input {\n String uri\n }\n command <<<\n set ...
[]
[]
[]
5
""" Downloading input files from URIs, with plugin modules for different URI schemes Download URI plugins are installed & registered using the setuptools entry point group "miniwdl.plugin.file_download", with name equal to the URI scheme (e.g. "gs" or "s3"). The plugin entry point should be a context manager, which t...
null
v0
[ "int", "float", "float" ]
Any
def v0(self, v1: int=1, v2: float=1, v3: float=100): self.decelerate(rate=v1, perSec=v2, speedFrom=v3) self.pwmEnable.value = 0.0
[]
[]
[]
3
""" PI power 5V on pin GND on pin The GPIO mode is set to BCM H-Bridge Motor Driver Pin Configuration in1 -> BCM 05 (board pin 29 or GPIO 5) in2 -> BCM 06 (board pin 31 or GPIO 6) enable -> BCM 13 (board pin 33 or GPIO 13, PWM) PCA9685 (16-Channel Servo Driver) Pin Configuration SDA -> BCM 2 (board pin ...
null
v0
[ "float" ]
Any
def v0(self, v1: float=1.0): self.motor.backward() self.pwmEnable.value = v1
[]
[]
[]
3
""" PI power 5V on pin GND on pin The GPIO mode is set to BCM H-Bridge Motor Driver Pin Configuration in1 -> BCM 05 (board pin 29 or GPIO 5) in2 -> BCM 06 (board pin 31 or GPIO 6) enable -> BCM 13 (board pin 33 or GPIO 13, PWM) PCA9685 (16-Channel Servo Driver) Pin Configuration SDA -> BCM 2 (board pin ...
null
v0
[ "str" ]
Any
def v0(v1: str): v2 = input(v1) while v2 not in {'', '1', '2', '3', '4', '5'}: v2 = input('Choose an integer between 1 and 5 or leave blank: ') v2 = int(v2) if v2 != '' else np.nan return v2
[]
[ "numpy" ]
[ "import numpy as np" ]
6
""" Launching point and supporting functions for database management tools. This module serves as the launching point for the database management tools. Backend-specific implementations are located within their specific modules and common functions and methods are included in this file. """ import numpy as np from t...
null
v0
[ "FilePathOrBuffer[AnyStr]" ]
FilePathOrBuffer[AnyStr]
def v0(v1: FilePathOrBuffer[AnyStr]) -> FilePathOrBuffer[AnyStr]: if isinstance(v1, str): return os.path.expanduser(v1) return v1
[]
[ "os" ]
[ "import os" ]
4
"""Common IO api utilities""" import bz2 from collections import abc import gzip from io import BufferedIOBase, BytesIO, RawIOBase import mmap import os import pathlib from typing import ( IO, TYPE_CHECKING, Any, AnyStr, Dict, List, Mapping, Optional, Tuple, Type, Union, ) f...
null
v0
[ "object" ]
None
def v0(v1: object) -> None: if isinstance(v1, bool): raise TypeError('Passing a bool to header is invalid. Use header=None for no header or header=int or list-like of ints to specify the row(s) making up the column names')
[]
[]
[]
3
"""Common IO api utilities""" from __future__ import annotations import bz2 import codecs from collections import abc import dataclasses import functools import gzip from io import ( BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOBase, TextIOWrapper, ) import mmap import os from pathlib im...
null
v2
[ "FilePathOrBuffer[AnyStr]", "bool" ]
FileOrBuffer[AnyStr]
def v2(v3: FilePathOrBuffer[AnyStr], v4: bool=False) -> FileOrBuffer[AnyStr]: if not v4 and is_file_like(v3): return cast(FileOrBuffer[AnyStr], v3) if isinstance(v3, os.PathLike): v3 = v3.__fspath__() return v0(v3)
[ { "name": "v0", "input_types": [ "FileOrBuffer[AnyStr]" ], "output_type": "FileOrBuffer[AnyStr]", "code": "def v0(v1: FileOrBuffer[AnyStr]) -> FileOrBuffer[AnyStr]:\n if isinstance(v1, str):\n return os.path.expanduser(v1)\n return v1", "dependencies": [] } ]
[ "os", "pandas", "typing" ]
[ "import os", "from typing import IO, Any, AnyStr, Dict, List, Mapping, Optional, Tuple, Union, cast", "from pandas._typing import Buffer, CompressionDict, CompressionOptions, FileOrBuffer, FilePathOrBuffer, StorageOptions", "from pandas.compat import get_lzma_file, import_lzma", "from pandas.compat._optiona...
6
"""Common IO api utilities""" from __future__ import annotations import bz2 import codecs from collections import abc import dataclasses import gzip from io import BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOWrapper import mmap import os from typing import IO, Any, AnyStr, Dict, List, Mapping, Optional, Tuple,...
null
v5
[ "FilePathOrBuffer" ]
bool
def v5(v6: FilePathOrBuffer) -> bool: v7 = False v6 = v2(v6) if not isinstance(v6, str): return v7 try: v7 = os.path.exists(v6) except (TypeError, ValueError): pass return v7
[ { "name": "v0", "input_types": [ "FileOrBuffer[AnyStr]" ], "output_type": "FileOrBuffer[AnyStr]", "code": "def v0(v1: FileOrBuffer[AnyStr]) -> FileOrBuffer[AnyStr]:\n if isinstance(v1, str):\n return os.path.expanduser(v1)\n return v1", "dependencies": [] }, { "nam...
[ "os", "pandas", "typing" ]
[ "import os", "from typing import IO, Any, AnyStr, Dict, List, Mapping, Optional, Tuple, Union, cast", "from pandas._typing import Buffer, CompressionDict, CompressionOptions, FileOrBuffer, FilePathOrBuffer, StorageOptions", "from pandas.compat import get_lzma_file, import_lzma", "from pandas.compat._optiona...
10
"""Common IO api utilities""" from __future__ import annotations import bz2 import codecs from collections import abc import dataclasses import gzip from io import BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOWrapper import mmap import os from typing import IO, Any, AnyStr, Dict, List, Mapping, Optional, Tuple,...
null
v0
[]
None
def v0(self) -> None: if self.multiple_write_buffer is None or self.multiple_write_buffer.closed: return v1 = self.archive_name or self.infer_filename() or 'zip' with self.multiple_write_buffer: super().writestr(v1, self.multiple_write_buffer.getvalue())
[]
[]
[]
6
"""Common IO api utilities""" from __future__ import annotations import bz2 import codecs from collections import abc import dataclasses import functools import gzip from io import ( BufferedIOBase, BytesIO, RawIOBase, StringIO, TextIOBase, TextIOWrapper, ) import mmap import os from pathlib im...
null
v0
[]
Mapping[str, Any]
def v0(self) -> Mapping[str, Any]: if self._schema != {}: v1 = deepcopy(self._schema) else: v1 = self._get_master_schema() v1[self.ab_additional_col] = 'object' v1[self.ab_last_mod_col] = 'string' v1[self.ab_file_name_col] = 'string' return v1
[]
[ "copy" ]
[ "from copy import deepcopy" ]
9
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[]
Mapping[str, Any]
def v0(self) -> Mapping[str, Any]: v1 = {} for (v2, v3) in self._get_schema_map().items(): v1[v2] = {'type': ['null', v3]} if v2 not in self.airbyte_columns else {'type': v3} v1[self.ab_last_mod_col]['format'] = 'date-time' return {'type': 'object', 'properties': v1}
[]
[]
[]
6
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[ "Mapping[str, Any]", "List" ]
Mapping[str, Any]
def v0(self, v1: Mapping[str, Any], v2: List) -> Mapping[str, Any]: v3 = [c for v4 in v2 if v4 not in [self.ab_last_mod_col, self.ab_file_name_col]] if set(list(v1.keys()) + [self.ab_additional_col]) == set(v3): v1[self.ab_additional_col] = {} return v1 for v4 in [col for v5 in v3 if v5 != s...
[]
[ "copy" ]
[ "from copy import deepcopy" ]
12
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[ "Mapping[str, Any]", "Mapping[str, Any]" ]
Mapping[str, Any]
def v0(self, v1: Mapping[str, Any], v2: Mapping[str, Any]) -> Mapping[str, Any]: for (v3, v4) in v2.items(): v1[v3] = v4 return v1
[]
[]
[]
4
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[ "Mapping[str, Any]" ]
datetime
def v0(self, v1: Mapping[str, Any]=None) -> datetime: if v1 is not None and self.cursor_field in v1.keys(): return datetime.strptime(v1[self.cursor_field], self.datetime_format_string) else: return datetime.strptime('1970-01-01T00:00:00+0000', self.datetime_format_string)
[]
[ "datetime" ]
[ "from datetime import datetime" ]
5
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[ "MutableMapping[str, Any]", "Mapping[str, Any]" ]
Mapping[str, Any]
def v0(self, v1: MutableMapping[str, Any], v2: Mapping[str, Any]) -> Mapping[str, Any]: v3 = {} v4 = self._get_datetime_from_stream_state(v1) v5 = datetime.strptime(v2.get(self.cursor_field, '1970-01-01T00:00:00+0000'), self.datetime_format_string) v3[self.cursor_field] = datetime.strftime(max(v4, v5), ...
[]
[ "datetime" ]
[ "from datetime import datetime" ]
7
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[ "str" ]
Tuple[datetime, str]
def v0(v1: str) -> Tuple[datetime, str]: v2 = self.storagefile_class(v1, self._provider) return (v2.last_modified, v1)
[]
[]
[]
3
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import concurrent import json from abc import ABC, abstractmethod from copy import deepcopy from datetime import datetime from functools import lru_cache from operator import itemgetter from traceback import format_exc from typing import Any, Iterable, Iter...
null
v0
[ "int" ]
[]
def v0(v1: int) -> []: v2 = [] for v3 in range(1, v1): v4 = v3 * v3 v5 = v3 + 1 v6 = v5 + 1 while v6 <= v1: v7 = v4 + v5 * v5 while v6 * v6 < v7: v6 += 1 if v6 * v6 == v7 and v6 <= v1: v2.append([v3 + v5 + v6, v3...
[]
[]
[]
14
from problems.problem import Problem def generate_pythagorean_triples(ub: int) -> []: # https://en.wikipedia.org/wiki/Pythagorean_triple result = [] for a in range(1, ub): aa = a * a b = a + 1 c = b + 1 while c <= ub: cc = aa + b * b while c * c < cc: c += 1 if c * c == ...
null
v8
[]
int
def v8(self) -> int: v9 = 0 v10 = 1000 v11 = [0 for v12 in range(v10 + 1)] v13 = v0(v10 // 2 + 1) v14 = 0 for v15 in v13: v16 = v15[0] if v16 <= v10: v11[v16] += 1 v17 = v11[v16] if v17 > v14: v14 = v17 v9 = v16 ...
[ { "name": "v0", "input_types": [ "int" ], "output_type": "[]", "code": "def v0(v1: int) -> []:\n v2 = []\n for v3 in range(1, v1):\n v4 = v3 * v3\n v5 = v3 + 1\n v6 = v5 + 1\n while v6 <= v1:\n v7 = v4 + v5 * v5\n while v6 * v6 < v7:\...
[]
[]
16
from problems.problem import Problem def generate_pythagorean_triples(ub: int) -> []: # https://en.wikipedia.org/wiki/Pythagorean_triple result = [] for a in range(1, ub): aa = a * a b = a + 1 c = b + 1 while c <= ub: cc = aa + b * b while c * c < cc: c += 1 if c * c == ...
null
v0
[ "str", "str", "str" ]
Any
def v0(v1: str, v2: str, v3: str): v4 = v2[:v2.rfind('/')] v5 = v2[v2.rfind('/') + 1:v2.rfind('.')] v1 = f'{v4}/{v5}_{v3}.pkl' if os.path.isfile(v1): with open(v1, 'rb') as v6: v7 = pickle.load(v6) return (v7, v1, v4) return (None, v1, v4)
[]
[ "os", "pickle" ]
[ "import os", "import pickle" ]
9
# Copyright (c) 2020, NVIDIA CORPORATION. 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
[]
None
def v0(self) -> None: if self.activeRegion is None: return self.activeRegion.canvasRectId = 0 self.current.addRegion(self.activeRegion) self.activeRegion = None
[]
[]
[]
6
""" The business model core of the application. """ from typing import List, Union from PIL import Image from .annotated_image import AnnotatedImage from .scaled_region2d import ScaledRegion2d from .timer import Timer from src.model import Size2d, Region2d def clearImagesOutsideRange( annotatedImages: List[Ann...
null
v0
[ "int" ]
int | None
def v0(self, v1: int) -> int | None: v2 = self.currentIndex while 0 <= v2 < len(self._annotatedImages): v2 += v1 if self._annotatedImages[v2].isTagged: return v2 return None
[]
[]
[]
7
""" The business model core of the application. """ from typing import List, Union from PIL import Image from .annotated_image import AnnotatedImage from .scaled_region2d import ScaledRegion2d from .timer import Timer from src.model import Size2d, Region2d def clearImagesOutsideRange( annotatedImages: List[Ann...
null
v8
[ "int" ]
Any
def v8(self, v9: int): assert self.isValidIndex(v9) self._currentIndex = v9 self.maxViewed = max(self.maxViewed, self._currentIndex) if self.current.image is None: self.current.image = Image.open(self.current.filePath) self.current.image.load() self.current.scaleImageForSize(self._wi...
[ { "name": "v0", "input_types": [ "List[AnnotatedImage]", "int", "int", "int" ], "output_type": "None", "code": "def v0(v1: List[AnnotatedImage], v2: int, v3: int=10, v4: int=10) -> None:\n v5 = max(0, v2 - v3)\n v6 = min(v2 + v4, len(v1) - 1)\n for v7 in range(0,...
[ "PIL" ]
[ "from PIL import Image" ]
12
""" The business model core of the application. """ from typing import List, Union from PIL import Image from .annotated_image import AnnotatedImage from .scaled_region2d import ScaledRegion2d from .timer import Timer from src.model import Size2d, Region2d def clearImagesOutsideRange( annotatedImages: List[Ann...
null