name stringclasses 844
values | input_types listlengths 0 100 | output_type stringlengths 1 419 | code stringlengths 34 233k | dependencies listlengths 0 6 | lib_used listlengths 0 11 | imports listlengths 0 66 | line_count int64 3 199 | full_code stringlengths 39 1.01M | input_type_defs listlengths 1 12 ⌀ |
|---|---|---|---|---|---|---|---|---|---|
v0 | [
"Iterable[str]"
] | Tuple[List[str], List[str], List[str]] | def v0(v1: Iterable[str]) -> Tuple[List[str], List[str], List[str]]:
v2 = re.compile('([^\\\\])\\|')
v3 = re.compile('\\\\\\|')
v4 = re.compile('^(?:\\[(\\S)\\]\\s*)?([^\\x1F]+)(?:\\x1F([^\\x1F]*))?')
v5 = []
v6 = []
v7 = []
for v8 in v1:
v9 = v3.sub('|', v2.sub('\\1\x1f', v8))
... | [] | [
"re"
] | [
"import re"
] | 18 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v0 | [
"Optional[Union[str, Iterable[str]]]",
"bool",
"Iterable[str]",
"Iterable[str]",
"bool"
] | Tuple[str, ...] | def v0(v1: Optional[Union[str, Iterable[str]]], v2: bool, v3: Iterable[str], v4: Iterable[str], v5: bool) -> Tuple[str, ...]:
if v1 is None:
v6 = []
elif isinstance(v1, str):
v6 = v1.split('\n')
else:
v6 = list(v1)
if v2:
v7 = self._get_shortcut_hints_line(v3, v4, v5)
... | [] | [] | [] | 12 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v4 | [] | Tuple[str, ...] | def v4() -> Tuple[str, ...]:
def v5():
v6 = {' ': 'space'}
if len(self._accept_keys) == 1:
v7 = '<' + self._accept_keys[0] + '>'
else:
v7 = '(' + ', '.join(('<' + accept_key + '>' for v8 in self._accept_keys)) + ')'
return 'Press <{}> for multi-selection and ... | [
{
"name": "v0",
"input_types": [],
"output_type": "Any",
"code": "def v0():\n v1 = {' ': 'space'}\n if len(self._accept_keys) == 1:\n v2 = '<' + self._accept_keys[0] + '>'\n else:\n v2 = '(' + ', '.join(('<' + accept_key + '>' for v3 in self._accept_keys)) + ')'\n return 'P... | [] | [] | 22 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v0 | [
"Optional[Iterable[str]]",
"bool"
] | None | def v0(v1: Optional[Iterable[str]]=None, v2: bool=True) -> None:
assert self._codename_to_terminal_code is not None
assert self._tty_out is not None
if v2 or v1 is None:
self._tty_out.write(self._codename_to_terminal_code['reset_attributes'])
if v1 is not None:
for v3 in v1:
... | [] | [] | [] | 8 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v10 | [] | int | def v10() -> int:
assert self._codename_to_terminal_code is not None
assert self._tty_out is not None
v11 = max(v6(self._menu_cursor), v6(self._multi_select_cursor))
v12 = 0
v13 = self._num_cols()
if self._title_lines:
self._tty_out.write(len(self._title_lines) * self._codename_to_termin... | [
{
"name": "v0",
"input_types": [
"Optional[Iterable[str]]",
"bool"
],
"output_type": "None",
"code": "def v0(v1: Optional[Iterable[str]]=None, v2: bool=True) -> None:\n assert self._codename_to_terminal_code is not None\n assert self._tty_out is not None\n if v2 or v1 is Non... | [
"ctypes",
"platform"
] | [
"import ctypes",
"import platform"
] | 48 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v10 | [
"int",
"Tuple[str, ...]"
] | int | def v10(v11: int, v12: Tuple[str, ...]) -> int:
assert self._codename_to_terminal_code is not None
assert self._tty_out is not None
v13 = 0
v14 = self._num_cols()
if v12:
self._tty_out.write((v11 + 1) * self._codename_to_terminal_code['cursor_down'])
v0(self._status_bar_style)
... | [
{
"name": "v0",
"input_types": [
"Optional[Iterable[str]]",
"bool"
],
"output_type": "None",
"code": "def v0(v1: Optional[Iterable[str]]=None, v2: bool=True) -> None:\n assert self._codename_to_terminal_code is not None\n assert self._tty_out is not None\n if v2 or v1 is Non... | [
"ctypes",
"platform"
] | [
"import ctypes",
"import platform"
] | 13 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v0 | [
"int"
] | None | def v0(v1: int) -> None:
assert self._codename_to_terminal_code is not None
assert self._tty_out is not None
if self._previous_displayed_menu_height is not None and self._previous_displayed_menu_height > v1:
self._tty_out.write((v1 + 1) * self._codename_to_terminal_code['cursor_down'])
self.... | [] | [] | [] | 7 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v10 | [] | None | def v10() -> None:
assert self._codename_to_terminal_code is not None
assert self._tty_out is not None
if self._view.active_displayed_index is None:
return
v11 = max(v6(self._menu_cursor), v6(self._multi_select_cursor))
for v12 in range(self._viewport.lower_index, self._viewport.upper_index ... | [
{
"name": "v0",
"input_types": [
"Optional[Iterable[str]]",
"bool"
],
"output_type": "None",
"code": "def v0(v1: Optional[Iterable[str]]=None, v2: bool=True) -> None:\n assert self._codename_to_terminal_code is not None\n assert self._tty_out is not None\n if v2 or v1 is Non... | [
"ctypes",
"platform"
] | [
"import ctypes",
"import platform"
] | 21 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v3 | [] | None | def v3() -> None:
def v4(v5: signal.Signals, v6: FrameType) -> None:
if self._reading_next_key:
self._paint_menu()
else:
self._paint_before_next_read = True
signal.signal(signal.SIGWINCH, v4) | [
{
"name": "v0",
"input_types": [
"signal.Signals",
"FrameType"
],
"output_type": "None",
"code": "def v0(v1: signal.Signals, v2: FrameType) -> None:\n if self._reading_next_key:\n self._paint_menu()\n else:\n self._paint_before_next_read = True",
"dependencies... | [
"signal"
] | [
"import signal"
] | 8 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v0 | [
"Dict[str, Set[Optional[str]]]"
] | None | def v0(v1: Dict[str, Set[Optional[str]]]) -> None:
v2 = frozenset(string.ascii_lowercase) | frozenset(' ')
for v3 in v1.values():
v3 -= v2 | [] | [
"string"
] | [
"import string"
] | 4 | #!/usr/bin/env python3
import argparse
import copy
import ctypes
import io
import locale
import os
import platform
import re
import shlex
import signal
import string
import subprocess
import sys
from locale import getlocale
from types import FrameType
from typing import (
Any,
Callable,
Dict,
Iterable,... | null |
v0 | [
"sqlalchemy.orm.Session",
"typing.List[dict]",
"mlrun.api.schemas.PipelinesFormat"
] | typing.List[dict] | def v0(self, v1: sqlalchemy.orm.Session, v2: typing.List[dict], v3: mlrun.api.schemas.PipelinesFormat=mlrun.api.schemas.PipelinesFormat.metadata_only) -> typing.List[dict]:
v4 = []
for v5 in v2:
v4.append(self._format_run(v1, v5, v3))
return v4 | [] | [] | [] | 5 | import ast
import http
import json
import tempfile
import traceback
import typing
import kfp
import sqlalchemy.orm
import mlrun
import mlrun.api.api.utils
import mlrun.api.schemas
import mlrun.errors
import mlrun.kfpops
import mlrun.utils.helpers
import mlrun.utils.singleton
from mlrun.utils import logger
class Pip... | null |
v0 | [] | bool | def v0(self, *v1) -> bool:
v2 = any((arg.has_any_symbols(*v1) for v3 in self.args))
return v2 | [] | [] | [] | 3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Converts expressions from SymPy to Mathics expressions.
Conversion to SymPy is handled directly in BaseExpression descendants.
"""
import sympy
sympy_symbol_prefix = '_Mathics_User_'
sympy_slot_prefix = '_Mathics_Slot_'
BasicSympy = sympy.Expr
def is_Cn_expr(name... | null |
v0 | [] | None | def v0() -> None:
v1 = int(input())
v2 = list(map(int, input().split()))
v3 = list(map(int, input().split()))
assert 1 <= v1 <= 100
assert len(v2) == v1
assert len(v3) == v1
assert all((1 <= S_i <= 10 ** 9 for v4 in v2))
assert all((1 <= T_i <= 10 ** 9 for v5 in v3)) | [] | [] | [] | 9 | def main() -> None:
N = int(input())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
assert 1 <= N <= 100
assert len(S) == N
assert len(T) == N
assert all(1 <= S_i <= 10**9 for S_i in S)
assert all(1 <= T_i <= 10**9 for T_i in T)
if __name__ == '__main__':
... | null |
v2 | [] | List[Dict[str, Any]] | def v2(self) -> List[Dict[str, Any]]:
def v3(v4: InputText) -> int:
return v4._rendered_row or 0
v5 = sorted(self.children, key=v3)
v6: List[Dict[str, Any]] = []
for (v7, v8) in groupby(v5, key=v3):
v5 = [item.to_component_dict() for v9 in v8]
if not v5:
continue
... | [
{
"name": "v0",
"input_types": [
"InputText"
],
"output_type": "int",
"code": "def v0(v1: InputText) -> int:\n return v1._rendered_row or 0",
"dependencies": []
}
] | [
"itertools"
] | [
"from itertools import groupby"
] | 12 | from __future__ import annotations
import os
from itertools import groupby
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
from .input_text import InputText
from .view import _ViewWeights
__all__ = (
"Modal",
"ModalStore",
)
if TYPE_CHECKING:
from ..interactions import Interaction
... | null |
v0 | [] | None | def v0(self) -> None:
self.__widgets.clear()
self.widget.children.clear() | [] | [] | [] | 3 | from __future__ import annotations
# standard libraries
import collections
import enum
import json
import pathlib
import typing
# third party libraries
import numpy
# local libraries
from . import CanvasItem
from . import DrawingContext
from . import UserInterface as UserInterfaceModule
from nion.utils import Geomet... | null |
v0 | [] | None | def v0(self) -> None:
if not self.__stopped.done():
self.__stopped.set_result(False)
self.__timeout_expiry = None
if self.__timeout_task is not None:
self.__timeout_task.cancel()
self.__timeout_task = None
if self.__cancel_callback:
self.__cancel_callback(self)
se... | [] | [] | [] | 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 |
v66 | [
"v0",
"Optional[int]"
] | Any | def v66(self, v67: v0, v68: Optional[int]=None):
if v67.__discord_ui_modal__:
self._modals[v67.custom_id] = v67
return
self.__verify_integrity()
v67._start_listening_from_store(self)
for v69 in v67.children:
if v69.is_dispatchable():
self._views[v69.type.value, v68, v... | [] | [] | [] | 11 | """
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... | [
"class v0:\n v1: ClassVar[bool] = True\n v2: ClassVar[bool] = False\n v3: ClassVar[List[ItemCallbackType[Any, Any]]] = []\n\n def v4(cls) -> None:\n v5: List[ItemCallbackType[Any, Any]] = []\n for v6 in reversed(cls.__mro__):\n for v7 in v6.__dict__.values():\n if... |
v63 | [
"v0"
] | None | def v63(self, v64: v0) -> None:
for v65 in v64.children:
if v65.is_dispatchable():
self._views.pop((v65.type.value, v65.custom_id), None)
for (v66, v67) in self._synced_message_views.items():
if v67.id == v64.id:
del self._synced_message_views[v66]
break | [] | [] | [] | 8 | """
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... | [
"class v0:\n v1: ClassVar[bool] = True\n v2: ClassVar[List[ItemCallbackType[Item[Any]]]] = []\n\n def v3(cls) -> None:\n v4: List[ItemCallbackType] = []\n for v5 in reversed(cls.__mro__):\n for v6 in v5.__dict__.values():\n if hasattr(v6, '__discord_ui_model_type__')... |
v0 | [
"np.ndarray"
] | Any | def v0(v1: np.ndarray):
v2 = -4 * v1
v2 += np.roll(v1, (0, -1), (0, 1))
v2 += np.roll(v1, (0, +1), (0, 1))
v2 += np.roll(v1, (-1, 0), (0, 1))
v2 += np.roll(v1, (+1, 0), (0, 1))
return v2 | [] | [
"numpy"
] | [
"import numpy as np"
] | 7 | # adapted from https://github.com/benmaier/reaction-diffusion/blob/master/gray_scott.ipynb
# based on http://karlsims.com/rd.html
# proposed setup to ignore margins: https://ipython-books.github.io/124-simulating-a-partial-differential-equation-reaction-diffusion-systems-and-turing-patterns/
import numpy as np
from t... | null |
v3 | [
"np.ndarray",
"np.ndarray",
"Any",
"Any",
"Any",
"Any",
"Any"
] | Any | def v3(v4: np.ndarray, v5: np.ndarray, v6, v7, v8, v9, v10):
v11 = v0(v4)
v12 = v0(v5)
v13 = v4 * v5 ** 2
v14 = (v6 * v11 - v13 + v8 * (1 - v4)) * v10
v15 = (v7 * v12 + v13 - (v9 + v8) * v5) * v10
v4 += v14
v5 += v15
return (v4, v5) | [
{
"name": "v0",
"input_types": [
"np.ndarray"
],
"output_type": "Any",
"code": "def v0(v1: np.ndarray):\n v2 = -4 * v1\n v2 += np.roll(v1, (0, -1), (0, 1))\n v2 += np.roll(v1, (0, +1), (0, 1))\n v2 += np.roll(v1, (-1, 0), (0, 1))\n v2 += np.roll(v1, (+1, 0), (0, 1))\n ret... | [
"numpy"
] | [
"import numpy as np"
] | 9 | # adapted from https://github.com/benmaier/reaction-diffusion/blob/master/gray_scott.ipynb
# based on http://karlsims.com/rd.html
# proposed setup to ignore margins: https://ipython-books.github.io/124-simulating-a-partial-differential-equation-reaction-diffusion-systems-and-turing-patterns/
import numpy as np
from t... | null |
v0 | [
"int",
"Any"
] | Any | def v0(self, v1: int, v2=1.0):
for v3 in range(v1):
self.update(delta_t=v2) | [] | [] | [] | 3 | # adapted from https://github.com/benmaier/reaction-diffusion/blob/master/gray_scott.ipynb
# based on http://karlsims.com/rd.html
# proposed setup to ignore margins: https://ipython-books.github.io/124-simulating-a-partial-differential-equation-reaction-diffusion-systems-and-turing-patterns/
import numpy as np
from t... | null |
v0 | [
"str"
] | Any | def v0(self, v1: str):
v2 = ['bassan', 'konevskikh', 'rasskazov']
v3 = next((a for v4 in v2 if v4 in v1.lower()), None)
if v3 is None:
raise ValueError('Algorithm must be one of ' + str(v2))
self.scAlgorithm = v3 | [] | [] | [] | 6 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 22:55:02 2019
@author: carl
"""
import traceback
import os.path
from collections import namedtuple
import numpy as np
import scipy.signal, scipy.io
from scipy.interpolate import interp1d
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
fr... | null |
v0 | [] | float | def v0(self) -> float:
v1 = self.total - self.current
if v1 < 0:
return 999999.9
return v1 / self.coolness | [] | [] | [] | 5 | #!/usr/bin/env python3
# vim: ts=4 expandtab
"""Self care commands"""
from __future__ import annotations
from typing import Any, Dict, Generator, List, Union
import itertools
import math
import bot.commands
Number = Union[float, int]
class DonationAmount:
current: int
total: int
coolness: int
... | null |
v72 | [
"int"
] | List[v1] | def v72(self, v73: int) -> List[v1]:
v74: Dict[int, v1] = {}
for v75 in itertools.chain(v30(v73), v38(v73), v25(v73), v54(v73), v46(v73), v61(v73)):
if v75.total in v74:
v74[v75.total].coolness = max(v74[v75.total].coolness, v75.coolness)
else:
v74[v75.total] = v75
v7... | [
{
"name": "v25",
"input_types": [
"int"
],
"output_type": "v0",
"code": "def v25(v26: int) -> v0:\n if v26 < 1000:\n return None\n v27 = str(v26)\n v28 = v27[0:2] * math.ceil(len(v27) / 2)\n v29 = int(v28[:len(v27)])\n if v29 > v26:\n yield v1(v26, v29, 2 * len... | [
"itertools",
"math"
] | [
"import itertools",
"import math"
] | 14 | #!/usr/bin/env python3
# vim: ts=4 expandtab
"""Self care commands"""
from __future__ import annotations
from typing import Any, Dict, Generator, List, Union
import itertools
import math
import bot.commands
Number = Union[float, int]
class DonationAmount:
current: int
total: int
coolness: int
... | [
"v0 = Generator[DonationAmount, None, None]",
"class v1:\n v2: int\n v3: int\n v4: int\n\n def __init__(self, v5: int, v6: int, v7: int) -> None:\n self.current = v5\n self.total = v6\n self.coolness = v7 if v7 > 0 else 1\n\n def v8(self) -> float:\n v9 = self.total - se... |
v0 | [
"Optional[str]",
"Optional[Dict[str, List[str]]]"
] | int | def v0(self, v1: Optional[str]=None, v2: Optional[Dict[str, List[str]]]=None) -> int:
if v2:
raise Exception('filters are not supported for get_embedding_count in MilvusDocumentStore.')
v1 = v1 or self.index
(v3, v4) = self.milvus_server.count_entities(v1)
if v4 is None:
v4 = 0
retur... | [] | [] | [] | 8 | from typing import TYPE_CHECKING, Any, Dict, Generator, List, Optional, Union
if TYPE_CHECKING:
from haystack.nodes.retriever import BaseRetriever
import logging
import numpy as np
from tqdm import tqdm
from scipy.special import expit
from milvus import IndexType, MetricType, Milvus, Status
from haystack.schema... | null |
v0 | [
"v1"
] | int | def v0(self, v1: v1) -> int:
v2 = 2147483647
v3 = -2147483648
for v4 in range(len(v1)):
if v1[v4] == ' ':
continue
elif v1[v4] == '+' or v1[v4] == '-' or v1[v4].isdigit():
v5 = 0
v6 = 1
if v1[v4] == '+':
v6 = 1
v... | [] | [] | [] | 24 | class Solution:
def myAtoi(self, str: str) -> int:
intMax = 2147483647
intMin = -2147483648
for i in range(len(str)):
if str[i] == " ":
continue
elif str[i] == '+' or str[i] == '-' or str[i].isdigit():
num = 0
sign = 1
... | null |
v0 | [
"str",
"str",
"str"
] | str | def v0(self, v1: str, v2: str, v3: str) -> str:
assert v2[0] == '/'
v2 = v2[1:]
v4 = os.path.join(v1, v2, f'{v3}.json')
return os.path.join(self.path, v4) | [] | [
"os"
] | [
"import os"
] | 5 | # -*- coding: utf-8 -*-
__all__ = ('RecoveredNodeModelDatabase',)
import os
from loguru import logger
import attr
from .model import RecoveredNodeModel
from ..config import Config
@attr.s
class RecoveredNodeModelDatabase:
"""Provides an interface for caching recovered node models to and from disk.
Attribu... | null |
v0 | [
"np.ndarray"
] | Any | def v0(self, v1: np.ndarray):
if v1 is self.available_buffer:
self.available_buffer = self.target_tensor
self.target_tensor = v1 | [] | [] | [] | 4 | # Copyright 2018 The Cirq Developers
#
# 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 ... | null |
v0 | [
"'ActOnStateVectorArgs'"
] | Any | def v0(self, v1: 'ActOnStateVectorArgs'):
v1.target_tensor = self.target_tensor.copy()
v1.available_buffer = self.available_buffer.copy() | [] | [] | [] | 3 | # Copyright 2018 The Cirq Developers
#
# 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 ... | null |
v20 | [
"v0"
] | Any | def v20(v21: v0):
for v22 in ['Hunter', 'Warrior', 'Druid', 'Priest', 'Mage', 'Paladin', 'Rogue', 'Warlock', 'Shaman']:
v21.store('CLM.L["{0}"]'.format(v22), Path(v21.base) / Path(''), 'indirectly') | [] | [
"pathlib"
] | [
"from pathlib import Path"
] | 3 | import sys
import argparse
import string
import copy
import os
import re
from pathlib import Path
import pprint
from xmlrpc.client import boolean
pp = pprint.PrettyPrinter(indent=4)
class L10nStorage:
def __init__(self, base, parser):
self.data = {}
self.not_used = {}
self.translations = {... | [
"class v0:\n\n def __init__(self, v1, v2):\n self.data = {}\n self.not_used = {}\n self.translations = {}\n self.do_not_translate = {}\n self.base = v1\n self.parser = v2\n\n def v3(self, v4: string, v5: Path, v6: int):\n if not self.data.get(v4):\n ... |
v20 | [
"Path",
"Any",
"v0"
] | Any | def v20(v21: Path, v22, v23: v0):
with open(v21, 'r') as v24:
v25 = 0
while True:
v26 = v24.readline()
if not v26:
break
v25 += 1
v27 = v22.findall(v26)
if v27:
for v28 in v27:
v23.store(v... | [] | [] | [] | 12 | import sys
import argparse
import string
import copy
import os
import re
from pathlib import Path
import pprint
from xmlrpc.client import boolean
pp = pprint.PrettyPrinter(indent=4)
class L10nStorage:
def __init__(self, base, parser):
self.data = {}
self.not_used = {}
self.translations = {... | [
"class v0:\n\n def __init__(self, v1, v2):\n self.data = {}\n self.not_used = {}\n self.translations = {}\n self.do_not_translate = {}\n self.base = v1\n self.parser = v2\n\n def v3(self, v4: string, v5: Path, v6: int):\n if not self.data.get(v4):\n ... |
v20 | [
"Path",
"Any",
"v0",
"Any"
] | Any | def v20(v21: Path, v22, v23: v0, v24):
with open(v21, 'r') as v25:
v26 = 0
while True:
v27 = v25.readline()
if not v27:
break
v26 += 1
v28 = v27.strip().endswith('notranslate')
if not v27.startswith('--') or v28:
... | [] | [] | [] | 14 | import sys
import argparse
import string
import copy
import os
import re
from pathlib import Path
import pprint
from xmlrpc.client import boolean
pp = pprint.PrettyPrinter(indent=4)
class L10nStorage:
def __init__(self, base, parser):
self.data = {}
self.not_used = {}
self.translations = {... | [
"class v0:\n\n def __init__(self, v1, v2):\n self.data = {}\n self.not_used = {}\n self.translations = {}\n self.do_not_translate = {}\n self.base = v1\n self.parser = v2\n\n def v3(self, v4: string, v5: Path, v6: int):\n if not self.data.get(v4):\n ... |
v20 | [
"v0",
"string",
"boolean"
] | Any | def v20(v21: v0, v22: string, v23: boolean):
v24 = []
v25 = 0
for v26 in v21.data.keys():
v27 = v21.get_translation(v22, v26)
v28 = v21.get_if_do_translate(v22, v26)
if v28:
if v27 == '':
v24.append(v26)
else:
v25 = v25 + 1
if len(v... | [] | [] | [] | 25 | import sys
import argparse
import string
import copy
import os
import re
from pathlib import Path
import pprint
from xmlrpc.client import boolean
pp = pprint.PrettyPrinter(indent=4)
class L10nStorage:
def __init__(self, base, parser):
self.data = {}
self.not_used = {}
self.translations = {... | [
"class v0:\n\n def __init__(self, v1, v2):\n self.data = {}\n self.not_used = {}\n self.translations = {}\n self.do_not_translate = {}\n self.base = v1\n self.parser = v2\n\n def v3(self, v4: string, v5: Path, v6: int):\n if not self.data.get(v4):\n ... |
v0 | [
"string",
"Path",
"int"
] | Any | def v0(self, v1: string, v2: Path, v3: int):
if not self.data.get(v1):
self.data[v1] = []
self.data[v1].append((v2.relative_to(self.base), v3)) | [] | [] | [] | 4 | import sys
import argparse
import string
import copy
import os
import re
from pathlib import Path
import pprint
from xmlrpc.client import boolean
pp = pprint.PrettyPrinter(indent=4)
class L10nStorage:
def __init__(self, base, parser):
self.data = {}
self.not_used = {}
self.translations = {... | null |
v0 | [
"Tuple[int, int]"
] | Tuple[int, int] | def v0(self, v1: Tuple[int, int]) -> Tuple[int, int]:
v2 = self.pad * self.scale
return (round((v1[0] - v2) / self.unit), round((v1[1] - v2) / self.unit)) | [] | [] | [] | 3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import Tk, messagebox, Canvas, PhotoImage, Button, DISABLED, NORMAL, HIDDEN
from os import path
from itertools import product
from typing import Tuple, Optional, Iterable
import numpy as np
from go_types import *
from go_board import *
resource_dir = "../../im... | null |
v0 | [
"Tuple[int, int]"
] | Tuple[int, int] | def v0(self, v1: Tuple[int, int]) -> Tuple[int, int]:
v2 = self.pad * self.scale
return (int(v2 + v1[0] * self.unit), int(v2 + v1[1] * self.unit)) | [] | [] | [] | 3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import Tk, messagebox, Canvas, PhotoImage, Button, DISABLED, NORMAL, HIDDEN
from os import path
from itertools import product
from typing import Tuple, Optional, Iterable
import numpy as np
from go_types import *
from go_board import *
resource_dir = "../../im... | null |
v0 | [
"Tuple[int, int]",
"Any"
] | Any | def v0(self, v1: Tuple[int, int], v2='#3ae'):
self.remove_sign(v1)
(v3, v4) = self.grid_to_screen(v1)
v5 = self.create_oval(v3 + 0.5 * self.unit, v4 + 0.5 * self.unit, v3 - 0.5 * self.unit, v4 - 0.5 * self.unit, width=3, outline=v2)
self.addtag_withtag('sign', v5)
self.__image_signs[v1] = v5 | [] | [] | [] | 6 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import Tk, messagebox, Canvas, PhotoImage, Button, DISABLED, NORMAL, HIDDEN
from os import path
from itertools import product
from typing import Tuple, Optional, Iterable
import numpy as np
from go_types import *
from go_board import *
resource_dir = "../../im... | null |
v0 | [
"Tuple[int, int]"
] | Any | def v0(self, v1: Tuple[int, int]):
if v1 in self.__image_signs:
self.delete(self.__image_signs[v1])
del self.__image_signs[v1] | [] | [] | [] | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import Tk, messagebox, Canvas, PhotoImage, Button, DISABLED, NORMAL, HIDDEN
from os import path
from itertools import product
from typing import Tuple, Optional, Iterable
import numpy as np
from go_types import *
from go_board import *
resource_dir = "../../im... | null |
v0 | [
"Any"
] | bool | def v0(self, v1) -> bool:
if not isinstance(v1, int):
raise TypeError(f'addr must be of type int, got {v1.__class__}')
if not 0 <= v1 < len(self._memory_map):
raise ValueError(f"addr '{v1}' outside of memory range of 0 to {len(self._memory_map) - 1}")
return True | [] | [] | [] | 6 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"int"
] | int | def v0(self, v1: int) -> int:
self._validate_addr(v1)
with self._lock:
return self._memory_map[v1] | [] | [] | [] | 4 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"int"
] | Any | def v0(self, v1: int):
v1 = str(v1).zfill(5)
v2 = int(v1[3:])
if not re.match('^[012]{3}$', v1[0:3]):
return None
v3 = int(v1[2])
v4 = int(v1[1])
v5 = int(v1[0])
v6 = {1: partial(self._op_add, a_mode=v3, b_mode=v4, dst_mode=v5), 2: partial(self._op_mul, a_mode=v3, b_mode=v4, dst_mode... | [] | [
"functools",
"re"
] | [
"import re",
"from functools import partial"
] | 10 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"int",
"int"
] | int | def v0(self, v1: int, v2: int) -> int:
v3 = None
if v2 == 0:
v3 = v1
elif v2 == 1:
v3 = v1
elif v2 == 2:
v1 += self._relative_base
v3 = v1
return v3 | [] | [] | [] | 10 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"int"
] | Any | def v0(self, v1: int):
(v2,) = self._get_parameters(1)
self._relative_base += self._dereference(v2, v1) | [] | [] | [] | 3 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"bool",
"int",
"int"
] | Any | def v0(self, v1: bool, v2: int, v3: int):
(v4, v5) = self._get_parameters(2)
v4 = self._dereference(v4, v2)
v6 = False
if v1 and v4 != 0:
v6 = True
elif not v1 and v4 == 0:
v6 = True
if v6:
self._program_counter = self._dereference(v5, v3) | [] | [] | [] | 10 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"bool",
"int",
"int",
"int"
] | Any | def v0(self, v1: bool, v2: int, v3: int, v4: int):
(v5, v6, v7) = self._get_parameters(3)
v5 = self._dereference(v5, v2)
v6 = self._dereference(v6, v3)
v7 = self._resolve_addr(v7, v4)
if v1 and v5 == v6:
v8 = 1
elif not v1 and v5 < v6:
v8 = 1
else:
v8 = 0
self._se... | [] | [] | [] | 12 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"int",
"int",
"int"
] | Any | def v0(self, v1: int, v2: int, v3: int):
(v4, v5, v6) = self._get_parameters(3)
v4 = self._dereference(v4, v1)
v5 = self._dereference(v5, v2)
v6 = self._resolve_addr(v6, v3)
self._set_memory(v6, v4 + v5) | [] | [] | [] | 6 | """
This file is part of Advent of Code 2019.
Coded by: Samuel Michaels (samuel.michaels@protonmail.com)
11 December 2019
NO COPYRIGHT
This work is dedicated to the public domain. All rights have been
waived worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
Y... | null |
v0 | [
"Any",
"Any"
] | int | def v0(v1, v2) -> int:
if v1 == v2:
return 1
else:
return 0 | [] | [] | [] | 5 | import numpy as np # Used for computation.
import sys
import os
np.set_printoptions(precision=5, suppress=True, threshold=81)
itera = 1000 # Number of iterations
N = 10 # Number of particles.
Iterstep = 500 # Saving parameter
os.chdir('coherenttest')
def parser():
"""Parsing the commandline arguments"""
... | null |
v0 | [
"int"
] | np.array | def v0(v1: int) -> np.array:
v2 = np.full((v1, 3, v1, 3), 0, dtype=complex)
'\n for j in range(n):\n for m in range(3):\n for l in range(n):\n for k in range(3):\n if m == 0 and k == 0 and j == 0 and l == 0:\n ten[j, m][l, k] = 1\n ... | [] | [
"numpy"
] | [
"import numpy as np"
] | 5 | import numpy as np # Used for computation.
import sys
import os
np.set_printoptions(precision=5, suppress=True, threshold=81)
itera = 1000 # Number of iterations
N = 10 # Number of particles.
Iterstep = 500 # Saving parameter
os.chdir('coherenttest')
def parser():
"""Parsing the commandline arguments"""
... | null |
v0 | [
"int"
] | np.array | def v0(v1: int) -> np.array:
v2 = np.full((v1, 3, v1, 3), 0, dtype=complex)
return v2 | [] | [
"numpy"
] | [
"import numpy as np"
] | 3 | import numpy as np # Used for computation.
import sys
import os
np.set_printoptions(precision=5, suppress=True, threshold=81)
itera = 1000 # Number of iterations
N = 10 # Number of particles.
Iterstep = 500 # Saving parameter
os.chdir('coherenttest')
def parser():
"""Parsing the commandline arguments"""
... | null |
v0 | [] | None | async def v0(self) -> None:
self.manager.async_listen_updates(self._process_manager_data)
if self.manager.data:
await self._process_manager_data() | [] | [] | [] | 4 | """Helper sensor for calculating utility costs."""
from __future__ import annotations
import asyncio
import copy
from dataclasses import dataclass
import logging
from typing import Any, Final, Literal, TypeVar, cast
from homeassistant.components.sensor import (
ATTR_LAST_RESET,
ATTR_STATE_CLASS,
DEVICE_CL... | null |
v0 | [
"Any",
"Any",
"int"
] | float | def v0(v1, v2, v3: int=10) -> float:
v4 = 0
for (v5, v6) in v1:
if v5 == v6:
v4 += 1 / v3
else:
v7 = v2.similar_by_vector(v5, topn=v3)
v8 = [item for (v9, v10) in v7]
if v6 in v8:
v4 += 1 / v3
v4 /= len(v1)
return v4 * 1000 | [] | [] | [] | 12 | import collections
import numpy as np
def recall_at_k(test, embeddings, k: int = 10) -> float:
"""
test must be a list of (query, ground truth) pairs
embeddings must be a gensim.word2vec.wv thingy
"""
ratk_score = 0
for query_item, ground_truth in test:
try:
# get the k mos... | null |
v0 | [
"Any",
"Any",
"int"
] | float | def v0(v1, v2, v3: int=10) -> float:
v4 = 0
for (v5, v6) in v1:
try:
v7 = collections.Counter(v2[v5])
v8 = v7.most_common(v3)
v9 = [item for (v10, v11) in v8]
if v6 in v9:
v4 += 1
except:
pass
v4 /= len(v1)
retur... | [] | [
"collections"
] | [
"import collections"
] | 13 | import collections
import numpy as np
def recall_at_k(test, embeddings, k: int = 10) -> float:
"""
test must be a list of (query, ground truth) pairs
embeddings must be a gensim.word2vec.wv thingy
"""
ratk_score = 0
for query_item, ground_truth in test:
try:
# get the k mos... | null |
v0 | [
"Any",
"Any",
"int"
] | float | def v0(v1, v2, v3: int) -> float:
v4 = 0
for (v5, v6) in v1:
v7 = v2.similar_by_vector(v5, topn=v3)
v8 = [item for (v9, v10) in v7]
if v6 in v8:
v11 = np.argwhere(np.array(v8) == v6)[0][0] + 1
v4 += 1 / v11
v4 /= len(v1)
return v4 | [] | [
"numpy"
] | [
"import numpy as np"
] | 10 | import collections
import numpy as np
def recall_at_k(test, embeddings, k: int = 10) -> float:
"""
test must be a list of (query, ground truth) pairs
embeddings must be a gensim.word2vec.wv thingy
"""
ratk_score = 0
for query_item, ground_truth in test:
try:
# get the k mos... | null |
v0 | [
"Any",
"Any",
"int"
] | float | def v0(v1, v2, v3: int=10) -> float:
v4 = 0
for (v5, v6) in v1:
try:
v7 = collections.Counter(v2[v5])
v8 = v7.most_common(v3)
v9 = [item for (v10, v11) in v8]
if v6 in v9:
v12 = np.argwhere(np.array(v9) == v6)[0][0] + 1
v4 +... | [] | [
"collections",
"numpy"
] | [
"import collections",
"import numpy as np"
] | 14 | import collections
import numpy as np
def recall_at_k(test, embeddings, k: int = 10) -> float:
"""
test must be a list of (query, ground truth) pairs
embeddings must be a gensim.word2vec.wv thingy
"""
ratk_score = 0
for query_item, ground_truth in test:
try:
# get the k mos... | null |
v24 | [
"v0",
"Any",
"Any",
"int",
"int",
"int",
"int",
"Any",
"Any"
] | Any | def v24(v25: v0, v26, v27, v28: int, v29: int, v30: int, v31: int, v32, v33):
v34 = 0
v35 = defaultdict(list)
v36 = defaultdict(list)
v37 = v28 + v29 + v30 + v31
v38 = np.zeros((v37, 3), dtype=v33)
v39 = np.zeros((v37, 3), dtype=v32)
for (v40, v41) in sorted(v25.nodes.items()):
v42 =... | [] | [
"collections",
"numpy"
] | [
"from collections import defaultdict",
"import numpy as np"
] | 38 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | [
"class v0(BDF_):\n v1 = ['is_bdf_vectorized', 'nid_map', 'wtmass', 'type_slot_str'] + ['nastran_format', 'is_long_ids', 'sol', 'subcases', 'nnodes', 'node_ids', 'point_ids', 'npoints', 'nelements', 'element_ids', 'nproperties', 'property_ids', 'nmaterials', 'material_ids', 'ncoords', 'coord_ids', 'ncaeros', 'cae... |
v24 | [
"v0",
"str"
] | Any | def v24(v25: v0, v26: str):
v27 = {'msc': v25.set_as_msc, 'nx': v25.set_as_nx, 'optistruct': v25.set_as_optistruct, 'mystran': v25.set_as_mystran, 'nasa95': v25.set_as_nasa95, 'zona': v25.set_as_zona}
try:
v28 = v27[v26]
except KeyError:
v29 = ', '.join(v27)
v30 = f'mode={v26!r} is n... | [] | [] | [] | 9 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | [
"class v0(BDF_):\n v1 = ['is_bdf_vectorized', 'nid_map', 'wtmass', 'type_slot_str'] + ['nastran_format', 'is_long_ids', 'sol', 'subcases', 'nnodes', 'node_ids', 'point_ids', 'npoints', 'nelements', 'element_ids', 'nproperties', 'property_ids', 'nmaterials', 'material_ids', 'ncoords', 'coord_ids', 'ncaeros', 'cae... |
v24 | [
"v0",
"str"
] | Any | def v24(v25: v0, v26: str):
v27 = {'msc': v25._update_for_nastran, 'nx': v25._update_for_nastran, 'optistruct': v25._update_for_optistruct, 'mystran': v25._update_for_mystran, 'nasa95': v25._update_for_nasa95, 'zona': v25.zona.update_for_zona}
try:
v28 = v27[v26]
except KeyError:
v29 = f'mod... | [] | [] | [] | 8 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | [
"class v0(BDF_):\n v1 = ['is_bdf_vectorized', 'nid_map', 'wtmass', 'type_slot_str'] + ['nastran_format', 'is_long_ids', 'sol', 'subcases', 'nnodes', 'node_ids', 'point_ids', 'npoints', 'nelements', 'element_ids', 'nproperties', 'property_ids', 'nmaterials', 'material_ids', 'ncoords', 'coord_ids', 'ncaeros', 'cae... |
v0 | [] | List[str] | def v0(self) -> List[str]:
v1 = self.object_attributes(mode='both', keys_to_skip=None)
return v1 | [] | [] | [] | 3 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"bool"
] | str | def v0(self, v1: bool=True) -> str:
if v1:
self.uncross_reference()
return dumps(self) | [] | [
"pickle"
] | [
"from pickle import load, dump, dumps"
] | 4 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"str",
"bool"
] | None | def v0(self, v1: str='model.obj', v2: bool=True) -> None:
if v2:
self.uncross_reference()
with open(v1, 'wb') as v3:
dump(self, v3) | [] | [
"pickle"
] | [
"from pickle import load, dump, dumps"
] | 5 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"Any"
] | None | def v0(self, v1) -> None:
for (v2, v3) in v1.nodes.items():
self.nodes[v2] = v3
for (v4, v5) in self.elements.items():
self.elements[v4] = v5
for (v4, v5) in v1.rigid_elements.items():
self.rigid_elements[v4] = v5
for (v6, v7) in v1.properties.items():
self.properties[v6]... | [] | [] | [] | 19 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"Sequence[str]"
] | None | def v0(self, v1: Sequence[str]) -> None:
if v1 is None:
return
elif isinstance(v1, str):
v2 = set([v1])
else:
v2 = set(v1)
self.cards_to_read = self.cards_to_read.difference(v2) | [] | [] | [] | 8 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"Union[List[str], Set[str]]"
] | None | def v0(self, v1: Union[List[str], Set[str]]) -> None:
if v1 is None:
return
elif isinstance(v1, str):
v2 = set([v1])
else:
v2 = set(v1)
self.cards_to_read = v2 | [] | [] | [] | 8 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"int",
"bool",
"int",
"bool"
] | None | def v0(self, v1: int=100, v2: bool=True, v3: int=100, v4: bool=True) -> None:
assert isinstance(v1, int), type(v1)
assert isinstance(v3, int), type(v3)
self._nparse_errors = v1
self._nxref_errors = v3
self._stop_on_parsing_error = v2
self._stop_on_xref_error = v4 | [] | [] | [] | 7 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"List[str]",
"Any"
] | None | def v0(self, v1: List[str], v2: Any) -> None:
v3 = True
v4 = []
v5 = {}
if self._is_cards_dict:
(v5, v6) = self.get_bdf_cards_dict(v1, v2)
else:
(v4, v5, v6) = self.get_bdf_cards(v1, v2)
self._parse_cards(v4, v5, v6, strict=v3)
if self.values_to_skip:
for (v7, v8) in ... | [] | [] | [] | 17 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"int",
"Optional[str]",
"int"
] | None | def v0(self, v1: int, v2: Optional[str], v3: int) -> None:
self.sol_iline = v3
if v1 is None:
self.sol = None
self.sol_method = None
return
try:
self.sol = int(v1)
except ValueError:
try:
self.sol = self._solmap_to_value[v1]
except KeyError:
... | [] | [] | [] | 20 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"str",
"int",
"int",
"Union[int, float, str]"
] | None | def v0(self, v1: str, v2: int, v3: int, v4: Union[int, float, str]) -> None:
for v5 in self.card_count:
assert isinstance(v5, str), f'key={v5!r}'
if v5 not in self._type_to_slot_map:
v6 = 'add %r to self._type_to_slot_map\n%s' % (v5, str(self._type_to_slot_map))
raise Runtime... | [] | [] | [] | 19 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"Dict[str, Union[int, float, str]]"
] | None | def v0(self, v1: Dict[str, Union[int, float, str]]) -> None:
self.dict_of_vars = {}
assert len(v1) > 0, f'nvars = {len(v1):d}'
for (v2, v3) in sorted(v1.items()):
assert len(v2) <= 7, 'max length for key is 7; len(%s)=%s' % (v2, len(v2))
assert len(v2) >= 1, 'min length for key is 1; len(%s)... | [] | [] | [] | 11 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"str"
] | bool | def v0(self, v1: str) -> bool:
assert '=' not in v1, v1
if v1.startswith('='):
return False
elif v1 in self.cards_to_read:
return False
if v1:
if v1 not in self.reject_count:
self.reject_count[v1] = 0
self.reject_count[v1] += 1
return True | [] | [] | [] | 11 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"int",
"List[str]",
"str",
"str",
"bool",
"bool"
] | Any | def v0(self, v1: int, v2: List[str], v3: str, v4: str='', v5: bool=True, v6: bool=True) -> Any:
assert isinstance(v1, (int, np.int32)), 'ifile=%s type=%s' % (v1, type(v1))
v3 = v3.upper()
(v7, v8) = self.create_card_object(v2, v3, is_list=v5, has_none=v6)
self._add_card_helper_ifile(v1, v7, v3, v3, v4)
... | [] | [
"numpy"
] | [
"import numpy as np"
] | 6 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"List[str]",
"str",
"str",
"Any",
"bool",
"bool"
] | Any | def v0(self, v1: List[str], v2: str, v3: str='', v4=None, v5: bool=True, v6: bool=True) -> Any:
v2 = v2.upper()
(v7, v8) = self.create_card_object(v1, v2, is_list=v5, has_none=v6)
self._add_card_helper_lax(v7, v2, v2, v4, comment=v3)
return v7 | [] | [] | [] | 5 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v51 | [
"str",
"str",
"bool"
] | Any | def v51(self, v52: str='float64', v53: str='int32', v54: bool=True) -> Any:
v55 = len(self.nodes)
v56 = 0
v57 = 0
v58 = None
v59 = None
v60 = len(self.ringaxs)
if self.spoints:
v58 = list(self.spoints)
v56 = len(v58)
if self.epoints:
v59 = list(self.epoints)
... | [
{
"name": "v24",
"input_types": [
"v0",
"Any",
"Any",
"int",
"int",
"int",
"int",
"Any",
"Any"
],
"output_type": "Any",
"code": "def v24(v25: v0, v26, v27, v28: int, v29: int, v30: int, v31: int, v32, v33):\n v34 = 0\n v35 = defaultdict... | [
"collections",
"numpy"
] | [
"from collections import defaultdict",
"import numpy as np"
] | 44 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | [
"class v0(BDF_):\n v1 = ['is_bdf_vectorized', 'nid_map', 'wtmass', 'type_slot_str'] + ['nastran_format', 'is_long_ids', 'sol', 'subcases', 'nnodes', 'node_ids', 'point_ids', 'npoints', 'nelements', 'element_ids', 'nproperties', 'property_ids', 'nmaterials', 'material_ids', 'ncoords', 'coord_ids', 'ncaeros', 'cae... |
v0 | [
"int",
"str",
"str"
] | Tuple[np.ndarray, np.ndarray, np.ndarray, Dict[int, np.ndarray], Dict[int, np.ndarray]] | def v0(self, v1: int=0, v2: str='float64', v3: str='int32') -> Tuple[np.ndarray, np.ndarray, np.ndarray, Dict[int, np.ndarray], Dict[int, np.ndarray]]:
(v4, v5, v6, v7) = self.get_displacement_index_xyz_cp_cd(fdtype=v2, idtype=v3, sort_ids=True)
v8 = v7[:, 0]
v9 = self.transform_xyzcp_to_xyz_cid(v6, v8, v5,... | [] | [] | [] | 5 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v13 | [
"np.ndarray",
"np.ndarray",
"Dict[int, np.ndarray]",
"int",
"bool",
"float"
] | np.ndarray | def v13(self, v14: np.ndarray, v15: np.ndarray, v16: Dict[int, np.ndarray], v17: int=0, v18: bool=False, v19: float=1e-06) -> np.ndarray:
if self.is_bdf_vectorized:
v18 = False
v20 = list(self.coords.keys())
else:
v20 = list(self.coords.keys())
v20.sort()
assert 0 in v20, v20
... | [
{
"name": "v0",
"input_types": [
"Any",
"Any",
"Any"
],
"output_type": "Any",
"code": "def v0(self, v1, v2, v3):\n v4 = []\n v5 = []\n for v6 in sorted(v1):\n v7 = self.coords[v6]\n if v7.type in ['CORD2R', 'CORD2C', 'CORD2S']:\n if v7.rid in v... | [
"numpy"
] | [
"import numpy as np"
] | 89 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [] | Tuple[Any, Any, Dict[int, Any]] | def v0(self) -> Tuple[Any, Any, Dict[int, Any]]:
v1 = defaultdict(list)
v2 = {}
if len(self.coords) == 1:
return v2
for (v3, v4) in sorted(self.nodes.items()):
v5 = v4.Cd()
if v5:
v1[v5].append(v3)
v6 = np.array(sorted(self.point_ids))
for v7 in sorted(v1.keys... | [] | [
"collections",
"numpy"
] | [
"from collections import defaultdict",
"import numpy as np"
] | 14 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"str",
"int"
] | None | def v0(self, v1: str, v2: int=1) -> None:
assert '=' not in v1, v1
if v1 in self.card_count:
self.card_count[v1] += v2
else:
self.card_count[v1] = v2 | [] | [] | [] | 6 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"List[List[str]]",
"Dict[str, List[str]]",
"Dict[str, int]",
"bool"
] | None | def v0(self, v1: List[List[str]], v2: Dict[str, List[str]], v3: Dict[str, int], v4: bool=True) -> None:
v5 = (card_name for v6 in list(v3.keys()) if '=' in v6)
for v6 in v5:
del v3[v6]
self.echo = False
if v2:
self._parse_cards_dict(v2)
if v1:
self._parse_cards_list(v1, stric... | [] | [] | [] | 9 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v30 | [
"Union[str, StringIO]"
] | None | def v30(self, v31: Union[str, StringIO]) -> None:
if isinstance(v31, (str, PurePath)):
try:
with open(v31, 'r') as v32:
v33 = v32.readlines()
except UnicodeDecodeError:
with open(v31, 'r', errors='replace') as v32:
v34 = 'temp'
... | [
{
"name": "v24",
"input_types": [
"v0",
"str"
],
"output_type": "Any",
"code": "def v24(v25: v0, v26: str):\n v27 = {'msc': v25._update_for_nastran, 'nx': v25._update_for_nastran, 'optistruct': v25._update_for_optistruct, 'mystran': v25._update_for_mystran, 'nasa95': v25._update_f... | [
"pathlib"
] | [
"from pathlib import PurePath"
] | 27 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | [
"class v0(BDF_):\n v1 = ['is_bdf_vectorized', 'nid_map', 'wtmass', 'type_slot_str'] + ['nastran_format', 'is_long_ids', 'sol', 'subcases', 'nnodes', 'node_ids', 'point_ids', 'npoints', 'nelements', 'element_ids', 'nproperties', 'property_ids', 'nmaterials', 'material_ids', 'ncoords', 'coord_ids', 'ncaeros', 'cae... |
v0 | [
"List[str]",
"str",
"Any",
"bool",
"bool"
] | Any | def v0(self, v1: List[str], v2: str, v3='', v4: bool=True, v5: bool=True) -> Any:
v2 = v2.upper()
(v6, v7) = self.create_card_object(v1, v2, is_list=v4, has_none=v5)
v8 = self._add_card_helper_hdf5(v6, v2, v2, v3)
return v8 | [] | [] | [] | 5 | # coding: utf-8
# pylint: disable=W0201,R0915,R0912
"""
Main BDF class. Defines:
- BDF
"""
# TABLE3D TID X0 Y0 Z0 F0
# X1 Y1 Z1 F1 X2 Y2 Z2 F2
# X3 Y3 Z3 F3 X4 Y4 Z4 F4
# -etc.- ENDT
# see https://docs.plm.automation.siemens.com/tdoc/nxnastran/10/help/#uid:index
from __future__ import annotations
import os
import ... | null |
v0 | [
"Dict[str, str]"
] | bool | def v0(self, v1: Dict[str, str]) -> bool:
if self.place1 not in v1 or self.place2 not in v1:
return True
return v1[self.place1] != v1[self.place2] | [] | [] | [] | 4 | # map_coloring.py
# From Classic Computer Science Problems in Python Chapter 3
# Copyright 2018 David Kopec
#
# 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/... | null |
v0 | [
"'ProductVariant'",
"int"
] | Any | def v0(v1: 'ProductVariant', v2: int):
v3 = None
for v4 in v1.channel_listings.all():
if v4.channel_id == v2:
v3 = v4
return v3 | [] | [] | [] | 6 | import itertools
from dataclasses import dataclass
from functools import singledispatch
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
)
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObjec... | null |
v6 | [
"'Checkout'",
"'Product'",
"'ProductVariantChannelListing'",
"dict"
] | Any | def v6(v7: 'Checkout', v8: 'Product', v9: 'ProductVariantChannelListing', v10: dict):
if not v9 or v9.price is None:
return False
v11 = v0(v10, v7.channel_id, v8)
if not v11 or v11.is_available_for_purchase() is False or (not v11.is_visible):
return False
return True | [
{
"name": "v0",
"input_types": [
"dict",
"int",
"'Product'"
],
"output_type": "Any",
"code": "def v0(v1: dict, v2: int, v3: 'Product'):\n v4 = v1.get(v3.id)\n if v3.id not in v1:\n for v5 in v3.channel_listings.all():\n if v5.channel_id == v2:\n ... | [] | [] | 7 | import itertools
from dataclasses import dataclass
from functools import singledispatch
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
)
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObjec... | null |
v0 | [
"dict",
"int",
"'Product'"
] | Any | def v0(v1: dict, v2: int, v3: 'Product'):
v4 = v1.get(v3.id)
if v3.id not in v1:
for v5 in v3.channel_listings.all():
if v5.channel_id == v2:
v4 = v5
v1[v3.id] = v4
return v4 | [] | [] | [] | 8 | import itertools
from dataclasses import dataclass
from functools import singledispatch
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
)
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObjec... | null |
v0 | [] | str | def v0(self) -> str:
v1 = self.shipping_address or self.billing_address
if v1 is None or not v1.country:
return self.checkout.country.code
return v1.country.code | [] | [] | [] | 5 | import itertools
from dataclasses import dataclass
from functools import singledispatch
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
)
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObjec... | null |
v0 | [
"Any"
] | bool | def v0(self, v1) -> bool:
v2 = v1.valid_delivery_methods
return bool(v2 and self.delivery_method in v2) | [] | [] | [] | 3 | import itertools
from dataclasses import dataclass
from functools import singledispatch
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
)
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObjec... | null |
v0 | [
"str"
] | str | def v0(v1: str) -> str:
if v1.lower() in ['<', 'little']:
return '<'
elif v1.lower() in ['>', 'big']:
return '>'
else:
raise ValueError(f'Endianness {v1} not understood') | [] | [] | [] | 7 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"AnyStr",
"int"
] | AnyStr | def v0(v1: AnyStr, v2: int) -> AnyStr:
if isinstance(v1, bytes):
return v1 + b'\x00' * (v2 - len(v1))
return v1 + '\x00' * (v2 - len(v1)) | [] | [] | [] | 4 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"str"
] | np.dtype | def v0(v1: str) -> np.dtype:
if v1 in ['tc', '%tc', 'td', '%td', 'tw', '%tw', 'tm', '%tm', 'tq', '%tq', 'th', '%th', 'ty', '%ty']:
return np.dtype(np.float64)
else:
raise NotImplementedError(f'Format {v1} not implemented') | [] | [
"numpy"
] | [
"import numpy as np"
] | 5 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"Dict",
"List[Hashable]"
] | Dict | def v0(v1: Dict, v2: List[Hashable]) -> Dict:
v3 = {}
for v4 in v1:
if not v1[v4].startswith('%'):
v1[v4] = '%' + v1[v4]
if v4 in v2:
v3.update({v2.index(v4): v1[v4]})
else:
if not isinstance(v4, int):
raise ValueError('convert_dates ke... | [] | [] | [] | 12 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"np.dtype",
"Series"
] | int | def v0(v1: np.dtype, v2: Series) -> int:
if v1.type is np.object_:
v3 = max_len_string_array(ensure_object(v2._values))
return max(v3, 1)
elif v1.type is np.float64:
return 255
elif v1.type is np.float32:
return 254
elif v1.type is np.int32:
return 253
elif v1... | [] | [
"numpy",
"pandas"
] | [
"import numpy as np",
"from pandas._libs.lib import infer_dtype",
"from pandas._libs.writers import max_len_string_array",
"from pandas._typing import CompressionOptions, FilePath, ReadBuffer, StorageOptions, WriteBuffer",
"from pandas.util._decorators import Appender, doc",
"from pandas.core.dtypes.commo... | 16 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"np.dtype",
"Series",
"bool"
] | int | def v0(v1: np.dtype, v2: Series, v3: bool) -> int:
if v3:
return 32768
if v1.type is np.object_:
v4 = max_len_string_array(ensure_object(v2._values))
v4 = max(v4, 1)
if v4 <= 2045:
return v4
return 32768
elif v1.type is np.float64:
return 65526
... | [] | [
"numpy",
"pandas"
] | [
"import numpy as np",
"from pandas._libs.lib import infer_dtype",
"from pandas._libs.writers import max_len_string_array",
"from pandas._typing import CompressionOptions, FilePath, ReadBuffer, StorageOptions, WriteBuffer",
"from pandas.util._decorators import Appender, doc",
"from pandas.core.dtypes.commo... | 21 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"Union[str, bytes]",
"int"
] | bytes | def v0(v1: Union[str, bytes], v2: int) -> bytes:
if isinstance(v1, str):
v1 = bytes(v1, 'utf-8')
return v1 + b'\x00' * (v2 - len(v1)) | [] | [] | [] | 4 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [] | None | def v0(self) -> None:
if self.format_version < 118:
self._encoding = 'latin-1'
else:
self._encoding = 'utf-8' | [] | [] | [] | 5 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [] | List[str] | def v0(self) -> List[str]:
v1 = 33 if self.format_version < 118 else 129
return [self._decode(self.path_or_buf.read(v1)) for v2 in range(self.nvar)] | [] | [] | [] | 3 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [] | List[str] | def v0(self) -> List[str]:
if self.format_version >= 118:
v1 = 57
elif self.format_version > 113:
v1 = 49
elif self.format_version > 104:
v1 = 12
else:
v1 = 7
return [self._decode(self.path_or_buf.read(v1)) for v2 in range(self.nvar)] | [] | [] | [] | 10 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [] | List[str] | def v0(self) -> List[str]:
if self.format_version >= 118:
v1 = [self._decode(self.path_or_buf.read(321)) for v2 in range(self.nvar)]
elif self.format_version > 105:
v1 = [self._decode(self.path_or_buf.read(81)) for v2 in range(self.nvar)]
else:
v1 = [self._decode(self.path_or_buf.rea... | [] | [] | [] | 8 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [] | np.dtype | def v0(self) -> np.dtype:
if self._dtype is not None:
return self._dtype
v1 = []
for (v2, v3) in enumerate(self.typlist):
if v3 in self.NUMPY_TYPE_MAP:
v3 = cast(str, v3)
v1.append(('s' + str(v2), self.byteorder + self.NUMPY_TYPE_MAP[v3]))
else:
v1... | [] | [
"numpy",
"typing"
] | [
"from typing import Any, AnyStr, Dict, Hashable, List, Optional, Sequence, Tuple, Union, cast",
"import numpy as np"
] | 12 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"bytes"
] | str | def v0(self, v1: bytes) -> str:
v1 = v1.partition(b'\x00')[0]
try:
return v1.decode(self._encoding)
except UnicodeDecodeError:
v2 = self._encoding
v3 = f'\nOne or more strings in the dta file could not be decoded using {v2}, and\nso the fallback encoding of latin-1 is being used. Th... | [] | [
"warnings"
] | [
"import warnings"
] | 9 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"Optional[int]"
] | DataFrame | def v0(self, v1: Optional[int]=None) -> DataFrame:
if v1 is None:
v1 = self._chunksize
return self.read(nrows=v1) | [] | [] | [] | 4 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
v0 | [
"DataFrame"
] | DataFrame | def v0(self, v1: DataFrame) -> DataFrame:
if not hasattr(self, 'GSO') or len(self.GSO) == 0:
return v1
for (v2, v3) in enumerate(self.typlist):
if v3 != 'Q':
continue
v1.iloc[:, v2] = [self.GSO[str(k)] for v4 in v1.iloc[:, v2]]
return v1 | [] | [] | [] | 8 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.