id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
168,490 | import typing as t
from threading import local
_local = local()
The provided code snippet includes necessary dependencies for implementing the `pop_context` function. Write a Python function `def pop_context() -> None` to solve the following problem:
Removes the top level from the stack.
Here is the function:
def po... | Removes the top level from the stack. |
168,491 | import codecs
import io
import os
import re
import sys
import typing as t
from weakref import WeakKeyDictionary
def _find_binary_writer(stream: t.IO) -> t.Optional[t.BinaryIO]:
# We need to figure out if the given stream is already binary.
# This can happen because the official docs recommend detaching
# th... | null |
168,492 | import codecs
import io
import os
import re
import sys
import typing as t
from weakref import WeakKeyDictionary
def _force_correct_text_writer(
text_writer: t.IO,
encoding: t.Optional[str],
errors: t.Optional[str],
force_writable: bool = False,
) -> t.TextIO:
return _force_correct_text_stream(
... | null |
168,493 | import codecs
import io
import os
import re
import sys
import typing as t
from weakref import WeakKeyDictionary
def _get_argv_encoding() -> str:
import locale
return locale.getpreferredencoding() | null |
168,494 | import codecs
import io
import os
import re
import sys
import typing as t
from weakref import WeakKeyDictionary
def get_filesystem_encoding() -> str:
if sys.platform.startswith("win") and WIN:
from ._winconsole import _get_windows_console_stream
_ansi_stream_wrappers: t.MutableMapping[t.TextIO, t.TextIO] = Weak... | null |
168,495 | import codecs
import io
import os
import re
import sys
import typing as t
from weakref import WeakKeyDictionary
class WeakKeyDictionary(MutableMapping[_KT, _VT]):
def __init__(self, dict: None = ...) -> None: ...
def __init__(self, dict: Union[Mapping[_KT, _VT], Iterable[Tuple[_KT, _VT]]]) -> None: ...
def... | null |
168,496 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | Prompts for confirmation (yes/no question). If the user aborts the input by sending a interrupt signal this function will catch it and raise a :exc:`Abort` exception. :param text: the question to ask. :param default: The default value to use when no input is given. If ``None``, repeat until input is given. :param abort... |
168,497 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | This function takes a text and shows it via an environment specific pager on stdout. .. versionchanged:: 3.0 Added the `color` flag. :param text_or_generator: the text to page, or alternatively, a generator emitting the text to page. :param color: controls if the pager supports ANSI colors or not. The default is autode... |
168,498 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | This function creates an iterable context manager that can be used to iterate over something while showing a progress bar. It will either iterate over the `iterable` or `length` items (that are counted up). While iteration happens, this function will print a rendered progress bar to the given `file` (defaults to stdout... |
168,499 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | Clears the terminal screen. This will have the effect of clearing the whole visible space of the terminal and moving the cursor to the top left. This does not do anything if not connected to a terminal. .. versionadded:: 2.0 |
168,500 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | Removes ANSI styling information from a string. Usually it's not necessary to use this function as Click's echo function will automatically remove styling if necessary. .. versionadded:: 2.0 :param text: the text to remove style information from. |
168,501 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | This function combines :func:`echo` and :func:`style` into one call. As such the following two calls are the same:: click.secho('Hello World!', fg='green') click.echo(click.style('Hello World!', fg='green')) All keyword arguments are forwarded to the underlying functions depending on which one they go with. Non-string ... |
168,502 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | r"""Edits the given text in the defined editor. If an editor is given (should be the full path to the executable but the regular operating system search path is used for finding the executable) it overrides the detected editor. Optionally, some environment variables can be used. If the editor is closed without changes,... |
168,503 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | This function launches the given URL (or filename) in the default viewer application for this file type. If this is an executable, it might launch the executable in a new session. The return value is the exit code of the launched application. Usually, ``0`` indicates success. Examples:: click.launch('https://click.pall... |
168,504 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | null |
168,505 | import inspect
import io
import itertools
import os
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from ._compat import WIN
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types ... | This command stops execution and waits for the user to press any key to continue. This is similar to the Windows batch "pause" command. If the program is not run through a terminal, this command will instead do nothing. .. versionadded:: 2.0 .. versionadded:: 4.0 Added the `err` parameter. :param info: The message to p... |
168,506 | import re
import textwrap
constants = []
del constants, add_newdoc
def add_newdoc(module, name, doc):
constants.append((name, doc)) | null |
168,507 |
class Configuration:
_list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs',
'libraries', 'headers', 'scripts', 'py_modules',
'installed_libraries', 'define_macros']
_dict_keys = ['package_dir', 'installed_pkg_config']
_extra_keys = ['name', 'version']
... | null |
168,508 |
class Configuration:
_list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs',
'libraries', 'headers', 'scripts', 'py_modules',
'installed_libraries', 'define_macros']
_dict_keys = ['package_dir', 'installed_pkg_config']
_extra_keys = ['name', 'version']
... | null |
168,509 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
def _get_precision_dict() -> dict[str, str]:
names = [
("_NBitByte", np.byte),
("_NBitShort", np.short),
("_NBitIntC", np.intc),
("_NBitIntP",... | null |
168,510 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
def _get_extended_precision_list() -> list[str]:
extended_types = [np.ulonglong, np.longlong, np.longdouble, np.clongdouble]
extended_names = {
"uint128",
... | null |
168,511 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
def _get_c_intp_name() -> str:
# Adapted from `np.core._internal._getintp_ctype`
char = np.dtype('p').char
if char == 'i':
return "c_int"
elif char == 'l'... | null |
168,512 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
_PRECISION_DICT: Final = _get_precision_dict()
The provided code snippet includes necessary dependencies for implementing the `_hook` function. Write a Python function `def _hook... | Replace a type-alias with a concrete ``NBitBase`` subclass. |
168,513 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
if TYPE_CHECKING or MYPY_EX is None:
def _index(iterable: Iterable[Statement], id: str) -> int:
"""Identify the first ``ImportFrom`` instance the specified `id`."""
... | Override the first `module`-based import with new `imports`. |
168,514 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
if TYPE_CHECKING or MYPY_EX is None:
class _NumpyPlugin(Plugin):
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook... | An entry-point for mypy. |
168,515 | from __future__ import annotations
from collections.abc import Iterable
from typing import Final, TYPE_CHECKING, Callable
import numpy as np
if TYPE_CHECKING or MYPY_EX is None:
class _NumpyPlugin(Plugin):
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook... | An entry-point for mypy. |
168,516 | import json
version_json = '''
{
"date": "2023-02-05T11:25:52-0500",
"dirty": false,
"error": null,
"full-revisionid": "85f38ab180ece5290f64e8ddbd9cf06ad8fa4a5e",
"version": "1.24.2"
}
'''
def get_versions():
return json.loads(version_json) | null |
168,517 | from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration
from __version__ import version
class Configuration:
_list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs',
'libraries', 'headers', 'scripts', 'py_modules',
'installed_lib... | null |
168,518 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isexternal(var):
return 'attrspec' in var and 'external' in var['attrspec']
def _isstring(var):
return 'typespec' in var and var['typespec'] == 'character' and \
not isexternal(var) | null |
168,519 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isscalar(var):
def isinteger(var):
return isscalar(var) and var.get('typespec') == 'integer' | null |
168,520 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isscalar(var):
return not (isarray(var) or isstring(var) or isexternal(var))
def isreal(var):
return isscalar(var) and var.get('typespec') == 'real' | null |
168,521 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,522 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isscalar(var):
def get_kind(var):
def isunsigned_char(var):
if not isscalar(var):
return 0
if var.get('typespec') != 'integer':
return 0
return get_kind(var) == '-1' | null |
168,523 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isscalar(var):
def get_kind(var):
def isunsigned_short(var):
if not isscalar(var):
return 0
if var.get('typespec') != 'integer':
return 0
return get_kind(var) == '-2' | null |
168,524 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isscalar(var):
return not (isarray(var) or isstring(var) or isexternal(var))
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return ... | null |
168,525 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isscalar(var):
return not (isarray(var) or isstring(var) or isexternal(var))
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return ... | null |
168,526 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def iscomplex(var):
return isscalar(var) and \
var.get('typespec') in ['complex', 'double complex']
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
... | null |
168,527 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,528 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,529 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,530 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,531 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,532 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,533 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,534 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,535 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isarray(var):
return 'dimension' in var and not isexternal(var)
def get_kind(var):
try:
return var['kindselector']['*']
except KeyError:
try:
return var['kindsele... | null |
168,536 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isstring(var):
return isstring_or_stringarray(var) and not isarray(var)
def ismutable(var):
return not ('dimension' not in var or isstring(var)) | null |
168,537 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def islong_long(var):
if not isscalar(var):
return 0
if var.get('typespec') not in ['integer', 'logical']:
return 0
return get_kind(var) == '8'
def isfunction(rout):
return '... | null |
168,538 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def islong_double(var):
def isfunction(rout):
def islong_doublefunction(rout):
if not isfunction(rout):
return 0
if 'result' in rout:
a = rout['result']
else:
a = rout['... | null |
168,539 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def outmess(t):
if options.get('verbose', 1):
sys.stdout.write(t)
def iscomplexfunction(rout):
if not isfunction(rout):
return 0
if 'result' in rout:
a = rout['result']
... | null |
168,540 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def hasexternals(rout):
return 'externals' in rout and rout['externals'] | null |
168,541 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isthreadsafe(rout):
return 'f2pyenhancements' in rout and \
'threadsafe' in rout['f2pyenhancements'] | null |
168,542 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def hasvariables(rout):
return 'vars' in rout and rout['vars'] | null |
168,543 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isintent_cache(var):
return 'cache' in var.get('intent', []) | null |
168,544 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isintent_copy(var):
return 'copy' in var.get('intent', []) | null |
168,545 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isintent_overwrite(var):
return 'overwrite' in var.get('intent', []) | null |
168,546 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isintent_aligned4(var):
return 'aligned4' in var.get('intent', []) | null |
168,547 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isintent_aligned8(var):
return 'aligned8' in var.get('intent', []) | null |
168,548 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isintent_aligned16(var):
return 'aligned16' in var.get('intent', []) | null |
168,549 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def hasinitvalue(var):
return '=' in var
def hasinitvalueasstring(var):
if not hasinitvalue(var):
return 0
return var['='][0] in ['"', "'"] | null |
168,550 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def hascommon(rout):
return 'common' in rout
def hasbody(rout):
return 'body' in rout
def containscommon(rout):
if hascommon(rout):
return 1
if hasbody(rout):
for b in rout[... | null |
168,551 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def ismodule(rout):
return 'block' in rout and 'module' == rout['block']
def hasbody(rout):
return 'body' in rout
def containsmodule(block):
if ismodule(block):
return 1
if not hasb... | null |
168,552 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def istrue(var):
return 1 | null |
168,553 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isfalse(var):
return 0 | null |
168,554 | import pprint
import sys
import types
from functools import reduce
from . import __version__
from . import cfuncs
def isdummyroutine(rout):
try:
return rout['f2pyenhancements']['fortranname'] == ''
except KeyError:
return 0 | null |
168,555 | import sys
import os
import pprint
import re
from pathlib import Path
from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps
errmess = sys.stderr.write
outmess = auxfuncs.outmess
def s... | Equivalent to running:: f2py <args> where ``<args>=string.join(<list>,' ')``, but in Python. Unless ``-h`` is used, this function returns a dictionary containing information on generated modules and their dependencies on source files. You cannot build extension modules with this function, that is, using ``-c`` is not a... |
168,556 | import sys
import os
import pprint
import re
from pathlib import Path
from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps
def get_prefix(module):
p = os.path.dirname(os.path.di... | null |
168,557 | import sys
import os
import pprint
import re
from pathlib import Path
from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps
outmess = auxfuncs.outmess
def dict_append(d_out, d_in):
... | Do it all in one call! |
168,558 | from . import __version__
import copy
import re
import os
from .crackfortran import markoutercomma
from . import cb_rules
from .auxfuncs import *
c2capi_map = {'double': 'NPY_DOUBLE',
'float': 'NPY_FLOAT',
'long_double': 'NPY_DOUBLE', # forced casting
'char': 'NPY_STR... | null |
168,559 | import re
import warnings
from enum import Enum
from math import gcd
class ExprWarning(UserWarning):
pass
def ewarn(message):
warnings.warn(message, ExprWarning, stacklevel=2) | null |
168,560 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | Return object as ARRAY expression (array constant). |
168,561 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | Return object as TERNARY expression (cond?expr1:expr2). |
168,562 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | Return object as referencing expression. |
168,563 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | Return object as dereferencing expression. |
168,564 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | null |
168,565 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
class RelOp(Enum):
def fromstring(cls, s, language=Language.C):
def tostring(self, language=Language.C):
class Expr:
def parse(s, language=Language.C):
def __init__(self, op, data):
def __eq__(self, other):
... | null |
168,566 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | null |
168,567 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | null |
168,568 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | null |
168,569 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | null |
168,570 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | Return expression as TERMS expression. |
168,571 | import re
import warnings
from enum import Enum
from math import gcd
class Op(Enum):
"""
Used as Expr op attribute.
"""
INTEGER = 10
REAL = 12
COMPLEX = 15
STRING = 20
ARRAY = 30
SYMBOL = 40
TERNARY = 100
APPLY = 200
INDEXING = 210
CONCAT = 220
RELATIONAL = 300
... | Return expression as numer-denom pair. |
168,572 | import re
import warnings
from enum import Enum
from math import gcd
def _counter():
# Used internally to generate unique dummy symbols
counter = 0
while True:
counter += 1
yield counter | null |
168,573 | import re
import warnings
from enum import Enum
from math import gcd
COUNTER = _counter()
The provided code snippet includes necessary dependencies for implementing the `eliminate_quotes` function. Write a Python function `def eliminate_quotes(s)` to solve the following problem:
Replace quoted substrings of input stri... | Replace quoted substrings of input string. Return a new string and a mapping of replacements. |
168,574 | import re
import warnings
from enum import Enum
from math import gcd
The provided code snippet includes necessary dependencies for implementing the `insert_quotes` function. Write a Python function `def insert_quotes(s, d)` to solve the following problem:
Inverse of eliminate_quotes.
Here is the function:
def insert... | Inverse of eliminate_quotes. |
168,575 | import re
import warnings
from enum import Enum
from math import gcd
COUNTER = _counter()
The provided code snippet includes necessary dependencies for implementing the `replace_parenthesis` function. Write a Python function `def replace_parenthesis(s)` to solve the following problem:
Replace substrings of input that ... | Replace substrings of input that are enclosed in parenthesis. Return a new string and a mapping of replacements. |
168,576 | import re
import warnings
from enum import Enum
from math import gcd
def _get_parenthesis_kind(s):
assert s.startswith('@__f2py_PARENTHESIS_'), s
return s.split('_')[4]
The provided code snippet includes necessary dependencies for implementing the `unreplace_parenthesis` function. Write a Python function `def ... | Inverse of replace_parenthesis. |
168,577 | import re
import warnings
from enum import Enum
from math import gcd
class Language(Enum):
"""
Used as Expr.tostring language argument.
"""
Python = 0
Fortran = 1
C = 2
class Expr:
"""Represents a Fortran expression as a op-data pair.
Expr instances are hashable and sortable.
"""
... | Create an expression from a string. This is a "lazy" parser, that is, only arithmetic operations are resolved, non-arithmetic operations are treated as symbols. |
168,578 | import sys
import string
import fileinput
import re
import os
import copy
import platform
import codecs
from . import __version__
from .auxfuncs import *
from . import symbolic
def getextension(name):
i = name.rfind('.')
if i == -1:
return ''
if '\\' in name[i:]:
return ''
if '/' in nam... | null |
168,579 | import sys
import string
import fileinput
import re
import os
import copy
import platform
import codecs
from . import __version__
from .auxfuncs import *
from . import symbolic
_intentcallbackpattern = re.compile(r'intent\s*\(.*?\bcallback\b', re.I)
def _is_intent_callback(vdecl):
for a in vdecl.get('attrspec', []... | null |
168,580 | import sys
import string
import fileinput
import re
import os
import copy
import platform
import codecs
from . import __version__
from .auxfuncs import *
from . import symbolic
def getblockname(block, unknown='unknown'):
if 'name' in block:
return block['name']
return unknown | null |
168,581 | import sys
import string
import fileinput
import re
import os
import copy
import platform
import codecs
from . import __version__
from .auxfuncs import *
from . import symbolic
re._MAXCACHE = 50
for c in "abcdefghopqrstuvwxyz$_":
defaultimplicitrules[c] = {'typespec': 'real'}
for c in "ijklmn":
defaultimplicitr... | Obtain ``a`` and ``b`` when ``e == "a*x+b"``, where ``x`` is a symbol in xset. >>> getlincoef('2*x + 1', {'x'}) (2, 1, 'x') >>> getlincoef('3*x + x*2 + 2 + 1', {'x'}) (5, 3, 'x') >>> getlincoef('0', {'x'}) (0, 0, None) >>> getlincoef('0*x', {'x'}) (0, 0, 'x') >>> getlincoef('x*x', {'x'}) (None, None, None) This can be ... |
168,582 | import sys
import string
import fileinput
import re
import os
import copy
import platform
import codecs
from . import __version__
from .auxfuncs import *
from . import symbolic
def outmess(line, flag=1):
global filepositiontext
if not verbose:
return
if not quiet:
if flag:
sys.st... | Previously, Fortran character was incorrectly treated as character*1. This hook fixes the usage of the corresponding variables in `check`, `dimension`, `=`, and `callstatement` expressions. The usage of `char*` in `callprotoargument` expression can be left unchanged because C `character` is C typedef of `char`, althoug... |
168,583 | import os
import sys
import tempfile
def run_command(cmd):
print('Running %r:' % (cmd))
os.system(cmd)
print('------') | null |
168,584 | import os
import sys
import tempfile
def run():
_path = os.getcwd()
os.chdir(tempfile.gettempdir())
print('------')
print('os.name=%r' % (os.name))
print('------')
print('sys.platform=%r' % (sys.platform))
print('------')
print('sys.version:')
print(sys.version)
print('------')
... | null |
168,585 | import os
import sys
import sysconfig
class Configuration:
_list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs',
'libraries', 'headers', 'scripts', 'py_modules',
'installed_libraries', 'define_macros']
_dict_keys = ['package_dir', 'installed_pkg_config']
... | null |
168,586 | import functools
import operator
import warnings
from numpy.core import (
array, asarray, zeros, empty, empty_like, intc, single, double,
csingle, cdouble, inexact, complexfloating, newaxis, all, Inf, dot,
add, multiply, sqrt, sum, isfinite,
finfo, errstate, geterrobj, moveaxis, amin, amax, product, abs... | null |
168,587 | import functools
import operator
import warnings
from numpy.core import (
array, asarray, zeros, empty, empty_like, intc, single, double,
csingle, cdouble, inexact, complexfloating, newaxis, all, Inf, dot,
add, multiply, sqrt, sum, isfinite,
finfo, errstate, geterrobj, moveaxis, amin, amax, product, abs... | null |
168,588 | import functools
import operator
import warnings
from numpy.core import (
array, asarray, zeros, empty, empty_like, intc, single, double,
csingle, cdouble, inexact, complexfloating, newaxis, all, Inf, dot,
add, multiply, sqrt, sum, isfinite,
finfo, errstate, geterrobj, moveaxis, amin, amax, product, abs... | Solve the tensor equation ``a x = b`` for x. It is assumed that all indices of `x` are summed over in the product, together with the rightmost indices of `a`, as is done in, for example, ``tensordot(a, x, axes=x.ndim)``. Parameters ---------- a : array_like Coefficient tensor, of shape ``b.shape + Q``. `Q`, a tuple, eq... |
168,589 | import functools
import operator
import warnings
from numpy.core import (
array, asarray, zeros, empty, empty_like, intc, single, double,
csingle, cdouble, inexact, complexfloating, newaxis, all, Inf, dot,
add, multiply, sqrt, sum, isfinite,
finfo, errstate, geterrobj, moveaxis, amin, amax, product, abs... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.