id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
170,308 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
def is_string(... | null |
170,309 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
The provided ... | Return frame object from call stack with given level. |
170,310 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
def get_cmd(c... | null |
170,311 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
def is_bootst... | null |
170,312 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
class Configur... | Return a configuration dictionary for usage in configuration() function defined in file setup_<name>.py. |
170,313 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
def njoin(*pat... | null |
170,314 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
class system_... | Generate config.py file containing system_info information used during building the package. Usage: config['py_modules'].append((packagename, '__config__',generate_config_py)) |
170,315 | import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import importlib.util
from threading import local as tlocal
from functools import reduce
import distutils
from distutils.errors import DistutilsError
The provided ... | Return version major and minor of compiler instance if it is MSVC, raise an exception otherwise. |
170,316 | import re
import sys
import subprocess
py_ver = "%d%d" % tuple(sys.version_info[:2])
The provided code snippet includes necessary dependencies for implementing the `parse_cmd` function. Write a Python function `def parse_cmd()` to solve the following problem:
Parses the command-line arguments. libfile, deffile = parse... | Parses the command-line arguments. libfile, deffile = parse_cmd() |
170,317 | import os
import re
import sys
import shlex
import copy
from distutils.command import build_ext
from distutils.dep_util import newer_group, newer
from distutils.util import get_platform
from distutils.errors import DistutilsError, DistutilsSetupError
from numpy.distutils import log
from numpy.distutils.misc_util import... | Substitute any occurrence of @foo@ by d['foo'] from source file into target. |
170,318 | import os
import re
import sys
import shlex
import copy
from distutils.command import build_ext
from distutils.dep_util import newer_group, newer
from distutils.util import get_platform
from distutils.errors import DistutilsError, DistutilsSetupError
from numpy.distutils import log
from numpy.distutils.misc_util import... | null |
170,319 | import os
import re
import sys
import shlex
import copy
from distutils.command import build_ext
from distutils.dep_util import newer_group, newer
from distutils.util import get_platform
from distutils.errors import DistutilsError, DistutilsSetupError
from numpy.distutils import log
from numpy.distutils.misc_util import... | null |
170,320 | import os
import re
import sys
import shlex
import copy
from distutils.command import build_ext
from distutils.dep_util import newer_group, newer
from distutils.util import get_platform
from distutils.errors import DistutilsError, DistutilsSetupError
from numpy.distutils import log
from numpy.distutils.misc_util import... | null |
170,321 | from distutils.core import Command
from numpy.distutils import log
def show_fcompilers(dist=None):
"""Print list of available compilers (used by the "--help-fcompiler"
option to "config_fc").
"""
if dist is None:
from distutils.dist import Distribution
from numpy.distutils.command.confi... | null |
170,322 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_inline` function. Write a Python function `def check_inline(cmd)` to solve the following problem:
Return the inline identifier (may be empty).
Here is the function:
def check_inline(cmd):
"""Return the inline id... | Return the inline identifier (may be empty). |
170,323 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_restrict` function. Write a Python function `def check_restrict(cmd)` to solve the following problem:
Return the restrict identifier (may be empty).
Here is the function:
def check_restrict(cmd):
"""Return the r... | Return the restrict identifier (may be empty). |
170,324 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_compiler_gcc` function. Write a Python function `def check_compiler_gcc(cmd)` to solve the following problem:
Check if the compiler is GCC.
Here is the function:
def check_compiler_gcc(cmd):
"""Check if the comp... | Check if the compiler is GCC. |
170,325 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_gcc_version_at_least` function. Write a Python function `def check_gcc_version_at_least(cmd, major, minor=0, patchlevel=0)` to solve the following problem:
Check that the gcc version is at least the specified version.... | Check that the gcc version is at least the specified version. |
170,326 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_gcc_function_attribute` function. Write a Python function `def check_gcc_function_attribute(cmd, attribute, name)` to solve the following problem:
Return True if the given function attribute is supported.
Here is the... | Return True if the given function attribute is supported. |
170,327 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_gcc_function_attribute_with_intrinsics` function. Write a Python function `def check_gcc_function_attribute_with_intrinsics(cmd, attribute, name, code, include)` to solv... | Return True if the given function attribute is supported with intrinsics. |
170,328 | import textwrap
The provided code snippet includes necessary dependencies for implementing the `check_gcc_variable_attribute` function. Write a Python function `def check_gcc_variable_attribute(cmd, attribute)` to solve the following problem:
Return True if the given variable attribute is supported.
Here is the funct... | Return True if the given variable attribute is supported. |
170,329 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | null |
170,330 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | Return a list of library paths valid on 32 or 64 bit systems. Inputs: paths : sequence A sequence of strings (typically paths) bits : int An integer, the only valid values are 32 or 64. A ValueError exception is raised otherwise. Examples: Consider a list of directories >>> paths = ['/usr/X11R6/lib','/usr/X11/lib','/us... |
170,331 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | Add a package manager root to the include directories |
170,332 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | Returns a list of files named 'fname' from 1) System-wide directory (directory-location of this module) 2) Users HOME directory (os.environ['HOME']) 3) Local directory |
170,333 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | Parse an environment variable `env` by splitting with "," and only returning elements from `base_order` This method will sequence the environment variable and check for their individual elements in `base_order`. The items in the environment variable may be negated via '^item' or '!itema,itemb'. It must start with ^/! t... |
170,334 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | null |
170,335 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | Return a list of existing paths composed by all combinations of items from arguments. |
170,336 | import sys
import os
import re
import copy
import warnings
import subprocess
import textwrap
from glob import glob
from functools import reduce
from configparser import NoOptionError
from configparser import RawConfigParser as ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribut... | null |
170,337 | import os
import sys
import subprocess
import shlex
from distutils.errors import CompileError, DistutilsExecError, LibError
from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.ccompiler import replace_method
from numpy.distutils.misc_util import _commandline_dep_string
from numpy.distutils import log... | Compile a single source files with a Unix-style compiler. |
170,338 | import os
import sys
import subprocess
import shlex
from distutils.errors import CompileError, DistutilsExecError, LibError
from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.ccompiler import replace_method
from numpy.distutils.misc_util import _commandline_dep_string
from numpy.distutils import log... | Build a static library in a separate sub-process. Parameters ---------- objects : list or tuple of str List of paths to object files used to build the static library. output_libname : str The library name as an absolute or relative (if `output_dir` is used) path. output_dir : str, optional The path to the output direct... |
170,339 | import re
import os
import sys
import warnings
import platform
import tempfile
import hashlib
import base64
import subprocess
from subprocess import Popen, PIPE, STDOUT
from numpy.distutils.exec_command import filepath_from_subprocess_output
from numpy.distutils.fcompiler import FCompiler
from distutils.version import ... | null |
170,340 | import re
import os
import sys
import warnings
import platform
import tempfile
import hashlib
import base64
import subprocess
from subprocess import Popen, PIPE, STDOUT
from numpy.distutils.exec_command import filepath_from_subprocess_output
from numpy.distutils.fcompiler import FCompiler
from distutils.version import ... | Return true if the architecture supports the -arch flag |
170,341 | import sys
from numpy.distutils.ccompiler import simple_version_match
from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file
def simple_version_match(pat=r'[-.\d]+', ignore='', start=''):
def intel_version_match(type):
# Match against the important stuff in the version string
return simple_versio... | null |
170,342 | import os
from distutils.msvccompiler import MSVCCompiler as _MSVCCompiler
from .system_info import platform_bits
The provided code snippet includes necessary dependencies for implementing the `_merge` function. Write a Python function `def _merge(old, new)` to solve the following problem:
Concatenate two environment ... | Concatenate two environment paths avoiding repeats. Here `old` is the environment string before the base class initialize function is called and `new` is the string after the call. The new string will be a fixed string if it is not obtained from the current environment, or the same as the old string if obtained from th... |
170,343 | import os
import re
import sys
def dos2unix_one_dir(modified_files, dir_name, file_names):
for file in file_names:
full_path = os.path.join(dir_name, file)
file = dos2unix(full_path)
if file is not None:
modified_files.append(file)
def dos2unix_dir(dir_name):
modified_files ... | null |
170,344 | import os
import re
import sys
def unix2dos_one_dir(modified_files, dir_name, file_names):
for file in file_names:
full_path = os.path.join(dir_name, file)
unix2dos(full_path)
if file is not None:
modified_files.append(file)
def unix2dos_dir(dir_name):
modified_files = []
... | null |
170,345 | import os
import sys
import re
def process_str(astr):
code = [header]
code.extend(parse_string(astr, global_names, 0, 1))
return ''.join(code)
def resolve_includes(source):
d = os.path.dirname(source)
with open(source) as fid:
lines = []
for line in fid:
m = include_src_r... | null |
170,346 | import os
import sys
import re
def unique_key(adict):
# this obtains a unique key given a dictionary
# currently it works by appending together n of the letters of the
# current keys and increasing n until a unique key is found
# -- not particularly quick
allkeys = list(adict.keys())
done = F... | null |
170,347 | import os
import sys
import subprocess
import locale
import warnings
from numpy.distutils.misc_util import is_sequence, make_temp_file
from numpy.distutils import log
import warnings
warnings.warn("\n\n"
" `numpy.distutils` is deprecated since NumPy 1.23.0, as a result\n"
" of the deprecation of `distutil... | null |
170,348 | import os
import sys
import subprocess
import locale
import warnings
from numpy.distutils.misc_util import is_sequence, make_temp_file
from numpy.distutils import log
def get_pythonexe():
pythonexe = sys.executable
if os.name in ['nt', 'dos']:
fdir, fn = os.path.split(pythonexe)
fn = fn.upper()... | null |
170,349 | import os
import sys
import subprocess
import locale
import warnings
from numpy.distutils.misc_util import is_sequence, make_temp_file
from numpy.distutils import log
The provided code snippet includes necessary dependencies for implementing the `find_executable` function. Write a Python function `def find_executable(... | Return full path of a executable or None. Symbolic links are not followed. |
170,350 | import os
import sys
import subprocess
import locale
import warnings
from numpy.distutils.misc_util import is_sequence, make_temp_file
from numpy.distutils import log
def _preserve_environment( names ):
log.debug('_preserve_environment(%r)' % (names))
env = {name: os.environ.get(name) for name in names}
ret... | Return (status,output) of executed command. .. deprecated:: 1.17 Use subprocess.Popen instead Parameters ---------- command : str A concatenated string of executable and arguments. execute_in : str Before running command ``cd execute_in`` and after ``cd -``. use_shell : {bool, None}, optional If True, execute ``sh -c c... |
170,351 | import atexit
import inspect
import os
import pprint
import re
import subprocess
import textwrap
class CCompilerOpt(_Config, _Distutils, _Cache, _CCompiler, _Feature, _Parse):
"""
A helper class for `CCompiler` aims to provide extra build options
to effectively control of compiler optimizations that are dir... | Create a new instance of 'CCompilerOpt' and generate the dispatch header which contains the #definitions and headers of platform-specific instruction-sets for the enabled CPU baseline and dispatch-able features. Parameters ---------- compiler : CCompiler instance dispatch_hpath : str path of the dispatch header **kwarg... |
170,352 | import sys
import re
import os
from configparser import RawConfigParser
class FormatError(OSError):
"""
Exception thrown when there is a problem parsing a configuration file.
"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class VariableSet:
"""
... | null |
170,353 | import sys
import re
import os
from configparser import RawConfigParser
def parse_sections(config):
return meta_d, r | null |
170,354 | import os
from distutils.msvc9compiler import MSVCCompiler as _MSVCCompiler
from .system_info import platform_bits
The provided code snippet includes necessary dependencies for implementing the `_merge` function. Write a Python function `def _merge(old, new)` to solve the following problem:
Concatenate two environment... | Concatenate two environment paths avoiding repeats. Here `old` is the environment string before the base class initialize function is called and `new` is the string after the call. The new string will be a fixed string if it is not obtained from the current environment, or the same as the old string if obtained from th... |
170,355 | import os
import platform
import re
import sys
import types
import warnings
from subprocess import getstatusoutput
def getoutput(cmd, successful_status=(0,), stacklevel=1):
try:
status, output = getstatusoutput(cmd)
except OSError as e:
warnings.warn(str(e), UserWarning, stacklevel=stacklevel)
... | null |
170,356 | import os
import platform
import re
import sys
import types
import warnings
from subprocess import getstatusoutput
def command_by_line(cmd, successful_status=(0,), stacklevel=1):
ok, output = getoutput(cmd, successful_status=successful_status,
stacklevel=stacklevel+1)
if not ok:
... | null |
170,357 | import os
import platform
import sys
import subprocess
import re
import textwrap
import numpy.distutils.ccompiler
from numpy.distutils import log
import distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.msvccompiler import get_build_version as get_build_msvc_version
from distut... | Replacement for outdated version of get_msvcr from cygwinccompiler |
170,358 | import os
import platform
import sys
import subprocess
import re
import textwrap
import numpy.distutils.ccompiler
from numpy.distutils import log
import distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.msvccompiler import get_build_version as get_build_msvc_version
from distut... | null |
170,359 | import os
import platform
import sys
import subprocess
import re
import textwrap
import numpy.distutils.ccompiler
from numpy.distutils import log
import distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.msvccompiler import get_build_version as get_build_msvc_version
from distut... | null |
170,360 | import os
import platform
import sys
import subprocess
import re
import textwrap
import numpy.distutils.ccompiler
from numpy.distutils import log
import distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.msvccompiler import get_build_version as get_build_msvc_version
from distut... | Return the rc file used to generate the res file which will be embedded as manifest for given manifest file name, of given type ('dll' or 'exe'). Parameters ---------- name : str name of the manifest file to embed type : str {'dll', 'exe'} type of the binary which will embed the manifest |
170,361 | import os
import platform
import sys
import subprocess
import re
import textwrap
import numpy.distutils.ccompiler
from numpy.distutils import log
import distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.msvccompiler import get_build_version as get_build_msvc_version
from distut... | null |
170,362 | import os
import platform
import sys
import subprocess
import re
import textwrap
import numpy.distutils.ccompiler
from numpy.distutils import log
import distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.msvccompiler import get_build_version as get_build_msvc_version
from distut... | null |
170,363 | import sys
from distutils.log import *
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
def is_string(s):
return isinstance(s, str)
def is_sequence(seq):
if is_... | null |
170,364 | import os
import sys
def get_info(name):
g = globals()
return g.get(name, g.get(name + "_info", {})) | null |
170,365 | import os
import sys
The provided code snippet includes necessary dependencies for implementing the `show` function. Write a Python function `def show()` to solve the following problem:
Show libraries in the system on which NumPy was built. Print information about various resources (libraries, library directories, inc... | Show libraries in the system on which NumPy was built. Print information about various resources (libraries, library directories, include directories, etc.) in the system on which NumPy was built. See Also -------- get_include : Returns the directory containing NumPy C header files. Notes ----- 1. Classes specifying th... |
170,368 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `datetime_from_json` function. Write a Python function `def datetime_from_json(js, manager)` to solve the following problem:
Deserialize a Python datetime object from json.
Here is the funct... | Deserialize a Python datetime object from json. |
170,369 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `naive_to_json` function. Write a Python function `def naive_to_json(pydt, manager)` to solve the following problem:
Serialize a naive Python datetime object to json. Instantiating a JavaScri... | Serialize a naive Python datetime object to json. Instantiating a JavaScript Date object with a string assumes that the string is a UTC string, while instantiating it with constructor arguments assumes that it's in local time: >>> cdate = new Date('2015-05-12') Mon May 11 2015 20:00:00 GMT-0400 (Eastern Daylight Time) ... |
170,370 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `naive_from_json` function. Write a Python function `def naive_from_json(js, manager)` to solve the following problem:
Deserialize a naive Python datetime object from json.
Here is the funct... | Deserialize a naive Python datetime object from json. |
170,371 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `date_to_json` function. Write a Python function `def date_to_json(pydate, manager)` to solve the following problem:
Serialize a Python date object. Attributes of this dictionary are to be pa... | Serialize a Python date object. Attributes of this dictionary are to be passed to the JavaScript Date constructor. |
170,372 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `date_from_json` function. Write a Python function `def date_from_json(js, manager)` to solve the following problem:
Deserialize a Javascript date.
Here is the function:
def date_from_json(... | Deserialize a Javascript date. |
170,373 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `time_to_json` function. Write a Python function `def time_to_json(pyt, manager)` to solve the following problem:
Serialize a Python time object to json.
Here is the function:
def time_to_j... | Serialize a Python time object to json. |
170,374 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `time_from_json` function. Write a Python function `def time_from_json(js, manager)` to solve the following problem:
Deserialize a Python time object from json.
Here is the function:
def ti... | Deserialize a Python time object from json. |
170,375 | import re
import traitlets
import datetime as dt
The provided code snippet includes necessary dependencies for implementing the `datetime_from_json` function. Write a Python function `def datetime_from_json(js, manager)` to solve the following problem:
Deserialize a Python datetime object from json.
Here is the funct... | Deserialize a Python datetime object from json. |
170,376 | import re
import traitlets
import datetime as dt
def bytes_from_json(js, obj):
return None if js is None else js.tobytes() | null |
170,377 | from pathlib import Path
import sys
import inspect
import warnings
def _external_stacklevel(internal):
"""Find the stacklevel of the first frame that doesn't contain any of the given internal strings
The depth will be 1 at minimum in order to start checking at the caller of
the function that called this uti... | Generate a deprecation warning targeting the first frame that is not 'internal' internal is a string or list of strings, which if they appear in filenames in the frames, the frames will be considered internal. Changing this can be useful if, for examnple, we know that ipywidgets is calling out to traitlets internally. |
170,378 | from .widget import Widget, register, widget_serialization
from .widget_core import CoreWidget
from traitlets import Unicode, Tuple, Instance, TraitError
class Link(CoreWidget):
"""Link Widget
source: a (Widget, 'trait_name') tuple for the source trait
target: a (Widget, 'trait_name') tuple that should be u... | Link two widget attributes on the frontend so they remain in sync. The link is created in the front-end and does not rely on a roundtrip to the backend. Parameters ---------- source : a (Widget, 'trait_name') tuple for the first trait target : a (Widget, 'trait_name') tuple for the second trait Examples -------- >>> c ... |
170,379 | from .widget import Widget, register, widget_serialization
from .widget_core import CoreWidget
from traitlets import Unicode, Tuple, Instance, TraitError
class DirectionalLink(Link):
"""A directional link
source: a (Widget, 'trait_name') tuple for the source trait
target: a (Widget, 'trait_name') tuple that... | Link a source widget attribute with a target widget attribute. The link is created in the front-end and does not rely on a roundtrip to the backend. Parameters ---------- source : a (Widget, 'trait_name') tuple for the source trait target : a (Widget, 'trait_name') tuple for the target trait Examples -------- >>> c = d... |
170,380 | from .widget_description import DescriptionWidget, DescriptionStyle
from .valuewidget import ValueWidget
from .widget import register, widget_serialization
from .widget_core import CoreWidget
from traitlets import Instance
from .trait_types import Color, InstanceDict, NumberFormat
from traitlets import (
Unicode, C... | Add int docstring template to class init. |
170,381 | from .widget_description import DescriptionWidget, DescriptionStyle
from .valuewidget import ValueWidget
from .widget import register, widget_serialization
from .widget_core import CoreWidget
from traitlets import Instance
from .trait_types import Color, InstanceDict, NumberFormat
from traitlets import (
Unicode, C... | Add bounded int docstring template to class init. |
170,382 | from collections.abc import Iterable, Mapping
from inspect import signature, Parameter
from inspect import getcallargs
from inspect import getfullargspec as check_argspec
import sys
from IPython import get_ipython
from . import (Widget, ValueWidget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
VBox, Button... | Connect widget controls to a function. This function does not generate a user interface for the widgets (unlike `interact`). This enables customisation of the widget user interface layout. The user interface layout must be defined and displayed manually. |
170,383 | from collections.abc import Iterable, Mapping
from inspect import signature, Parameter
from inspect import getcallargs
from inspect import getfullargspec as check_argspec
import sys
from IPython import get_ipython
from . import (Widget, ValueWidget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
VBox, Button... | Match a pattern of types in a sequence. |
170,384 | from collections.abc import Iterable, Mapping
from inspect import signature, Parameter
from inspect import getcallargs
from inspect import getfullargspec as check_argspec
import sys
from IPython import get_ipython
from . import (Widget, ValueWidget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
VBox, Button... | Return min, max, value given input values with possible None. |
170,385 | from collections.abc import Iterable, Mapping
from inspect import signature, Parameter
from inspect import getcallargs
from inspect import getfullargspec as check_argspec
import sys
from IPython import get_ipython
from . import (Widget, ValueWidget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
VBox, Button... | Get an abbreviation for a function parameter. |
170,386 |
The provided code snippet includes necessary dependencies for implementing the `doc_subst` function. Write a Python function `def doc_subst(snippets)` to solve the following problem:
Substitute format strings in class or function docstring
Here is the function:
def doc_subst(snippets):
""" Substitute format str... | Substitute format strings in class or function docstring |
170,387 | from collections.abc import Iterable, Mapping
from itertools import chain
from .widget_description import DescriptionWidget, DescriptionStyle
from .valuewidget import ValueWidget
from .widget_core import CoreWidget
from .widget_style import Style
from .trait_types import InstanceDict, TypedTuple
from .widget import reg... | Exhaust any non-mapping iterable into a tuple |
170,388 | from collections.abc import Iterable, Mapping
from itertools import chain
from .widget_description import DescriptionWidget, DescriptionStyle
from .valuewidget import ValueWidget
from .widget_core import CoreWidget
from .widget_style import Style
from .trait_types import InstanceDict, TypedTuple
from .widget import reg... | Standardize the options tuple format. The returned tuple should be in the format (('label', value), ('label', value), ...). The input can be * an iterable of (label, value) pairs * an iterable of values, and labels will be generated * a Mapping between labels and values |
170,389 | from collections.abc import Iterable, Mapping
from itertools import chain
from .widget_description import DescriptionWidget, DescriptionStyle
from .valuewidget import ValueWidget
from .widget_core import CoreWidget
from .widget_style import Style
from .trait_types import InstanceDict, TypedTuple
from .widget import reg... | A function that uses the compare function to return a value from the list. |
170,390 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | Return True if the given environment variable is turned on, otherwise False If the environment variable is set, True will be returned if it is assigned to a value other than 'no', 'n', 'false', 'off', '0', or '0.0' (case insensitive). If the environment variable is not set, the default value is returned. |
170,391 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | null |
170,392 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | null |
170,393 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | The inverse of _remove_buffers, except here we modify the existing dict/lists. Modifying should be fine, since this is used when state comes from the wire. |
170,394 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | Return (state_without_buffers, buffer_paths, buffers) for binary message parts A binary message part is a memoryview, bytearray, or python 3 bytes object. As an example: >>> state = {'plain': [0, 'text'], 'x': {'ar': memoryview(ar1)}, 'y': {'shape': (10,10), 'data': memoryview(ar2)}} >>> _remove_buffers(state) ({'plain... |
170,395 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | Compare two lists of buffers for equality. Used to decide whether two sequences of buffers (memoryviews, bytearrays, or python 3 bytes) differ, such that a sync is needed. Returns True if equal, False if unequal |
170,396 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | decorator for showing tracebacks |
170,397 | import os
import typing
from contextlib import contextmanager
from collections.abc import Iterable
from IPython import get_ipython
from traitlets import (
Any, HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Undefined)
from json import loads as jsonloads, dumps as jsondum... | A decorator registering a widget class in the widget registry. |
170,398 | from .widget_box import Box
from .widget import register
from .widget_core import CoreWidget
from traitlets import Unicode, Dict, CInt, TraitError, validate, observe
from .trait_types import TypedTuple
from itertools import chain, repeat, islice
def repeat(object: _T) -> Iterator[_T]: ...
def repeat(object: _T, times:... | Returns the sequence elements and then returns None up to the given size (or indefinitely if size is None). |
170,399 | import datetime as dt
from traitlets import (
observe, default, Unicode, Dict, Int, Bool, Bytes, CaselessStrEnum
)
from .widget_description import DescriptionWidget
from .valuewidget import ValueWidget
from .widget_core import CoreWidget
from .widget_button import ButtonStyle
from .widget import register, widget_se... | null |
170,400 | import datetime as dt
from traitlets import (
observe, default, Unicode, Dict, Int, Bool, Bytes, CaselessStrEnum
)
from .widget_description import DescriptionWidget
from .valuewidget import ValueWidget
from .widget_core import CoreWidget
from .widget_button import ButtonStyle
from .widget import register, widget_se... | null |
170,401 | import json
import re
from .widgets import Widget, DOMWidget, widget as widget_module
from .widgets.widget_link import Link
from .widgets.docutils import doc_subst
from ._version import __html_manager_version__
def _get_recursive_state(widget, store=None, drop_defaults=False):
"""Gets the embed state of a widget, a... | Get the state of all widgets specified, and their dependencies. This uses a simple dependency finder, including: - any widget directly referenced in the state of an included widget - any widget in a list/tuple attribute in the state of an included widget - any widget in a dict attribute in the state of an included widg... |
170,402 | import json
import re
from .widgets import Widget, DOMWidget, widget as widget_module
from .widgets.widget_link import Link
from .widgets.docutils import doc_subst
from ._version import __html_manager_version__
html_template = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{title}</tit... | Write a minimal HTML file with widget views embedded. Parameters ---------- fp: filename or file-like object The file to write the HTML output to. {views_attribute} title: title of the html page. template: Template in which to embed the widget state. This should be a Python string with placeholders `{{title}}` and `{{s... |
170,403 | from colorsys import rgb_to_hls
from pygments.styles import get_style_by_name
from pygments.token import Token
def dark_color(color):
"""Check whether a color is 'dark'.
Currently, this is simply whether the luminance is <50%"""
rgb = hex_to_rgb(color)
if rgb:
return rgb_to_hls(*rgb)[1] < 128
... | Guess whether the background of the style with name 'stylename' counts as 'dark'. |
170,404 | from colorsys import rgb_to_hls
from pygments.styles import get_style_by_name
from pygments.token import Token
default_light_style_template = default_template + '''\
.in-prompt { color: navy; }
.out-prompt { color: darkred; }
'''
default_dark_style_template = default_template + '''\
.in-prompt,
.in-prom... | Use one of the base templates, and set bg/fg/select colors. |
170,405 | from functools import partial
import os
import os.path
import re
import sys
from textwrap import dedent
import time
from unicodedata import category
import webbrowser
from qtpy import QT6
from qtpy import QtCore, QtGui, QtPrintSupport, QtWidgets
from qtconsole.rich_text import HtmlExporter
from qtconsole.util import Me... | Returns whether the specified unicode character is a letter or a number. |
170,406 | from functools import partial
import os
import os.path
import re
import sys
from textwrap import dedent
import time
from unicodedata import category
import webbrowser
from qtpy import QT6
from qtpy import QtCore, QtGui, QtPrintSupport, QtWidgets
from qtconsole.rich_text import HtmlExporter
from qtconsole.util import Me... | Check whether a given char counts as white space. |
170,407 |
The provided code snippet includes necessary dependencies for implementing the `qstring_length` function. Write a Python function `def qstring_length(text)` to solve the following problem:
Tries to compute what the length of an utf16-encoded QString would be.
Here is the function:
def qstring_length(text):
"""
... | Tries to compute what the length of an utf16-encoded QString would be. |
170,408 | import inspect
from qtpy import QtCore, QtGui
from traitlets import HasTraits, TraitType
The provided code snippet includes necessary dependencies for implementing the `superQ` function. Write a Python function `def superQ(QClass)` to solve the following problem:
Permits the use of super() in class hierarchies that co... | Permits the use of super() in class hierarchies that contain Qt classes. Unlike QObject, SuperQObject does not accept a QObject parent. If it did, super could not be emulated properly (all other classes in the heierarchy would have to accept the parent argument--they don't, of course, because they don't inherit QObject... |
170,409 | import inspect
from qtpy import QtCore, QtGui
from traitlets import HasTraits, TraitType
The provided code snippet includes necessary dependencies for implementing the `get_font` function. Write a Python function `def get_font(family, fallback=None)` to solve the following problem:
Return a font of the requested famil... | Return a font of the requested family, using fallback as alternative. If a fallback is provided, it is used in case the requested family isn't found. If no fallback is given, no alternative is chosen and Qt's internal algorithms may automatically choose a fallback font. Parameters ---------- family : str A font name. f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.