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
v17
[ "int", "Sequence[float]", "Union[float, Sequence[float]]", "int", "bool", "Any" ]
Any
def v17(v18: int, v19: Sequence[float], v20: Union[float, Sequence[float]], v21: int, v22: bool=False, v23=None): v24 = v0(v18, v19, v20) return v7(v24, v21, v22, v23)
[ { "name": "v0", "input_types": [ "int", "Sequence[float]", "Union[float, Sequence[float]]" ], "output_type": "np.ndarray", "code": "def v0(v1: int, v2: Sequence[float], v3: Union[float, Sequence[float]]) -> np.ndarray:\n if isinstance(v3, float):\n v3 = [v3, 1 - v3]\n...
[ "numpy" ]
[ "import numpy as np" ]
3
# coding: utf-8 # # This code is part of cmpy. # # Copyright (c) 2022, Dylan Jones """This module contains methods for modeling disorder.""" import numpy as np from typing import Union, Sequence def create_subst_array( size: int, values: Sequence[float], conc: Union[float, Sequence[float]] ) -> np.ndarray: ...
null
v0
[ "int", "int" ]
int
def v0(self, v1: int, v2: int) -> int: if v1 > 0: return self.nums[v2] - self.nums[v1 - 1] else: return self.nums[v2]
[]
[]
[]
5
class NumArray: # O(n) time | O(n) space - where n is the length of the input list def __init__(self, nums: List[int]): self.nums = [] currentSum = 0 for num in nums: currentSum += num self.nums.append(currentSum) # O(1) time to look up the nums list def s...
null
v0
[ "dict" ]
bool
def v0(self, v1: dict) -> bool: try: v2 = self._get_transaction_time(v1['timestamp'], v1['attachment_timestamp']) return v2 <= self._max and v2 >= self._min except: logging.error('Objects for time filtering (min<=time<=max) do not have time item!')
[]
[ "logging" ]
[ "import logging" ]
6
from typing import Callable from datetime import datetime, timezone from time import mktime from ..common.const import ( MILESTONES_USING_TIMESTAMP_ONLY, TIMESTAMP_B, TIMESTAMP_E, ATCH_TIMESTAMP_B, ATCH_TIMESTAMP_E ) from ..common import tryte_to_int import logging __all__ = [ 'TimeFilter', ] ...
null
v0
[ "Any" ]
Callable
def v0(self, v1='R') -> Callable: if v1 == 'R': return self._dmptime_range_filter_str elif v1 == 'm': return self._dmptime_filter_larger_than_min_str elif v1 == 'M': return self._dmptime_filter_smaller_than_max_str elif v1 == 'E': return self._dmptime_euqal_filter_str ...
[]
[]
[]
17
from typing import Callable from datetime import datetime, timezone from time import mktime from ..common.const import ( MILESTONES_USING_TIMESTAMP_ONLY, TIMESTAMP_B, TIMESTAMP_E, ATCH_TIMESTAMP_B, ATCH_TIMESTAMP_E ) from ..common import tryte_to_int import logging __all__ = [ 'TimeFilter', ] ...
null
v0
[ "torch.nn.Module", "Any", "Any" ]
Any
def v0(self, v1: torch.nn.Module, v2, v3=None): v3 = v3 if v3 else {} v4 = v1(*v2, **v3) v5 = symbolic_trace(v1) v5.graph.lint() v6 = v5(*v2, **v3) self.assertEqual(v4, v6)
[]
[ "torch" ]
[ "import torch", "from torch.multiprocessing import Process", "from torch.testing import FileCheck", "from torch.testing._internal.common_methods_invocations import op_db", "from torch.testing._internal.common_device_type import ops, onlyCPU, instantiate_device_type_tests", "import torch.utils._pytree as p...
7
# Owner(s): ["oncall: fx"] import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import typing import types import warnings import unittest from math import sqrt from torch.multiprocessin...
null
v0
[ "str", "Union[str, Callable]", "Tuple[Argument, ...]", "Dict[str, Any]", "Optional[str]", "Optional[Any]" ]
Node
def v0(self, v1: str, v2: Union[str, Callable], v3: Tuple[Argument, ...], v4: Dict[str, Any], v5: Optional[str]=None, v6: Optional[Any]=None) -> Node: v7 = super().create_node(v1, v2, v3, v4, v5) v7.tag = 'foo' return v7
[]
[]
[]
4
# Owner(s): ["oncall: fx"] import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import typing import types import warnings import unittest from math import sqrt from torch.multiprocessin...
null
v0
[ "Node" ]
Any
def v0(self, v1: Node) -> Any: v2 = super().run_node(v1) v1.cached_value = v2 return v2
[]
[]
[]
4
# Owner(s): ["oncall: fx"] import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import typing import types import warnings import unittest from math import sqrt from torch.multiprocessin...
null
v0
[ "pd.Series" ]
pd.DataFrame
def v0(self, v1: pd.Series) -> pd.DataFrame: v2 = pd.DataFrame(zip(v1['Numbering'], v1['Insertion'], v1['Numbered_Sequence']), columns=['numbering', 'insertion', 'sequence']).assign(Id=v1['Id']).pivot('Id', ['numbering', 'insertion'], 'sequence') return v2
[]
[ "pandas" ]
[ "import pandas as pd" ]
3
import logging import pandas as pd from ast import literal_eval from .constants import NUMBERING_RESULTS from sadie.numbering.scheme_numbering import scheme_numbering logger = logging.getLogger("NUMBERING") class NumberingResults(pd.DataFrame): def __init__(self, *args, scheme="", region_definition="", allowed_...
null
v0
[]
dict
def v0(self) -> dict: v1 = self.rng.random() if v1 < 1 / 3: v2 = 'convai2' elif v1 < 2 / 3: v2 = 'empathetic_dialogues' else: v2 = 'wizard_of_wikipedia' if v2 == 'convai2': v3 = self.rng.randrange(self.convai2_teacher.num_episodes()) (v4, v5) = self._extract_p...
[]
[]
[]
69
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import os import random import re from collections import defaultdict from typing import List, Optional, Dic...
null
v0
[]
Dict[str, List[int]]
def v0(self) -> Dict[str, List[int]]: print('Starting to map topics to episodes.') v1 = defaultdict(list) for v2 in range(self.wow_teacher.num_episodes()): v3 = self.wow_teacher.get(v2, entry_idx=0)['chosen_topic'] v1[v3].append(v2) print('Finished mapping topics to episodes.') retur...
[]
[ "collections" ]
[ "from collections import defaultdict" ]
8
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import os import random import re from collections import defaultdict from typing import List, Optional, Dic...
null
v0
[ "str" ]
Tuple[List[str], List[str]]
def v0(self, v1: str) -> Tuple[List[str], List[str]]: v2 = self.convai2_teacher.get(v1, entry_idx=0) v3 = v2['text'].split('\n') v4 = [] v5 = [] for v6 in v3[:-1]: if v6.startswith('your persona: '): v5.append(v6[len('your persona: '):]) elif v6.startswith("partner's pers...
[]
[]
[]
13
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import os import random import re from collections import defaultdict from typing import List, Optional, Dic...
null
v0
[ "torch.Tensor", "torch.LongTensor" ]
Any
def v0(v1: torch.Tensor, v2: torch.LongTensor): assert not v1.requires_grad and v1.device == v2.device assert v1.dim() == 2 and v1.shape[0] == v2.shape[0] (v3, v4) = torch.max(v1, dim=1) v5 = v4 == v2 v6 = v5.sum() / len(v5) return v6
[]
[ "torch" ]
[ "import torch", "import torch.cuda.amp as amp", "from torch.optim.lr_scheduler import LambdaLR", "from torch.nn.parallel import DistributedDataParallel as DDP" ]
7
from mycv.utils.general import disable_multithreads disable_multithreads() import os from pathlib import Path import argparse from tqdm import tqdm import math import torch import torch.cuda.amp as amp from torch.optim.lr_scheduler import LambdaLR from torch.nn.parallel import DistributedDataParallel as DDP import wand...
null
v0
[ "Any" ]
tuple
def v0(self, v1=0) -> tuple: if isinstance(v1, int): v2 = v1 elif isinstance(v1, str): v2 = self.channel_names.index(v1) else: raise TypeError('channel: expected {int, str}, got %s' % type(v1)) v1 = self.channels[v2] v3 = v1.argmin() return tuple((a[v3] for v4 in self._ax...
[]
[]
[]
10
"""Central data class and associated.""" # --- import -------------------------------------------------------------------------------------- import collections import operator import functools import warnings import numpy as np import h5py import scipy from scipy.interpolate import griddata, interp1d from .._gr...
null
v0
[ "str" ]
pandas.DataFrame
def v0(v1: str) -> pandas.DataFrame: with open(v1, 'r') as v2: v3 = v2.readline().lstrip('#').split() return pandas.read_csv(v1, sep='\t', comment='#', names=v3)
[]
[ "pandas" ]
[ "import pandas" ]
4
#!/usr/bin/env python import sys from typing import Sequence, Set import argparse import numpy import pandas _zero_svs_are_outliers = True _outlier_std_threshold = 5.0 _column_order = ["CHROM", "SVTYPE", "Mean", "Median", "STD", "Outlier_Sample", "Outlier_Number", "Outlier_Cate"] def read_statfile...
null
v15
[ "pandas.DataFrame", "bool", "float" ]
pandas.DataFrame
def v15(v16: pandas.DataFrame, v17: bool=_zero_svs_are_outliers, v18: float=_outlier_std_threshold) -> pandas.DataFrame: v19 = set(v16['SAMPLE']) v20 = pandas.concat(tuple((v0(chrom=chrom, sv_type=sv_type, check_stats=check_stats, all_samples=v19, zero_svs_are_outliers=v17, outlier_std_threshold=v18) for ((v21,...
[ { "name": "v0", "input_types": [ "str", "str", "pandas.DataFrame", "Set[str]", "bool", "float" ], "output_type": "pandas.DataFrame", "code": "def v0(v1: str, v2: str, v3: pandas.DataFrame, v4: Set[str], v5: bool=_zero_svs_are_outliers, v6: float=_outlier_std_t...
[ "numpy", "pandas" ]
[ "import numpy", "import pandas" ]
4
#!/usr/bin/env python import sys from typing import Sequence, Set import argparse import numpy import pandas _zero_svs_are_outliers = True _outlier_std_threshold = 5.0 _column_order = ["CHROM", "SVTYPE", "Mean", "Median", "STD", "Outlier_Sample", "Outlier_Number", "Outlier_Cate"] def read_statfile...
null
v0
[ "pandas.DataFrame", "str", "str" ]
Any
def v0(v1: pandas.DataFrame, v2: str, v3: str): with open(v2 + '.' + v3, 'w') as v4: v4.write('#') v5 = v1['Outlier_Cate'] == v3 v1.loc[v5].to_csv(v4, sep='\t', index=False)
[]
[]
[]
5
#!/usr/bin/env python import sys from typing import Sequence, Set import argparse import numpy import pandas _zero_svs_are_outliers = True _outlier_std_threshold = 5.0 _column_order = ["CHROM", "SVTYPE", "Mean", "Median", "STD", "Outlier_Sample", "Outlier_Number", "Outlier_Cate"] def read_statfile...
null
v34
[ "str", "str", "bool", "float" ]
Any
def v34(v35: str, v36: str, v37: bool=_zero_svs_are_outliers, v38: float=_outlier_std_threshold): v39 = v24(v35) v40 = v0(v39, zero_svs_are_outliers=v37, outlier_std_threshold=v38) v28(v40, v36, 'low') v28(v40, v36, 'high')
[ { "name": "v0", "input_types": [ "pandas.DataFrame", "bool", "float" ], "output_type": "pandas.DataFrame", "code": "def v0(v1: pandas.DataFrame, v2: bool=_zero_svs_are_outliers, v3: float=_outlier_std_threshold) -> pandas.DataFrame:\n v4 = set(v1['SAMPLE'])\n v5 = pandas....
[ "numpy", "pandas" ]
[ "import numpy", "import pandas" ]
5
#!/usr/bin/env python import sys from typing import Sequence, Set import argparse import numpy import pandas _zero_svs_are_outliers = True _outlier_std_threshold = 5.0 _column_order = ["CHROM", "SVTYPE", "Mean", "Median", "STD", "Outlier_Sample", "Outlier_Number", "Outlier_Cate"] def read_statfile...
null
v0
[ "Any" ]
None
def v0(self, v1) -> None: for v2 in v1: if hasattr(v1[v2], 'tool_tip'): self.addItem(v2, v1[v2].tool_tip) else: self.addItem(v2)
[]
[]
[]
6
from qtpy.QtCore import QSize from qtpy.QtGui import QIcon from qtpy.QtWidgets import QListWidget, QListWidgetItem from pathlib import Path ICON_ROOT = Path(__file__).parent / "icons" STYLES = r""" QListWidget{ min-width: 294; background: none; font-size: 8pt; color: #eee; } ...
null
v0
[ "List[Tensor]" ]
Tensor
def v0(self, v1: List[Tensor]) -> Tensor: v2 = torch.cat(v1, 1) v3 = self.conv1(self.relu1(self.norm1(v2))) return v3
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "import torch.nn.functional as F", "import torch.utils.checkpoint as cp", "from torch import Tensor" ]
4
""" Vanilla DenseNet implementation Paper: https://arxiv.org/abs/1608.06993 Implementation taken from: https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py """ import re from collections import OrderedDict from functools import partial from typing import Any, List, Optional, Tuple import torch im...
null
v0
[ "List[Tensor]" ]
bool
def v0(self, v1: List[Tensor]) -> bool: for v2 in v1: if v2.requires_grad: return True return False
[]
[]
[]
5
""" Vanilla DenseNet implementation Paper: https://arxiv.org/abs/1608.06993 Implementation taken from: https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py """ import re from collections import OrderedDict from functools import partial from typing import Any, List, Optional, Tuple import torch im...
null
v0
[ "Tensor" ]
Tensor
def v0(self, v1: Tensor) -> Tensor: v2 = self.features(v1) v3 = F.relu(v2, inplace=True) v3 = F.adaptive_avg_pool2d(v3, (1, 1)) v3 = torch.flatten(v3, 1) v3 = self.classifier(v3) return v3
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "import torch.nn.functional as F", "import torch.utils.checkpoint as cp", "from torch import Tensor" ]
7
""" Vanilla DenseNet implementation Paper: https://arxiv.org/abs/1608.06993 Implementation taken from: https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py """ import re from collections import OrderedDict from functools import partial from typing import Any, List, Optional, Tuple import torch im...
null
v0
[ "Any", "Iterable[Dict]" ]
Any
def v0(v1, v2: Iterable[Dict]): v3 = False for v4 in v2: if isinstance(v4['acquired'], Iterable): v3 |= v1 in v4['acquired'] else: v3 |= v4['acquired'] == v1 return v3
[]
[ "typing" ]
[ "from typing import Any, Callable, Dict, Iterable, List, Optional, Type, Union" ]
8
""" Generic RPC functions for labby """ # import asyncio import asyncio from cgi import print_exception import os from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Optional, Type, Union import yaml from attr import attrib, attrs from autobahn.wamp.exception import ApplicationError from ...
null
v0
[ "AnyStr", "AnyStr", "AnyStr" ]
'Trafficlight'
def v0(self, v1: AnyStr, v2: AnyStr, v3: AnyStr) -> 'Trafficlight': v1 = v1.lower().strip() v2 = v2.lower().strip() self._triggers[v1] = self._triggers.get(v1, {}) self._triggers[v1][v2] = v3 return self
[]
[]
[]
6
"""Module implémentant des classes en relations avec le menu.""" from typing import Callable, Dict, List, Tuple, AnyStr class Trafficlight: """Modélise un feu de circulation présentant un état lumineux donné. wrarn : la couleur affectée par défaut n'est pas validée par l'init autrement dit on pe...
null
v0
[]
Tuple[Callable, Dict]
def v0(self, **v1) -> Tuple[Callable, Dict]: v2: Dict = {str(key): value for (v3, v4) in enumerate(self._triggers.keys())} while True: v5 = input(self).lower().strip() if v5 in v2: return (getattr(self, v2[v5]), {}) elif v5 in self._triggers['next']: return (getat...
[]
[]
[]
10
"""Module implémentant des classes en relations avec le menu.""" from typing import Callable, Dict, List, Tuple, AnyStr class Trafficlight: """Modélise un feu de circulation présentant un état lumineux donné. wrarn : la couleur affectée par défaut n'est pas validée par l'init autrement dit on pe...
null
v7
[ "List[v0]", "v0" ]
int
def v7(v8: List[v0], v9: v0) -> int: v10 = v1(v8, v9) v11 = v8[v10] if v11 != v9: raise PulseError('The interval: {} does not exist in intervals: {}'.format(v9, v8)) return v10
[ { "name": "v1", "input_types": [ "List[v0]", "v0", "int" ], "output_type": "int", "code": "def v1(v2: List[v0], v3: v0, v4: int=0) -> int:\n if not v2 or len(v2) == 1:\n return v4\n v5 = len(v2) // 2\n v6 = v2[v5]\n if v3[1] <= v6[0] and v3 != v6:\n re...
[ "qiskit" ]
[ "from qiskit.circuit.parameter import Parameter", "from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType", "from qiskit.pulse.channels import Channel", "from qiskit.pulse.exceptions import PulseError", "from qiskit.pulse.instructions import Instruction", "from qiskit.pulse...
6
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Tuple[int, int]" ]
v10
[ "List[v0]", "v0" ]
int
def v10(v11: List[v0], v12: v0) -> int: v13 = v1(v11, v12) if v13 < len(v11): if v7(v11[v13], v12): raise PulseError('New interval overlaps with existing.') return v13 if v12[1] <= v11[v13][0] else v13 + 1 return v13
[ { "name": "v1", "input_types": [ "List[v0]", "v0", "int" ], "output_type": "int", "code": "def v1(v2: List[v0], v3: v0, v4: int=0) -> int:\n if not v2 or len(v2) == 1:\n return v4\n v5 = len(v2) // 2\n v6 = v2[v5]\n if v3[1] <= v6[0] and v3 != v6:\n re...
[ "qiskit" ]
[ "from qiskit.circuit.parameter import Parameter", "from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType", "from qiskit.pulse.channels import Channel", "from qiskit.pulse.exceptions import PulseError", "from qiskit.pulse.instructions import Instruction", "from qiskit.pulse...
7
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Tuple[int, int]" ]
v1
[ "v0", "v0" ]
bool
def v1(v2: v0, v3: v0) -> bool: if v2[0] == v3[0] == v3[1]: return False if v2[0] > v3[0]: (v2, v3) = (v3, v2) return v3[0] < v2[1]
[]
[]
[]
6
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Tuple[int, int]" ]
v1
[ "v0" ]
Any
def v1(v2: v0): for (v3, v4) in v2.items(): if v4: if v4[0][0] < 0: raise PulseError('An instruction on {} has a negative starting time.'.format(v3))
[]
[ "qiskit" ]
[ "from qiskit.circuit.parameter import Parameter", "from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType", "from qiskit.pulse.channels import Channel", "from qiskit.pulse.exceptions import PulseError", "from qiskit.pulse.instructions import Instruction", "from qiskit.pulse...
5
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Dict[Channel, List[Tuple[int, int]]]" ]
v0
[]
int
def v0(self, *v1: List[Channel]) -> int: try: v2 = (self._timeslots[chan] for v3 in v1 if v3 in self._timeslots) return max((intervals[-1][1] for v4 in v2)) except ValueError: return 0
[]
[]
[]
6
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v0
[ "int" ]
Any
def v0(self, v1: int=0): for (v2, v3) in self._children: yield from v3._instructions(v1 + v2)
[]
[]
[]
3
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v0
[ "int", "Optional[str]", "bool" ]
'Schedule'
def v0(self, v1: int, v2: Optional[str]=None, v3: bool=False) -> 'Schedule': if v3: return self._mutable_shift(v1) return self._immutable_shift(v1, name=v2)
[]
[]
[]
4
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v5
[ "int" ]
'Schedule'
def v5(self, v6: int) -> 'Schedule': if not isinstance(v6, int): raise PulseError('Schedule start time must be an integer.') v7 = {} for (v8, v9) in self._timeslots.items(): v7[v8] = [(ts[0] + v6, ts[1] + v6) for v10 in v9] v1(v7) self._duration = self._duration + v6 self._timesl...
[ { "name": "v1", "input_types": [ "v0" ], "output_type": "Any", "code": "def v1(v2: v0):\n for (v3, v4) in v2.items():\n if v4:\n if v4[0][0] < 0:\n raise PulseError('An instruction on {} has a negative starting time.'.format(v3))", "dependencies": [...
[ "qiskit" ]
[ "from qiskit.circuit.parameter import Parameter", "from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType", "from qiskit.pulse.channels import Channel", "from qiskit.pulse.exceptions import PulseError", "from qiskit.pulse.instructions import Instruction", "from qiskit.pulse...
11
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Dict[Channel, List[Tuple[int, int]]]" ]
v0
[ "int", "Union['Schedule', Instruction]", "Optional[str]", "bool" ]
'Schedule'
def v0(self, v1: int, v2: Union['Schedule', Instruction], v3: Optional[str]=None, v4: bool=False) -> 'Schedule': if v4: return self._mutable_insert(v1, v2) return self._immutable_insert(v1, v2, name=v3)
[]
[]
[]
4
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v0
[ "int", "Union['Schedule', Instruction]" ]
'Schedule'
def v0(self, v1: int, v2: Union['Schedule', Instruction]) -> 'Schedule': self._add_timeslots(v1, v2) self.__children.append((v1, v2)) self._update_parameter_table(v2) return self
[]
[]
[]
5
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v0
[ "Union['Schedule', Instruction]", "Optional[str]", "bool" ]
'Schedule'
def v0(self, v1: Union['Schedule', Instruction], v2: Optional[str]=None, v3: bool=False) -> 'Schedule': v4 = set(self.channels) & set(v1.channels) v5 = self.ch_stop_time(*v4) return self.insert(v5, v1, name=v2, inplace=v3)
[]
[]
[]
4
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v1
[ "Optional[Iterable[Channel]]", "Any", "Optional[Iterable[Tuple[int, int]]]", "Optional[Iterable[v0]]" ]
'Schedule'
def v1(self, *v6: List[Callable], v2: Optional[Iterable[Channel]]=None, v3=None, v4: Optional[Iterable[Tuple[int, int]]]=None, v5: Optional[Iterable[v0]]=None) -> 'Schedule': v7 = self._construct_filter(*v6, channels=v2, instruction_types=v3, time_ranges=v4, intervals=v5) return self._apply_filter(v7, new_sched...
[]
[]
[]
3
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Tuple[int, int]" ]
v245
[ "int", "Union['Schedule', Instruction]" ]
None
def v245(self, v246: int, v247: Union['Schedule', Instruction]) -> None: if not np.issubdtype(type(v246), np.integer): raise PulseError('Schedule start time must be an integer.') v248 = v231(v247) self._duration = max(self._duration, v246 + v247.duration) for v249 in v247.channels: if v2...
[ { "name": "v223", "input_types": [ "v222" ], "output_type": "Any", "code": "def v223(v224: v222):\n for (v225, v226) in v224.items():\n if v226:\n if v226[0][0] < 0:\n raise PulseError('An instruction on {} has a negative starting time.'.format(v225))",...
[ "copy", "numpy", "qiskit" ]
[ "import copy", "import numpy as np", "from qiskit.circuit.parameter import Parameter", "from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType", "from qiskit.pulse.channels import Channel", "from qiskit.pulse.exceptions import PulseError", "from qiskit.pulse.instructions ...
23
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Tuple[int, int]", "class v1(abc.ABC):\n v2 = itertools.count()\n v3 = 'sched'\n\n def __init__(self, *v6: Union[Union['Schedule', Instruction], Tuple[int, Union['Schedule', Instruction]]], v4: Optional[str]=None, v5: Optional[dict]=None):\n \"\"\"Create an empty schedule.\n\n Args:\n ...
v239
[ "int", "Union['Schedule', Instruction]" ]
Any
def v239(self, v240: int, v241: Union['Schedule', Instruction]): if not isinstance(v240, int): raise PulseError('Schedule start time must be an integer.') for v242 in v241.channels: if v242 not in self._timeslots: raise PulseError('The channel {} is not present in the schedule'.forma...
[ { "name": "v223", "input_types": [ "Union[Instruction, v1]" ], "output_type": "v222", "code": "def v223(v224: Union[Instruction, v1]) -> v222:\n if isinstance(v224, Instruction):\n v225 = v224.duration\n instruction_duration_validation(v225)\n v226 = {channel: [(0, ...
[ "qiskit" ]
[ "from qiskit.circuit.parameter import Parameter", "from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType", "from qiskit.pulse.channels import Channel", "from qiskit.pulse.exceptions import PulseError", "from qiskit.pulse.instructions import Instruction", "from qiskit.pulse...
18
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "v0 = Tuple[int, int]", "class v1(abc.ABC):\n v2 = itertools.count()\n v3 = 'sched'\n\n def __init__(self, *v6: Union[Union['Schedule', Instruction], Tuple[int, Union['Schedule', Instruction]]], v4: Optional[str]=None, v5: Optional[dict]=None):\n \"\"\"Create an empty schedule.\n\n Args:\n ...
v0
[ "int", "Union['Schedule', Instruction]", "Union['Schedule', Instruction]" ]
Any
def v0(self, v1: int, v2: Union['Schedule', Instruction], v3: Union['Schedule', Instruction]): self._remove_timeslots(v1, v2) self._add_timeslots(v1, v3)
[]
[]
[]
3
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v0
[ "'Schedule'" ]
Any
def v0(self, v1: 'Schedule'): v1 = v1.flatten() for (v2, v3) in v1.instructions: for v4 in v3.parameters: self._parameter_table[v4].append(v3)
[]
[]
[]
5
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v6
[ "Union[Set[Channel], Channel]" ]
Callable
def v6(v7: Union[Set[Channel], Channel]) -> Callable: v7 = v4(v7) def v8(v9) -> bool: """Filter channel. Args: time_inst (Tuple[int, Instruction]): Time """ return any([chan in v7 for v10 in v9[1].channels]) return v8
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "bool", "code": "def v0(v1) -> bool:\n return any([chan in channels for v2 in v1[1].channels])", "dependencies": [ "v3" ] }, { "name": "v3", "input_types": [], "output_type": "Tuple[Channel]", "co...
[]
[]
11
# This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v4
[ "Union[Iterable[abc.ABCMeta], abc.ABCMeta]" ]
Callable
def v4(v5: Union[Iterable[abc.ABCMeta], abc.ABCMeta]) -> Callable: v5 = v0(v5) def v6(v7) -> bool: """Filter instruction. Args: time_inst (Tuple[int, Instruction]): Time Returns: If instruction matches with condition. """ return isinstance(v7[1]...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "List[Any]", "code": "def v0(v1: Any) -> List[Any]:\n try:\n iter(v1)\n except TypeError:\n v1 = [v1]\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [ "Any" ], ...
[]
[]
14
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v8
[ "Union[Iterable[Interval], Interval]" ]
Callable
def v8(v9: Union[Iterable[Interval], Interval]) -> Callable: v9 = v0(v9) def v10(v11) -> bool: """Filter interval. Args: time_inst (Tuple[int, Instruction]): Time Returns: If instruction matches with condition. """ for (v12, v13) in v9: ...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "List[Any]", "code": "def v0(v1: Any) -> List[Any]:\n try:\n iter(v1)\n except TypeError:\n v1 = [v1]\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [ "Any" ], ...
[]
[]
18
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
null
v0
[ "models.Policy", "gym.Env", "Any", "Any" ]
Any
def v0(v1: models.Policy, v2: gym.Env, v3=10, v4=torch.device('cpu')): for v5 in range(v3): v6 = v2.reset() v7 = False while not v7: v8 = torch.FloatTensor([v6]).to(v4) v9 = v1.get_actions(v8)[0] (v6, v10, v7, v5) = v2.step(v9) v2.render() ...
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn" ]
10
import scipy.signal as signal import torch import torch.nn as nn import numpy as np import models import gym import wandb def create_feedforward(sizes, activation=nn.ReLU): layers = [] for i in range(len(sizes) - 1): layers.append(nn.Linear(sizes[i], sizes[i+1])) if i < len(sizes) - 2: ...
null
v0
[ "Any", "Any" ]
Dict[str, Any]
async def v0(self, v1, v2) -> Dict[str, Any]: if v1 == 'add_private_key': return await self.add_private_key(cast(Dict[str, Any], v2)) elif v1 == 'check_keys': return await self.check_keys(cast(Dict[str, Any], v2)) elif v1 == 'delete_all_keys': return await self.delete_all_keys(cast(D...
[]
[ "typing" ]
[ "from typing import Any, Dict, List, Optional, cast" ]
16
import logging from blspy import PrivateKey from mint.cmds.init_funcs import check_keys from mint.util.keychain import Keychain from pathlib import Path from typing import Any, Dict, List, Optional, cast # Commands that are handled by the KeychainServer keychain_commands = [ "add_private_key", "check_keys", ...
null
v0
[]
Tuple[np.ndarray, np.ndarray, int, int, Dict[int, List[Tuple[int, int, int]]]]
def v0(self) -> Tuple[np.ndarray, np.ndarray, int, int, Dict[int, List[Tuple[int, int, int]]]]: (v1, v2, v3) = self.load_rating() (v4, v5, v6) = self.load_kg() v7 = self.get_ripple_set(v6, v3) return (v1, v2, v4, v5, v7)
[]
[]
[]
5
# -*- coding: utf-8 -*- # DISCLAIMER # This code file is forked and adapted from https://github.com/tezignlab/RippleNet-TF2/blob/master/tools/load_data.py, which is under an MIT license. """ Utilities for data loading for RippleNet. """ # import libraries import os import numpy as np from collections import defaultd...
null
v0
[ "Dict[int, List[Tuple[int, int]]]", "Dict[int, List[int]]" ]
Dict[int, List[Tuple[int, int, int]]]
def v0(self, v1: Dict[int, List[Tuple[int, int]]], v2: Dict[int, List[int]]) -> Dict[int, List[Tuple[int, int, int]]]: self.logger.info('Constructing ripple set.') v3 = defaultdict(list) for v4 in v2: for v5 in range(self.args.n_hop): v6 = [] v7 = [] v8 = [] ...
[]
[ "collections", "numpy" ]
[ "import numpy as np", "from collections import defaultdict" ]
29
# -*- coding: utf-8 -*- # DISCLAIMER # This code file is forked and adapted from https://github.com/tezignlab/RippleNet-TF2/blob/master/tools/load_data.py, which is under an MIT license. """ Utilities for data loading for RippleNet. """ # import libraries import os import numpy as np from collections import defaultd...
null
v0
[ "tf.keras.layers.Layer" ]
List[tf.Variable]
def v0(self, v1: tf.keras.layers.Layer) -> List[tf.Variable]: del original_layer return []
[]
[]
[]
3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
null
v0
[ "tf.Tensor", "tf.Tensor" ]
Any
def v0(self, v1: tf.Tensor, v2: tf.Tensor): for (v3, v4) in self.tensor_weight_pairs: if v1 is v3: self.update_ops.append(v4.assign(v2)) return raise ValueError('Training weight not found. Please call the update_training_weight with given training weight tensor.')
[]
[]
[]
6
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
null
v0
[]
None
async def v0(self) -> None: if self.event_shutting_down.is_set(): return self.event_shutting_down.set() await self.secured_conn.close() await self.event_closed.wait()
[]
[]
[]
6
import asyncio import logging from typing import Any # noqa: F401 from typing import Awaitable, Dict, List, Optional, Tuple from libp2p.exceptions import ParseError from libp2p.io.exceptions import IncompleteReadError from libp2p.network.connection.exceptions import RawConnError from libp2p.peer.id import ID from lib...
null
v0
[]
int
def v0(self) -> int: with self._job_id_lock: v1 = self._next_job_id self._next_job_id += 1 return v1
[]
[]
[]
5
"""Components that manage local container-based execution.""" import gzip import json import logging from shutil import rmtree from threading import Lock from tempfile import mkdtemp, TemporaryDirectory from pathlib import Path from typing import Dict, Iterable, List, Optional, Tuple import docker from docker.models.i...
null
v0
[ "bytes" ]
int
async def v0(self, v1: bytes) -> int: await self.secured_conn.write(v1) return len(v1)
[]
[]
[]
3
import asyncio import logging from typing import Any # noqa: F401 from typing import Awaitable, Dict, List, Optional, Tuple from libp2p.exceptions import ParseError from libp2p.io.exceptions import IncompleteReadError from libp2p.network.connection.exceptions import RawConnError from libp2p.peer.id import ID from lib...
null
v0
[]
None
async def v0(self) -> None: if not self.event_shutting_down.is_set(): self.event_shutting_down.set() async with self.streams_lock: for v1 in self.streams.values(): async with v1.close_lock: if not v1.event_remote_closed.is_set(): v1.event_remote_cl...
[]
[]
[]
12
import asyncio import logging from typing import Any # noqa: F401 from typing import Awaitable, Dict, List, Optional, Tuple from libp2p.exceptions import ParseError from libp2p.io.exceptions import IncompleteReadError from libp2p.network.connection.exceptions import RawConnError from libp2p.peer.id import ID from lib...
null
v0
[]
Tuple[List[List[str]], List[List[str]]]
def v0(self) -> Tuple[List[List[str]], List[List[str]]]: v1 = [] v2 = [] for v3 in self._df.tag.group_by_sentences(): v4 = list(v3['word']) v5 = list(v3['label']) assert len(v4) == len(v5) v1.append(v4) v2.append(v5) return (v1, v2)
[]
[]
[]
10
from typing import List, Tuple import pandas as pd @pd.api.extensions.register_dataframe_accessor("tag") class CaTaggingAccessor: def __init__(self, df: pd.DataFrame): self._df = df def group_by_sentences(self): yield from (x[1] for x in self._df.groupby("sentence_id")) def group_by_doc...
null
v0
[]
List[int]
def v0(self) -> List[int]: v1 = [] for v2 in self._df.tag.group_by_sentences(): v1.append(v2['t'].values[0]) return v1
[]
[]
[]
5
from typing import List, Tuple import pandas as pd @pd.api.extensions.register_dataframe_accessor("tag") class CaTaggingAccessor: def __init__(self, df: pd.DataFrame): self._df = df def group_by_sentences(self): yield from (x[1] for x in self._df.groupby("sentence_id")) def group_by_doc...
null
v0
[]
Tuple[List[List[List[str]]], List[List[List[str]]]]
def v0(self) -> Tuple[List[List[List[str]]], List[List[List[str]]]]: v1 = [] v2 = [] for v3 in self._df.tag.group_by_documents(): v4 = [] v5 = [] for v6 in v3.tag.group_by_sentences(): v7 = list(v6['word']) v8 = list(v6['label']) v4.append(v7) ...
[]
[]
[]
14
from typing import List, Tuple import pandas as pd @pd.api.extensions.register_dataframe_accessor("tag") class CaTaggingAccessor: def __init__(self, df: pd.DataFrame): self._df = df def group_by_sentences(self): yield from (x[1] for x in self._df.groupby("sentence_id")) def group_by_doc...
null
v0
[]
Tuple[List[str], List[str]]
def v0(self) -> Tuple[List[str], List[str]]: v1 = self._df['sentence'] v2 = self._df['label'] return (v1.values.tolist(), v2.values.tolist())
[]
[]
[]
4
from typing import List, Tuple import pandas as pd @pd.api.extensions.register_dataframe_accessor("tag") class CaTaggingAccessor: def __init__(self, df: pd.DataFrame): self._df = df def group_by_sentences(self): yield from (x[1] for x in self._df.groupby("sentence_id")) def group_by_doc...
null
v0
[]
Tuple[List[str], List[str], List[str]]
def v0(self) -> Tuple[List[str], List[str], List[str]]: v1 = self._df['arg1'].values.tolist() v2 = self._df['arg2'].values.tolist() v3 = self._df['label'].values.tolist() return (v1, v2, v3)
[]
[]
[]
5
from typing import List, Tuple import pandas as pd @pd.api.extensions.register_dataframe_accessor("tag") class CaTaggingAccessor: def __init__(self, df: pd.DataFrame): self._df = df def group_by_sentences(self): yield from (x[1] for x in self._df.groupby("sentence_id")) def group_by_doc...
null
v13
[ "int" ]
str
def v13(self, v14: int) -> str: v15: List[str] = [] if not self.entry_file_exists: v15 = [self.to_description(0), self.to_import_code(0), v0(1), '__all__ = []'] v15.append(self.entry_item.to_code(0)) return v4(v15, v14)
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "def v0(v1: int):\n return ''.join([Config.line_break] * v1)", "dependencies": [] }, { "name": "v2", "input_types": [ "int" ], "output_type": "str", "code": "def v2(v3: int) -> str:...
[]
[]
6
# Copyright 2019 The Forte Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
null
v13
[ "Any" ]
str
def v13(self, v14) -> str: v15 = self.name v16 = [('@property', 0), (f'def {v15}(self):', 0), (f'return self._{v15}', 1), (v0(0), 0), (f'def set_{v15}(self, {v15}: {self.to_code(0)}):', 0), (f'self.set_fields(_{v15}={self.to_field_value()})', 1), (v0(0), 0)] return v4([v10(*line) for v17 in v16], v14)
[ { "name": "v0", "input_types": [ "int" ], "output_type": "Any", "code": "def v0(v1: int):\n return ''.join([Config.line_break] * v1)", "dependencies": [] }, { "name": "v2", "input_types": [ "int" ], "output_type": "str", "code": "def v2(v3: int) -> str:...
[]
[]
4
# Copyright 2019 The Forte Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
null
v15
[ "v0", "v0", "v2" ]
v0
def v15(v16: v0, v17: v0, v18: v2=None) -> v0: if 1 <= v16.ndim <= 2 and 1 <= v17.ndim <= 2 and (v16.shape[-1] == v17.shape[0]): return v6(v16, v17, (((v16.ndim - 1,), (0,)), ((), ())), precision=v18) else: raise TypeError('Incompatible shapes for dot: got {} and {}.'.format(v16.shape, v17.shape...
[ { "name": "v3", "input_types": [ "Any" ], "output_type": "Any", "code": "def v3(v4):\n if v4 is None:\n return None\n if isinstance(v4, Precision) or (isinstance(v4, tuple) and len(v4) == 2 and all((isinstance(p, Precision) for v5 in v4))):\n return v4\n else:\n ...
[]
[]
5
# 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 = Tuple[Tuple[Sequence[int], Sequence[int]], Tuple[Sequence[int], Sequence[int]]]", "v2 = Union[None, PrecisionType, Tuple[PrecisionType, PrecisionType]]" ]
v22
[ "v0", "Sequence[int]" ]
v0
def v22(v23: v0, v24: Sequence[int]) -> v0: v25 = tuple(range(len(v24), len(v24) + np.ndim(v23))) return v18(v23, tuple(v24) + np.shape(v23), v25)
[ { "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 = np.ndim(v3)\n if v6 != len(v5)...
[ "numpy" ]
[ "import numpy as np" ]
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]" ]
v18
[ "v0", "int", "int", "bool" ]
v0
def v18(v19: v0, v20: int, v21: int=0, v22: bool=True) -> v0: (v20, v21) = (int(v20), int(v21)) v23 = v19.shape[v21] v24 = v20 + v23 if v20 < 0 else v20 if not 0 <= v24 < v23: v25 = 'index {} is out of bounds for axis {} with size {}' raise IndexError(v25.format(v20, v21, v23)) v26 =...
[ { "name": "v1", "input_types": [ "v0", "Optional[int]", "Optional[int]", "int", "int" ], "output_type": "v0", "code": "def v1(v2: v0, v3: Optional[int], v4: Optional[int], v5: int=1, v6: int=0) -> v0:\n v7 = [0] * v2.ndim\n v8 = list(v2.shape)\n v9 = [1] * ...
[ "numpy" ]
[ "import numpy as np" ]
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" ]
v21
[ "v0" ]
v0
def v21(self, v22: v0) -> v0: if v22 == self.target: return self.source return self.target
[]
[]
[]
4
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
[ "class v0(object):\n v1 = 'NK-'\n v2 = ('id', 'canonical', 'weight')\n\n def __init__(self, v3: str):\n self.id = v3\n self.weight: int = 1\n if self.id.startswith(self.PREFIX):\n self.weight = 2\n elif is_qid(v3):\n self.weight = 3\n self.canonical ...
v0
[]
str
def v0(self) -> str: v1 = [self.target.id, self.source.id, self.judgement.value, self.score, self.user, self.timestamp] return json.dumps(v1) + '\n'
[]
[ "json" ]
[ "import json" ]
3
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
null
v21
[]
Generator[v0, None, None]
def v21(self) -> Generator[v0, None, None]: for v22 in self.nodes.keys(): if not v22.canonical: continue v23 = self.get_canonical(v22) if v23 == v22.id: yield v22
[]
[]
[]
7
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
[ "class v0(object):\n v1 = 'NK-'\n v2 = ('id', 'canonical', 'weight')\n\n def __init__(self, v3: str):\n self.id = v3\n self.weight: int = 1\n if self.id.startswith(self.PREFIX):\n self.weight = 2\n elif is_qid(v3):\n self.weight = 3\n self.canonical ...
v0
[ "int" ]
Generator[Tuple[str, str, Optional[float]], None, None]
def v0(self, v1: int=100) -> Generator[Tuple[str, str, Optional[float]], None, None]: v2 = 0 for v3 in self._get_suggested(): if not self.check_candidate(v3.source, v3.target): continue yield (v3.target.id, v3.source.id, v3.score) v2 += 1 if v2 >= v1: brea...
[]
[]
[]
9
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
null
v21
[ "v0" ]
None
def v21(self, v22: v0) -> None: self.edges.pop(v22.key, None) for v23 in (v22.source, v22.target): if v23 in self.nodes: self.nodes[v23].discard(v22)
[]
[]
[]
5
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
[ "class v0(object):\n v1 = ('key', 'source', 'target', 'judgement', 'score', 'user', 'timestamp')\n\n def __init__(self, v2: StrIdent, v3: StrIdent, v4: Judgement=Judgement.NO_JUDGEMENT, v5: Optional[float]=None, v6: Optional[str]=None, v7: Optional[str]=None):\n self.key = Identifier.pair(v2, v3)\n ...
v0
[]
None
def v0(self) -> None: if self.path is None: raise RuntimeError('Resolver has no path') v1 = sorted(self.edges.values()) with open(self.path, 'w') as v2: for v3 in v1: v2.write(v3.to_line())
[]
[]
[]
7
import json import getpass import shortuuid # type: ignore from datetime import datetime from functools import lru_cache from collections import defaultdict from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union from followthemoney.types import registry from nomenklatura.entity import CE ...
null
v0
[ "Any" ]
bool
def v0(v1) -> bool: if len(v1) > 12 * 2 or len(v1) < 12 * 2: return True return False
[]
[]
[]
4
import models import json import re import constants.userConstants as UserConstants from enums import UserEnums from databaseService.bookDatabaseService import BookDatabaseService def validate_and_convert_new_user_request_object(aa: dict, bb: models.User): for field in UserConstants.USER_MANDATORY_FIELDS: ...
null
v0
[]
argparse.Namespace
def v0() -> argparse.Namespace: v1: argparse.ArgumentParser = argparse.ArgumentParser(description='This script is used to plot bands') v1.add_argument('input_file_name', metavar='INPUT_FILE_NAME', nargs='?', type=str, help='input hdf5 file.') v1.add_argument('-o', '--output-file', nargs='?', type=str, dest=...
[]
[ "argparse" ]
[ "import argparse" ]
10
#!/usr/bin/env python import argparse from LhcVaspTools.BasicUtils import readDataFromJson from LhcVaspTools.OamExts import EnergyBandsWithOam def parseArgv() -> argparse.Namespace: parser: argparse.ArgumentParser = argparse.ArgumentParser( description="This script is used to plot bands") parser.add_...
null
v0
[ "str" ]
Any
def v0(v1: str): v2 = hashlib.blake2b() v2.update(v1.encode('utf-8')) return v2.digest()
[]
[ "hashlib" ]
[ "import hashlib" ]
4
#!/usr/bin/env python3 import redis import argparse import hashlib from getpass import getpass r = redis.StrictRedis(host="localhost", port=6379) parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument('--add', action='store_true', help='Adds a service') group...
null
v22
[ "pd.DataFrame" ]
Any
def v22(v23: pd.DataFrame): v24 = list(v23['compare_score'].unique()) v25 = len(v24) for (v26, v27) in enumerate(v24, 1): v28 = v23[v23['compare_score'] == v27] v28 = pd.DataFrame(v28, columns=['inventory_id', 'file', 'file_extension', 'full_path', 'directory', 'size', 'created_dt', 'modifie...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Any", "code": "def v0(v1: str):\n v2 = v1\n for (v3, v4, v5) in os.walk(v2):\n for v6 in v5:\n os.remove(os.path.join(v3, v6))", "dependencies": [] }, { "name": "v7", "input_types": [ "p...
[ "os", "pandas", "shutil" ]
[ "import shutil", "import pandas as pd", "import os" ]
12
import datetime import shutil import services.inventory import workflow import pandas as pd import os import file_system import file_system.images as images import json from file_system.file_system_object import FileSystemObject from services import inventory, library from tabulate import tabulate import cv2 TEMP_FOL...
null
v0
[ "str" ]
Any
def v0(v1: str): v2 = v1 for (v3, v4, v5) in os.walk(v2): for v6 in v5: os.remove(os.path.join(v3, v6))
[]
[ "os" ]
[ "import os" ]
5
import datetime import shutil import services.inventory import workflow import pandas as pd import os import file_system import file_system.images as images import json from file_system.file_system_object import FileSystemObject from services import inventory, library from tabulate import tabulate import cv2 TEMP_FOL...
null
v0
[ "bool" ]
None
def v0(self, v1: bool=True) -> None: super().set_visible(v1) if v1: self._map() else: self._unmap()
[]
[]
[]
6
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # Copyright (c) 2008-2021 pyglet contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follo...
null
v0
[ "int", "int" ]
None
def v0(self, v1: int, v2: int) -> None: super().set_minimum_size(v1, v2) self._set_wm_normal_hints()
[]
[]
[]
3
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # Copyright (c) 2008-2021 pyglet contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follo...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v2 = [] for v3 in v1.splitlines(): v2.append(v3.strip('\t ')) return ' '.join(v2)
[]
[]
[]
5
import contextlib import os from typing import Optional, cast, Callable, Generator, IO, Any from pathlib import Path from pacu import settings get_active_session: Optional[Callable] = None class PacuException(Exception): pass def strip_lines(text: str) -> str: out = [] for line in text.splitlines(): ...
null
v3
[]
Path
def v3() -> Path: v4 = (v1() / 'downloads').absolute() os.makedirs(v4, exist_ok=True) return v4
[ { "name": "v0", "input_types": [], "output_type": "Path", "code": "def v0() -> Path:\n return settings.home_dir", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "Path", "code": "def v1() -> Path:\n if not get_active_session:\n raise UserW...
[ "os" ]
[ "import os" ]
4
import contextlib import os from typing import Optional, cast, Callable, Generator, IO, Any from pathlib import Path from pacu import settings get_active_session: Optional[Callable] = None class PacuException(Exception): pass def strip_lines(text: str) -> str: out = [] for line in text.splitlines(): ...
null
v3
[ "str" ]
Path
def v3(v4: str) -> Path: v5 = (v1() / 'modules' / v4).absolute() os.makedirs(v5, exist_ok=True) return v5
[ { "name": "v0", "input_types": [], "output_type": "Path", "code": "def v0() -> Path:\n return settings.home_dir", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "Path", "code": "def v1() -> Path:\n if not get_active_session:\n raise UserW...
[ "os" ]
[ "import os" ]
4
import contextlib import os from typing import Optional, cast, Callable, Generator, IO, Any from pathlib import Path from pacu import settings get_active_session: Optional[Callable] = None class PacuException(Exception): pass def strip_lines(text: str) -> str: out = [] for line in text.splitlines(): ...
null
v6
[]
dict
def v6(**v7) -> dict: v8 = v1(**v7) v9 = {} for v10 in v8: if 'upstream' in v10.keys() and v10['upstream']: v11 = urlparse(v10['upstream']).path[1:] v11 = v11.replace('/', '-') else: v11 = v10['name'] if 'osp-patches' in v10.keys() and v10['osp-pat...
[ { "name": "v0", "input_types": [], "output_type": "Any", "code": "def v0():\n return di.DistroInfo(info_files=INFO_FILE, cache_ttl=24 * 60 * 60, remote_git_info=RDOINFO_GIT_URL).get_info()", "dependencies": [] }, { "name": "v1", "input_types": [], "output_type": "Any", "co...
[ "urllib" ]
[ "from urllib.parse import urlparse" ]
14
#!/usr/bin/env python3 # # Copyright 2021 Red Hat, Inc. # 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 ...
null
v25
[ "Any" ]
None
def v25(v26=None) -> None: v27 = v16(v26) if v27.command == 'components': v28 = v0(**vars(v27)) v29 = ['name'] elif v27.command == 'packages': v28 = v6(**vars(v27)) v29 = ['osp-name', 'osp-distgit', 'osp-patches'] elif v27.command == 'releases': v28 = v11(**vars(v...
[ { "name": "v0", "input_types": [], "output_type": "Any", "code": "def v0(**v1):\n v2 = get_distroinfo()\n v3 = v2.get('components')\n if v1.get('name'):\n v3 = [component for v4 in v3 if v1.get('name') == v4.get('name')]\n return v3", "dependencies": [ "v5" ] }, ...
[ "argparse", "pprint", "sys", "urllib" ]
[ "from argparse import ArgumentParser", "from argparse import Namespace", "from pprint import PrettyPrinter", "import sys", "from urllib.parse import urlparse" ]
26
#!/usr/bin/env python3 # # Copyright 2021 Red Hat, Inc. # 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 ...
null
v6
[ "str", "int", "bool", "bool" ]
str
def v6(v7: str, v8: int=None, v9: bool=False, v10: bool=False) -> str: def v11(v12: str, v13: int) -> str: v14 = v4(v12) if v13 == 2 and v9 is True: return v14.hex() else: return v14.decode(errors='ignore') v15 = v7.replace(' ', '').replace('\n', '') if v8 is...
[ { "name": "v0", "input_types": [ "str", "int" ], "output_type": "str", "code": "def v0(v1: str, v2: int) -> str:\n v3 = jwt_base64url_decode(v1)\n if v2 == 2 and hex_sig is True:\n return v3.hex()\n else:\n return v3.decode(errors='ignore')", "dependencies"...
[ "base64" ]
[ "import base64" ]
21
#!/usr/bin/env python import sys import base64 def jwt_base64url_decode(s: str) -> str: return base64.urlsafe_b64decode(s + '='*(-len(s)%4)) def jwt_decode(jwt_str: str, pos: int=None, hex_sig: bool=False, verbose: bool=False) -> str: def _decode(s: str, pos: int) -> str: r = jwt_base6...
null
v0
[ "str", "int", "int", "str", "bool", "str", "bool" ]
Any
async def v0(self, v1: str, v2: int, v3: int, v4: str, v5: bool, v6: str, v7: bool): if not v7: await self.db_wrapper.lock.acquire() try: v8 = await self.db_connection.execute('INSERT INTO action_queue VALUES(?, ?, ?, ?, ?, ?, ?)', (None, v1, v2, v3, v4, v5, v6)) await v8.close() fin...
[]
[]
[]
10
from typing import List, Optional import aiosqlite from btcgreen.util.db_wrapper import DBWrapper from btcgreen.util.ints import uint32 from btcgreen.wallet.util.wallet_types import WalletType from btcgreen.wallet.wallet_action import WalletAction class WalletActionStore: """ WalletActionStore keeps track o...
null
v0
[ "int" ]
Any
async def v0(self, v1: int): v2: Optional[WalletAction] = await self.get_wallet_action(v1) assert v2 is not None async with self.db_wrapper.lock: v3 = await self.db_connection.execute('Replace INTO action_queue VALUES(?, ?, ?, ?, ?, ?, ?)', (v2.id, v2.name, v2.wallet_id, v2.type.value, v2.wallet_cal...
[]
[]
[]
7
from typing import List, Optional import aiosqlite from btcgreen.util.db_wrapper import DBWrapper from btcgreen.util.ints import uint32 from btcgreen.wallet.util.wallet_types import WalletType from btcgreen.wallet.wallet_action import WalletAction class WalletActionStore: """ WalletActionStore keeps track o...
null
v0
[ "achallenges.AnnotatedChallenge" ]
challenges.ChallengeResponse
def v0(self, v1: achallenges.AnnotatedChallenge) -> challenges.ChallengeResponse: (v2, v3) = self._perform_http_01(v1) self.served[v2].add(v1) return v3
[]
[]
[]
4
"""Standalone Authenticator.""" import collections import errno import logging import socket from typing import Any from typing import Callable from typing import DefaultDict from typing import Dict from typing import Iterable from typing import List from typing import Mapping from typing import Set from typing import ...
null
v0
[ "Iterable[achallenges.AnnotatedChallenge]" ]
None
def v0(self, v1: Iterable[achallenges.AnnotatedChallenge]) -> None: for (v2, v3) in self.served.items(): for v4 in v1: if v4 in v3: v3.remove(v4) for (v5, v6) in self.servers.running().items(): if not self.served[v6]: self.servers.stop(v5)
[]
[]
[]
8
"""Standalone Authenticator.""" import collections import errno import logging import socket from typing import Any from typing import Callable from typing import DefaultDict from typing import Dict from typing import Iterable from typing import List from typing import Mapping from typing import Set from typing import ...
null
v0
[ "List[achallenges.AnnotatedChallenge]" ]
str
def v0(self, v1: List[achallenges.AnnotatedChallenge]) -> str: (v2, v3) = (self.config.http01_port, self.config.http01_address) v4 = f'{v3}:{v2}' if v3 else f'port {v2}' return f'The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on {v...
[]
[]
[]
4
"""Standalone Authenticator.""" import collections import errno import logging import socket from typing import Any from typing import Callable from typing import DefaultDict from typing import Dict from typing import Iterable from typing import List from typing import Mapping from typing import Set from typing import ...
null
v0
[]
pd.Series
def v0(self) -> pd.Series: v1 = self._aroon_up - self._aroon_down v1 = self._check_fillna(v1, value=0) return pd.Series(v1, name=f'aroon_ind_{self._n}')
[]
[ "pandas" ]
[ "import pandas as pd" ]
4
""" .. module:: trend :synopsis: Trend Indicators. .. moduleauthor:: Dario Lopez Padial (Bukosabino) """ import numpy as np import pandas as pd from ta.utils import IndicatorMixin, ema, get_min_max, sma class AroonIndicator(IndicatorMixin): """Aroon Indicator Identify when trends are likely to change d...
null
v0
[]
pd.Series
def v0(self) -> pd.Series: v1 = self._check_fillna(self._emv, value=0) return pd.Series(v1, name=f'eom_{self._n}')
[]
[ "pandas" ]
[ "import pandas as pd" ]
3
""" .. module:: volume :synopsis: Volume Indicators. .. moduleauthor:: Dario Lopez Padial (Bukosabino) """ import numpy as np import pandas as pd from ta.utils import IndicatorMixin, ema class AccDistIndexIndicator(IndicatorMixin): """Accumulation/Distribution Index (ADI) Acting as leading indicator o...
null
v0
[]
pd.Series
def v0(self) -> pd.Series: v1 = self._emv.rolling(self._n, min_periods=0).mean() v1 = self._check_fillna(v1, value=0) return pd.Series(v1, name=f'sma_eom_{self._n}')
[]
[ "pandas" ]
[ "import pandas as pd" ]
4
""" .. module:: volume :synopsis: Volume Indicators. .. moduleauthor:: Dario Lopez Padial (Bukosabino) """ import numpy as np import pandas as pd from ta.utils import IndicatorMixin, ema class AccDistIndexIndicator(IndicatorMixin): """Accumulation/Distribution Index (ADI) Acting as leading indicator o...
null
v0
[ "np.ndarray", "Any", "Any" ]
Any
def v0(self, v1: np.ndarray, v2, v3): v4 = v1[:, 4][(v1[:, 2] <= v2[:, 0]) & (v1[:, 4] < 0)].shape v1[:, 4][(v1[:, 2] <= v2[:, 0]) & (v1[:, 4] < 0)] = np.clip(np.random.normal(loc=0.5, scale=0.5 / 3, size=v4), a_min=0.05, a_max=1) v4 = v1[:, 4][(v1[:, 2] >= v2[:, 1]) & (v1[:, 4] > 0)].shape v1[:, 4][(v1...
[]
[ "numpy" ]
[ "import numpy as np" ]
10
''' Created on Nov 29, 2020 @author: manik ''' ''' File with classes and code which control how a particular person will move and to where ''' from src.population import Population import numpy as np import src.person_properties_util as idx class Movement(): """ Class providing abstraction into each movement o...
null
v0
[ "str", "str" ]
None
def v0(v1: str, v2: str) -> None: v3 = '*' * (len(v1) + 4) print(f'{v3}\n* {v1} *\n{v3}\n{v2}')
[]
[]
[]
3
import datetime as dt import pytest from note_clerk import planning @pytest.mark.parametrize( "date, quarter", [ (dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 1)), (dt.datetime(2020, 1, 2), dt.datetime(2020, 1, 1)), (dt.datetime(2020, 4, 1), dt.datetime(2020, 4, 1)), (dt.dat...
null
v0
[ "str", "Any" ]
Tuple[str, str]
def v0(v1: str, v2=False) -> Tuple[str, str]: print(f"Running command: '{v1}'") v3: subprocess.CompletedProcess = subprocess.run(v1, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if v3.returncode == 0: print('Command succeeded.') if v2: raise RuntimeError(f'Expected...
[]
[ "subprocess" ]
[ "import subprocess" ]
12
from contextlib import contextmanager import json import os import logging import sys import subprocess from typing import Optional, Tuple import pytest logger = logging.getLogger(__name__) @contextmanager def set_env_var(key: str, val: Optional[str] = None): old_val = os.environ.get(key, None) if val is no...
null
v0
[]
'Headers'
def v0(self) -> 'Headers': v1 = self.__class__() v1._dict = self._dict.copy() v1._list = self._list.copy() return v1
[]
[]
[]
5
""" This module defines a data structure for manipulating HTTP headers. """ from typing import ( Any, Dict, Iterable, Iterator, List, Mapping, MutableMapping, Tuple, Union, ) __all__ = ["Headers", "MultipleValuesError"] class MultipleValuesError(LookupError): """ Except...
null
v0
[]
None
def v0(self) -> None: self._dict = {} self._list = []
[]
[]
[]
3
""" This module defines a data structure for manipulating HTTP headers. """ from typing import ( Any, Dict, Iterable, Iterator, List, Mapping, MutableMapping, Tuple, Union, ) __all__ = ["Headers", "MultipleValuesError"] class MultipleValuesError(LookupError): """ Except...
null
v2
[ "Exception", "Optional[str]" ]
str
def v2(v3: Exception, v4: Optional[str]=None) -> str: if isinstance(v3, OSError): if v3.filename is not None: v5 = Path(v3.filename).name v6 = f'cannot open file {v0(v5)}: {v3.strerror.lower()}' elif v3.strerror is not None: v6 = v3.strerror.lower() else: ...
[ { "name": "v0", "input_types": [ "Union[str, Path]" ], "output_type": "str", "code": "def v0(v1: Union[str, Path]) -> str:\n return f'[bold magenta]{v1}[/bold magenta]'", "dependencies": [] } ]
[ "pathlib" ]
[ "from pathlib import Path" ]
14
import inspect import sys from pathlib import Path from types import TracebackType from typing import NoReturn, Optional, Union import rich.console import typer from . import Severity, Verbosity from .config import config __all__ = ["error", "warning", "info", "debug"] COLOR_MAP = { Severity.ERROR: "red", ...
null
v0
[ "str", "int", "str", "str" ]
Any
def v0(self, v1: str, v2: int, v3: str, v4: str): v5 = '{}{}'.format(v1, v2) self.worksheet[v5].value = v3 self.worksheet[v5].style = v4
[]
[]
[]
4
#!/usr/bin/env python # -*- coding: utf-8 -*- from openpyxl.worksheet.worksheet import Worksheet COLUMNS = {"A": 20, "B": 10, "C": 10, "D": 10, "E": 10, "F": 10, "G": 10, "H": 10, "I": 10} class RankingReportWriter(object): ...
null
v0
[ "list" ]
list
def v0(v1: list) -> list: v2 = [] for v3 in v1: v2.append([v3['slots'][x]['z_score'] for v4 in v3['slots']]) return v2
[]
[]
[]
5
#!/usr/bin/env python # -*- coding: utf-8 -*- from openpyxl.worksheet.worksheet import Worksheet COLUMNS = {"A": 20, "B": 10, "C": 10, "D": 10, "E": 10, "F": 10, "G": 10, "H": 10, "I": 10} class RankingReportWriter(object): ...
null
v0
[ "datetime" ]
Any
def v0(v1: datetime): if not v1: return None return v1.strftime('%Y-%m-%d')
[]
[]
[]
4
import argparse import asyncio import html import json import logging import os import textwrap import time import xmltodict from aiohttp import ClientSession, ClientConnectorError, ServerDisconnectedError, ContentTypeError from articlemeta.client import RestfulClient from datetime import datetime from json import JSO...
null
v0
[ "dict" ]
Any
def v0(self, v1: dict): if self.persist_mode == 'json': with open(self.path_results, 'a') as v2: json.dump(v1, v2) v2.write('\n') elif self.persist_mode == 'mongo': self.standardizer.update_one(filter={'_id': v1['_id']}, update={'$set': {'crossref': v1['crossref'], 'updat...
[]
[ "datetime", "json" ]
[ "import json", "from datetime import datetime", "from json import JSONDecodeError" ]
7
import argparse import asyncio import html import json import logging import os import textwrap import time import xmltodict from aiohttp import ClientSession, ClientConnectorError, ServerDisconnectedError, ContentTypeError from articlemeta.client import RestfulClient from datetime import datetime from json import JSO...
null