id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
178,530
import sys import types as Types import warnings import weakref as Weakref from inspect import isbuiltin, isclass, iscode, isframe, isfunction, ismethod, ismodule from math import log from os import curdir, linesep from struct import calcsize t = hasattr(sys, "gettotalrefcount") del t from gc import get_objects as _get...
Return the combined size (in bytes) of all objects passed as positional arguments. The available options and defaults are: *above=0* -- threshold for largest objects stats *align=8* -- size alignment *clip=80* -- clip ``repr()`` strings *code=False* -- incl. (byte)code size *cutoff=10* -- limit large objects or profile...
178,531
import sys import types as Types import warnings import weakref as Weakref from inspect import isbuiltin, isclass, iscode, isframe, isfunction, ismethod, ismodule from math import log from os import curdir, linesep from struct import calcsize t = hasattr(sys, "gettotalrefcount") del t from gc import get_objects as _get...
Return a tuple containing the size (in bytes) of all objects passed as positional arguments. The available options and defaults are: *above=1024* -- threshold for largest objects stats *align=8* -- size alignment *clip=80* -- clip ``repr()`` strings *code=False* -- incl. (byte)code size *cutoff=10* -- limit large objec...
178,532
import sys import types as Types import warnings import weakref as Weakref from inspect import isbuiltin, isclass, iscode, isframe, isfunction, ismethod, ismodule from math import log from os import curdir, linesep from struct import calcsize t = hasattr(sys, "gettotalrefcount") del t from gc import get_objects as _get...
Return the basic size of an object (in bytes). The available options and defaults are: *derive=False* -- derive type from super type *infer=False* -- try to infer types *save=False* -- save the object's type definition if new See this module documentation for the definition of *basic size*.
178,533
import sys import types as Types import warnings import weakref as Weakref from inspect import isbuiltin, isclass, iscode, isframe, isfunction, ismethod, ismodule from math import log from os import curdir, linesep from struct import calcsize t = hasattr(sys, "gettotalrefcount") del t from gc import get_objects as _get...
Return the flat size of an object (in bytes), optionally aligned to the given power-of-2. See function **basicsize** for a description of other available options. See this module documentation for the definition of *flat size*.
178,534
import sys import types as Types import warnings import weakref as Weakref from inspect import isbuiltin, isclass, iscode, isframe, isfunction, ismethod, ismodule from math import log from os import curdir, linesep from struct import calcsize from gc import get_objects as _getobjects from gc import get_referents as _ge...
Return all named **referents** of an object (re-using functionality from **asizeof**). Does not return un-named *referents*, e.g. objects in a list. See function **basicsize** for a description of the available options.
178,535
from __future__ import annotations import time from enum import Enum from typing import TYPE_CHECKING, Any, NamedTuple from langchain.callbacks.base import ( # type: ignore[import-not-found, unused-ignore] BaseCallbackHandler, ) from langchain.schema import ( # type: ignore[import-not-found, unused-ignore] Ag...
Convert newline characters to markdown newline sequences (space, space, newline).
178,536
from __future__ import annotations import inspect import os from types import FrameType from streamlit.components.types.base_component_registry import BaseComponentRegistry from streamlit.components.v1.custom_component import CustomComponent from streamlit.runtime import get_instance def _get_module_name(caller_frame: ...
Create and register a custom component. Parameters ---------- name: str A short, descriptive name for the component. Like, "slider". path: str or None The path to serve the component's frontend files from. Either `path` or `url` must be specified, but not both. url: str or None The URL that the component is served from...
178,537
from __future__ import annotations from typing import TYPE_CHECKING, Any from streamlit import type_util from streamlit.elements.lib import pandas_styler_utils from streamlit.proto.Components_pb2 import ArrowTable as ArrowTableProto def _marshall_index(proto: ArrowTableProto, index: Index) -> None: """Marshall pand...
Marshall data into an ArrowTable proto. Parameters ---------- proto : proto.ArrowTable Output. The protobuf for a Streamlit ArrowTable proto. data : pandas.DataFrame, pandas.Styler, numpy.ndarray, Iterable, dict, or None Something that is or can be converted to a dataframe.
178,538
from __future__ import annotations from typing import TYPE_CHECKING, Any from streamlit import type_util from streamlit.elements.lib import pandas_styler_utils from streamlit.proto.Components_pb2 import ArrowTable as ArrowTableProto The provided code snippet includes necessary dependencies for implementing the `arrow_...
Convert ArrowTable proto to pandas.DataFrame. Parameters ---------- proto : proto.ArrowTable Output. pandas.DataFrame
178,539
from __future__ import annotations import logging import sys from typing import Final _loggers: dict[str, logging.Logger] = {} _global_log_level = logging.INFO def get_logger(name: str) -> logging.Logger: """Return a logger. Parameters ---------- name : str The name of the logger to use. You sho...
Set log level.
178,540
from __future__ import annotations import logging import sys from typing import Final _loggers: dict[str, logging.Logger] = {} def setup_formatter(logger: logging.Logger) -> None: """Set up the console formatter for a given logger.""" # Deregister any previous console loggers. if hasattr(logger, "streamlit_...
null
178,541
from __future__ import annotations import logging import sys from typing import Final def get_logger(name: str) -> logging.Logger: """Return a logger. Parameters ---------- name : str The name of the logger to use. You should just pass in __name__. Returns ------- Logger """ ...
Set Tornado log levels. This function does not import any Tornado code, so it's safe to call even when Server is not running.
178,542
from __future__ import annotations import contextlib import errno import io import os from pathlib import Path from streamlit import env_util, util from streamlit.string_util import is_binary_string def is_binary_string(inp: bytes) -> bool: """Guess if an input bytesarray can be encoded as a string.""" # From ...
Coerce bytes to a BytesIO or a StringIO. Parameters ---------- data : bytes encoding : str Returns ------- BytesIO or StringIO If the file's data is in a well-known textual format (or if the encoding parameter is set), return a StringIO. Otherwise, return BytesIO.
178,543
from __future__ import annotations import contextlib import errno import io import os from pathlib import Path from streamlit import env_util, util from streamlit.string_util import is_binary_string The provided code snippet includes necessary dependencies for implementing the `get_static_dir` function. Write a Python...
Get the folder where static HTML/JS/CSS files live.
178,544
from __future__ import annotations import contextlib import errno import io import os from pathlib import Path from streamlit import env_util, util from streamlit.string_util import is_binary_string CONFIG_FOLDER_NAME = ".streamlit" The provided code snippet includes necessary dependencies for implementing the `get_pr...
Return the full path to a filepath in ${CWD}/.streamlit. This doesn't guarantee that the file (or its directory) exists.
178,545
from __future__ import annotations import contextlib import errno import io import os from pathlib import Path from streamlit import env_util, util from streamlit.string_util import is_binary_string def file_is_in_folder_glob(filepath: str, folderpath_glob: str) -> bool: """Test whether a file is in some folder wit...
Test whether a filepath is in the same folder of a path specified in the PYTHONPATH env variable. Parameters ---------- filepath : str An absolute file path. Returns ------- boolean True if contained in PYTHONPATH, False otherwise. False if PYTHONPATH is not defined or empty.
178,546
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
null
178,547
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if the type is considered bytes-like for the purposes of protobuf data marshalling.
178,548
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input is a SymPy expression.
178,549
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input looks like an Altair chart.
178,550
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input looks like a pillow image.
178,551
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input looks like a Keras model.
178,552
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input looks like an OpenAI chat completion chunk.
178,553
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input looks like a Plotly chart.
178,554
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
Return True if x is a function.
178,555
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
null
178,556
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
True if input looks like a pydeck chart.
178,557
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
Try to ensure a value is an indexable Sequence. If the collection already is one, it has the index method that we need. Otherwise, convert it to a list.
178,558
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
Check if the sequence elements support "python comparison". That means that the equality operator (==) returns a boolean value. Which is not True for e.g. numpy arrays and pandas series.
178,559
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
Return True if the current Pandas version is less than the input version. Parameters ---------- v : str Version string, e.g. "0.25.0" Returns ------- bool
178,560
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
Determine the data format of the input data. Parameters ---------- input_data : Any The input data to determine the data format of. Returns ------- DataFormat The data format of the input data.
178,561
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
Convert a dataframe to the specified data format. Parameters ---------- df : pd.DataFrame The dataframe to convert. data_format : DataFormat The data format to convert to. Returns ------- pd.DataFrame, pd.Series, pyarrow.Table, np.ndarray, list, set, tuple, or dict. The converted dataframe.
178,562
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
null
178,563
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
null
178,564
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
null
178,565
from __future__ import annotations import contextlib import copy import math import re import types from enum import Enum, EnumMeta, auto from typing import ( TYPE_CHECKING, Any, Final, Iterable, Literal, NamedTuple, Protocol, Sequence, Tuple, TypeVar, Union, cast, ge...
null
178,566
import streamlit as st st.expander("Empty expander") with st.expander("Expander with number input", expanded=True): # We deliberately use a list to implement this for the screenshot st.write("* Example list item") value = st.number_input("number", value=1.0, key="number") st.text(st.session_state.number) if...
null
178,568
import streamlit as st from streamlit import runtime st.write("value 1:", v1) st.write("value 2:", v2) st.write("value 3:", v3) st.write("value 4:", v4) st.write("value 5:", v5) st.write("value 6:", v6) st.write("value 7:", v7) st.write("value 8:", v8) st.write("value 10:", v10) st.write("value 11:", v11) def on_chang...
null
178,569
import pandas as pd import streamlit as st from streamlit import runtime st.write("value 1:", v1) st.write("value 2:", v2) st.write("value 3:", v3) st.write("value 4:", v4) st.write("value 5:", v5) st.write("value 6:", v6) st.write("value 7:", v7) st.write("value 8:", v8) st.write("value 9:", v9) st.write("value 10:", ...
null
178,570
import random import numpy as np import pandas as pd import streamlit as st def highlight_first(value): return "background-color: yellow" if value == 0 else ""
null
178,571
import random import numpy as np import pandas as pd import streamlit as st def style_negative(v, props=""): return props if v < 0 else None
null
178,572
import random import numpy as np import pandas as pd import streamlit as st np.random.seed(0) def highlight_max(s, props=""): return np.where(s == np.nanmax(s.values), props, "")
null
178,573
import random import numpy as np import pandas as pd import streamlit as st def rain_condition(v): if v < 1.75: return "Dry" elif v < 2.75: return "Rain" return "Heavy Rain" def make_pretty(styler): styler.set_caption("Weather Conditions") styler.format(rain_condition) styler.ba...
null
178,574
import time import numpy as np import pandas as pd import streamlit as st np.random.seed(0) _LOREM_IPSUM = """ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex...
null
178,575
import asyncio import contextlib def context_mgr(): try: yield finally: pass
null
178,576
import asyncio import contextlib def func(value): value
null
178,577
import asyncio import contextlib async def async_func(value): value
null
178,578
import asyncio import contextlib async def async_for(): async def async_iter(): yield async for _ in async_iter(): "ASYNC FOR"
null
178,579
import asyncio import contextlib async def async_with(): @contextlib.asynccontextmanager async def async_context_mgr(): try: yield finally: pass async with async_context_mgr(): "ASYNC WITH"
null
178,580
import asyncio import contextlib The provided code snippet includes necessary dependencies for implementing the `docstrings` function. Write a Python function `def docstrings()` to solve the following problem: Docstring. Should not be printed. Here is the function: def docstrings(): """Docstring. Should not be p...
Docstring. Should not be printed.
178,581
import asyncio import contextlib The provided code snippet includes necessary dependencies for implementing the `my_func` function. Write a Python function `def my_func()` to solve the following problem: my_func: this help block should be printed. Here is the function: def my_func(): """my_func: this help block ...
my_func: this help block should be printed.
178,582
import streamlit as st from streamlit import runtime st.write("toggle 1 - value:", i1) st.write("toggle 2 - value:", i2) st.write("toggle 3 - value:", i3) st.write("toggle 5 - value:", i5) st.write("toggle 6 - value:", i6) st.write("toggle 7 - value:", i7) st.write("toggle 8 - value:", i8) def on_change(): st....
null
178,583
import streamlit as st from streamlit import runtime st.write("checkbox 1 - value:", i1) st.write("checkbox 2 - value:", i2) st.write("checkbox 3 - value:", i3) st.write("checkbox 5 - value:", i5) st.write("checkbox 6 - value:", i6) st.write("checkbox 7 - value:", i7) st.write("checkbox 8 - value:", i8) def on_change(...
null
178,584
import streamlit as st from streamlit import runtime st.write("number input 1 (default) - value: ", v1) st.write("number input 2 (value=1) - value: ", v2) st.write("number input 3 (min & max) - value: ", v3) st.write("number input 4 (step=2) - value: ", v4) st.write("number input 5 (max=10) - value: ", v5) st.write("nu...
null
178,585
import io from collections import namedtuple from dataclasses import dataclass from datetime import datetime import altair as alt import graphviz import matplotlib.pyplot as plt import numpy as np import pandas as pd import plotly.express as px import pydeck as pdk from PIL import Image import streamlit as st def stre...
null
178,586
from datetime import date, datetime import streamlit as st from streamlit import runtime st.write("Value 1:", v1) st.write("Value 2:", v2) st.write("Value 3:", v3) st.write("Value 4:", v4) st.write("Value 5:", v5) st.write("Value 6:", v6) st.write("Value 7:", v7) st.write("Value 8:", v8) st.write("Value 9:", v9) st.wri...
null
178,587
import pandas as pd import streamlit as st from streamlit import runtime st.write("value 1:", v1) st.write("value 2:", v2) st.write("value 3:", v3) st.write("value 4:", v4) st.write("value 5:", v5) st.write("value 6:", v6) st.write("value 7:", v7) st.write("value 9:", v9) st.write("value 10:", v10) st.write("value 11:"...
null
178,588
import streamlit as st from streamlit import runtime st.write("value 1:", v1) st.write("value 2:", v2) st.write("value 3:", v3) st.write("value 4:", v4) st.write("value 5:", v5) st.write("value 6:", v6) st.write("value 7:", v7) st.write("value 8:", v8) st.write("value 10:", v10) st.write("value 11:", v11) def on_chang...
null
178,589
import streamlit as st from streamlit import runtime st.write("Chat input 1 (inline) - value:", v1) st.write("Chat input 2 (in column, disabled) - value:", v2) st.write("Chat input 4 (bottom, max_chars) - value:", v4) def on_submit(): st.text("chat input submitted")
null
178,590
from typing import Any, List import streamlit as st from streamlit import runtime from tests.streamlit import pyspark_mocks st.text(f"value 1: {i1}") st.text(f"value 2: {i2}") st.text(f"value 3: {i3}") st.text(f"value 4: {i4}") st.text(f"value 5: {i5}") st.text(f"value 6: {i6}") st.text(f"value 7: {i7}") st.text(f"valu...
null
178,591
from typing import Any, List import streamlit as st from streamlit import runtime from tests.streamlit import pyspark_mocks st.text(f"value 1: {i1}") st.text(f"value 2: {i2}") st.text(f"value 3: {i3}") st.text(f"value 4: {i4}") st.text(f"value 5: {i5}") st.text(f"value 6: {i6}") st.text(f"value 7: {i7}") st.text(f"valu...
null
178,592
import streamlit as st def on_click_4(): def on_click_5(): on_click_4()
null
178,593
import streamlit as st st.subheader("Control Panel", divider="blue") if "tabs" not in st.session_state: st.session_state["tabs"] = ["Tab 1", "Tab 2"] if "add_tab" not in st.session_state: st.session_state["add_tab"] = False if "remove_1" not in st.session_state: st.session_state["remove_1"] = False if "remo...
null
178,594
import streamlit as st from streamlit import runtime st.write("value 2:", i3) st.write("value 3:", i4) st.write("value 4:", i5) st.button("button 5 (container_width)", use_container_width=True) st.button( "button 6 (container_width + help)", use_container_width=True, help="help text" ) st.button("_button 7_ (**styl...
null
178,595
from datetime import datetime, time import streamlit as st from streamlit import runtime st.write("Value 1:", v1) st.write("Value 2:", v2) st.write("Value 3:", v3) st.write("Value 4:", v4) st.write("Value 5:", v5) st.write("Value 7:", v7) st.write("Value 8:", v8) if "time_input_9" not in st.session_state: st.sessio...
null
178,597
import fileinput import os import re import sys import packaging.version import semver The provided code snippet includes necessary dependencies for implementing the `verify_pep440` function. Write a Python function `def verify_pep440(version)` to solve the following problem: Verify if version is PEP440 compliant. htt...
Verify if version is PEP440 compliant. https://github.com/pypa/packaging/blob/16.7/packaging/version.py#L191 We might need pre, post, alpha, rc in the future so might as well use an object that does all that. This verifies its a valid version.
178,598
import fileinput import os import re import sys import packaging.version import semver The provided code snippet includes necessary dependencies for implementing the `verify_semver` function. Write a Python function `def verify_semver(version)` to solve the following problem: Verify if version is compliant with semant...
Verify if version is compliant with semantic versioning. https://semver.org/
178,599
import fileinput import os import re import sys import packaging.version import semver BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) The provided code snippet includes necessary dependencies for implementing the `update_files` function. Write a Python function `def update_files(data, versio...
Update files with new version number.
178,600
from datetime import datetime import packaging.version import pytz import streamlit.version The provided code snippet includes necessary dependencies for implementing the `create_tag` function. Write a Python function `def create_tag()` to solve the following problem: Create tag with updated version, a suffix and date...
Create tag with updated version, a suffix and date.
178,601
import subprocess import sys import textwrap from pathlib import Path from typing import List, Tuple def display_usage(): prog = Path(__file__).name print( textwrap.dedent( f"""\ usage: {prog} [-h] SUBDIRECTORY ARGS [ARGS ...] Runs the program in a subdirectory and fix paths in argum...
null
178,602
import subprocess import sys import textwrap from pathlib import Path from typing import List, Tuple def is_relative_to(path: Path, *other): def fix_arg(subdirectory: str, arg: str) -> str: arg_path = Path(arg) if not (arg_path.exists() and is_relative_to(arg_path, subdirectory)): return arg return...
null
178,603
import subprocess import sys import textwrap from pathlib import Path from typing import List, Tuple def try_as_shell(fixed_args: List[str], subdirectory: str): # Windows doesn't know how to run "yarn" using the CreateProcess # WINAPI because it's looking for an executable, and yarn is a node script. # Yar...
null
178,604
import requests def check_for_release_pr(pull): label = pull["head"]["label"] if label.find("release/") != -1: return pull["head"]["ref"] The provided code snippet includes necessary dependencies for implementing the `get_release_branch` function. Write a Python function `def get_release_branch()` to s...
Retrieve the release branch from the release PR
178,605
import fileinput import os import re import sys from typing import Dict BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) The provided code snippet includes necessary dependencies for implementing the `update_files` function. Write a Python function `def update_files(project_name: str, files: D...
Update files with new project name.
178,606
import os import sys import requests The provided code snippet includes necessary dependencies for implementing the `send_notification` function. Write a Python function `def send_notification()` to solve the following problem: Create a slack message Here is the function: def send_notification(): """Create a sla...
Create a slack message
178,607
import os import click auto_run = False The provided code snippet includes necessary dependencies for implementing the `run_commands` function. Write a Python function `def run_commands(section_header, commands, skip_last_input=False, comment=None)` to solve the following problem: Run a list of commands, displaying th...
Run a list of commands, displaying them within the given section.
178,608
import json import subprocess import sys from pathlib import Path from typing import NoReturn, Set, Tuple, cast from typing_extensions import TypeAlias PackageInfo: TypeAlias = Tuple[str, str, str, str, str, str] ACCEPTABLE_LICENSES = { "MIT", # https://opensource.org/licenses/MIT "Apache-2.0", # https://open...
null
178,609
import os import requests The provided code snippet includes necessary dependencies for implementing the `create_release` function. Write a Python function `def create_release()` to solve the following problem: Create a release from the Git Tag Here is the function: def create_release(): """Create a release from...
Create a release from the Git Tag
178,610
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Validate the 'filter' parameter. This is near the top of most public methods. :param filter dict: :rtype: None
178,611
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Validate the 'update' parameter. This is near the top of the public update methods. :param update dict: :rtype: None
178,612
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Validate the 'doc' parameter. This is near the top of the public insert / replace methods. :param doc dict: :rtype: None
178,613
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Given an entire doc, return whether that doc matches every filter item in the slow_filters dict. A slow_filter is just the set of filters that we didn't have an index for. :param doc dict: :param slow_filters dict: :rtype: bool
178,614
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Given an $update_op, a {doc_key: value} update_op_dict, and a doc, Update the doc in-place at doc_key with the update operation. e.g. doc = {'hi': 'ma'} update_op = '$set' update_op_dict {'ma': 'pa'} -> {'hi': 'pa'} :param update_op str: :param update_op_dict {str: value}: :param doc dict: :rtype: None
178,615
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Update an idx_doc given documents which were just inserted / modified / etc :param documents list[dict]: :param idx_doc {key_str: str, direction: int idx: SortedDict, ...}: :rtype: None
178,616
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Given the sort list provided in the .sort() method, sort the documents in place. from https://docs.python.org/3/howto/sorting.html :param docs list[dict]: :param sort_list list[(key, direction)] :rtype: None
178,617
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Split the filter into indx_ops and slow_filters which are later used differently :param filter {doc_key: query_ops}: :param metadata dict: :rtype: {doc_key: query_ops}, [(SortedDict idx, dict query_ops), ...]
178,618
import collections import copy import datetime import functools import re import bson import sortedcontainers from .cursor import Cursor, _validate_sort from .common import support_alert, ASCENDING, DESCENDING, MetaStorageObject from .errors import (MongitaError, MongitaNotImplementedError, DuplicateKeyError, ...
Return all doc_ids that can be found through the index filters :param indx_ops {idx_key: query_ops}: :param indexes dict: :rtype: set
178,619
from .errors import MongitaNotImplementedError, MongitaError, InvalidOperation from .common import ASCENDING, DESCENDING, support_alert class MongitaError(Exception): pass ASCENDING = 1 DESCENDING = -1 The provided code snippet includes necessary dependencies for implementing the `_validate_sort` function. Write...
Validate kwargs and return a proper sort list :param key_or_list str|[(str key, int direction), ...] :param direction int: :rtype: [(str key, int direction), ...]
178,620
import pymongo from . import mongita_client def _resolve_client(connection_type, uri): """ :param str connection_type: :param str uri: :rtype: mongita.MongitaClientDisk|pymongo.MongoClient """ assert connection_type in ('mongita', 'mongodb') if connection_type == 'mongita': if uri: ...
Sync a list of collections from the source to the destination. Source/destination can be either 'mongita' or 'mongodb' Collections can be formatted as either 'db.coll' or plain 'db' :param str source_type: mongita|mongodb :param str destination_type: mongita|mongodb :param list[str]|str collections: :param bool force: ...
178,621
import functools import os import re import unicodedata import bson import sortedcontainers from .errors import MongitaError _windows_device_files = ('CON', 'AUX', 'COM1', 'COM2', 'COM3', 'COM4', 'LPT1', 'LPT2', 'LPT3', 'PRN', 'NUL') _filename_ascii_strip_re = re.compile(r'[^A-Za-z0-9_.-]') Th...
The idea of this is to ensure that the document_id doesn't do sketchy shit on the filesystem. This will probably be deleted soon.
178,622
import functools import os import re import unicodedata import bson import sortedcontainers from .errors import MongitaError _invalid_names = re.compile(r'[/\. "$*<>:|?]') The provided code snippet includes necessary dependencies for implementing the `ok_name` function. Write a Python function `def ok_name(name)` to s...
In-line with MongoDB restrictions. https://docs.mongodb.com/manual/reference/limits/#std-label-restrictions-on-db-names https://docs.mongodb.com/manual/reference/limits/#Restriction-on-Collection-Names The prohibition on "system." names will be covered by the prohibition on '.'
178,623
import functools import os import re import unicodedata import bson import sortedcontainers from .errors import MongitaError class MongitaError(Exception): pass The provided code snippet includes necessary dependencies for implementing the `support_alert` function. Write a Python function `def support_alert(func)...
Provide smart tips if the user tries to use un-implemented / deprecated known kwargs.
178,624
import argparse import os import shutil import sys import time from functools import partial import deepspeed import numpy as np import torch import tqdm import transformers from peft import LoraConfig, get_peft_model from torch.utils.tensorboard import SummaryWriter from model.LISA import LISAForCausalLM from model.ll...
null
178,625
import argparse import os import shutil import sys import time from functools import partial import deepspeed import numpy as np import torch import tqdm import transformers from peft import LoraConfig, get_peft_model from torch.utils.tensorboard import SummaryWriter from model.LISA import LISAForCausalLM from model.ll...
Main training loop.
178,626
import argparse import os import shutil import sys import time from functools import partial import deepspeed import numpy as np import torch import tqdm import transformers from peft import LoraConfig, get_peft_model from torch.utils.tensorboard import SummaryWriter from model.LISA import LISAForCausalLM from model.ll...
null
178,627
import argparse import os import sys import cv2 import numpy as np import torch import torch.nn.functional as F from transformers import AutoTokenizer, BitsAndBytesConfig, CLIPImageProcessor from model.LISA import LISAForCausalLM from model.llava import conversation as conversation_lib from model.llava.mm_utils import ...
null
178,628
import argparse import os import sys import cv2 import numpy as np import torch import torch.nn.functional as F from transformers import AutoTokenizer, BitsAndBytesConfig, CLIPImageProcessor from model.LISA import LISAForCausalLM from model.llava import conversation as conversation_lib from model.llava.mm_utils import ...
Normalize pixel values and pad to a square input.
178,629
import argparse import glob import os import sys import cv2 import numpy as np import torch import torch.nn.functional as F import transformers from peft import LoraConfig, get_peft_model from transformers import AutoTokenizer from model.LISA import LISAForCausalLM from utils.utils import DEFAULT_IM_END_TOKEN, DEFAULT_...
null
178,630
import argparse import os import re import sys import bleach import cv2 import gradio as gr import numpy as np import torch import torch.nn.functional as F from PIL import Image from transformers import AutoTokenizer, BitsAndBytesConfig, CLIPImageProcessor from model.LISA import LISAForCausalLM from model.llava import ...
null
178,631
import argparse import os import re import sys import bleach import cv2 import gradio as gr import numpy as np import torch import torch.nn.functional as F from PIL import Image from transformers import AutoTokenizer, BitsAndBytesConfig, CLIPImageProcessor from model.LISA import LISAForCausalLM from model.llava import ...
null