id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
166,812 | from __future__ import annotations
import inspect
from collections import defaultdict
from collections.abc import Callable, Mapping
from functools import wraps
from typing import (
Any,
ParamSpec,
TypeVar,
get_args,
get_origin,
get_type_hints,
overload,
)
from warnings import warn
from pathw... | Changes the type of the column from Optional[T] to T. If there is any None in the column this operation will raise an exception. Example: >>> import pathway as pw >>> t1 = pw.debug.table_from_markdown(''' ... colA | colB ... 1 | 5 ... 2 | 9 ... 3 | None ... 4 | 15''') >>> t1.schema <pathway.Schema types={'colA': <class... |
166,813 | from __future__ import annotations
import inspect
from collections import defaultdict
from collections.abc import Callable, Mapping
from functools import wraps
from typing import (
Any,
ParamSpec,
TypeVar,
get_args,
get_origin,
get_type_hints,
overload,
)
from warnings import warn
from pathw... | null |
166,814 | from __future__ import annotations
import inspect
from collections import defaultdict
from collections.abc import Callable, Mapping
from functools import wraps
from typing import (
Any,
ParamSpec,
TypeVar,
get_args,
get_origin,
get_type_hints,
overload,
)
from warnings import warn
from pathw... | null |
166,815 | from __future__ import annotations
import inspect
from collections import defaultdict
from collections.abc import Callable, Mapping
from functools import wraps
from typing import (
Any,
ParamSpec,
TypeVar,
get_args,
get_origin,
get_type_hints,
overload,
)
from warnings import warn
from pathw... | Marks a function that performs operations on Tables. As a consequence, arguments and return value, which are annotated to have type pw.Table[S] are checked whether they indeed have schema S. Args: allow_superset: if True, the columns of the table can be a superset of columns in schema. Can be given either as a bool, an... |
166,816 | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Callable, Iterable
from dataclasses import dataclass
from functools import cached_property
from itertools import chain
from types import EllipsisType
from typing import TYPE_CHECKING, Any, ClassVar
import pathway.internal... | null |
166,817 | from __future__ import annotations
from abc import ABC, abstractmethod
from functools import cached_property, lru_cache
from typing import TYPE_CHECKING, Any
import pathway
import pathway.internals.row_transformer_table as tt
from pathway.internals import dtype as dt, operator as op, parse_graph, schema
from pathway.in... | null |
166,818 | from __future__ import annotations
import itertools
from collections.abc import Iterator
from functools import lru_cache
from typing import TYPE_CHECKING, Any, cast
from pathway.internals.trace import trace_user_frame
from abc import abstractmethod
import pathway.internals.column as clmn
import pathway.internals.expres... | Join self with other using the given join expression. Args: left: the left side of the join, ``Table`` or ``JoinResult``. right: the right side of the join, ``Table`` or ``JoinResult``. on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: ColumnR... |
166,819 | from __future__ import annotations
import itertools
from collections.abc import Iterator
from functools import lru_cache
from typing import TYPE_CHECKING, Any, cast
from pathway.internals.trace import trace_user_frame
from abc import abstractmethod
import pathway.internals.column as clmn
import pathway.internals.expres... | Inner-joins two tables or join results. Args: left: the left side of the join, ``Table`` or ``JoinResult``. right: the right side of the join, ``Table`` or ``JoinResult``. on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: ColumnReference. id: ... |
166,820 | from __future__ import annotations
import itertools
from collections.abc import Iterator
from functools import lru_cache
from typing import TYPE_CHECKING, Any, cast
from pathway.internals.trace import trace_user_frame
from abc import abstractmethod
import pathway.internals.column as clmn
import pathway.internals.expres... | Left-joins two tables or join results. Args: self: the left side of the join, ``Table`` or ``JoinResult``. other: the right side of the join, ``Table`` or ``JoinResult``. *on: Columns to join, syntax `self.col1 == other.col2` id: optional id column of the result left_instance/right_instance: optional arguments describi... |
166,821 | from __future__ import annotations
import itertools
from collections.abc import Iterator
from functools import lru_cache
from typing import TYPE_CHECKING, Any, cast
from pathway.internals.trace import trace_user_frame
from abc import abstractmethod
import pathway.internals.column as clmn
import pathway.internals.expres... | Outer-joins two tables or join results. Args: self: the left side of the join, ``Table`` or ``JoinResult``. other: the right side of the join, ``Table`` or ``JoinResult``. *on: Columns to join, syntax `self.col1 == other.col2` id: optional id column of the result left_instance/right_instance: optional arguments describ... |
166,822 | from __future__ import annotations
import itertools
from collections.abc import Iterator
from functools import lru_cache
from typing import TYPE_CHECKING, Any, cast
from pathway.internals.trace import trace_user_frame
from abc import abstractmethod
import pathway.internals.column as clmn
import pathway.internals.expres... | Outer-joins two tables or join results. Args: self: the left side of the join, ``Table`` or ``JoinResult``. other: the right side of the join, ``Table`` or ``JoinResult``. *on: Columns to join, syntax `self.col1 == other.col2` id: optional id column of the result instance: optional argument describing partitioning of t... |
166,823 | from __future__ import annotations
import collections
import datetime
import typing
from abc import ABC, abstractmethod
from enum import Enum
from functools import cached_property
from types import EllipsisType, NoneType, UnionType
import numpy as np
import numpy.typing as npt
import pandas as pd
from pathway.engine im... | Unpacks type out of typing.Optional and matches a second type with it if it is an EmptyType. |
166,824 | from __future__ import annotations
from typing import Any, TypeVar, overload
from pathway.internals import (
datasink as datasinks,
datasource as datasources,
operator as operators,
parse_graph as parse_graphs,
schema as schemas,
table as tables,
)
def table_from_datasource(
datasource: data... | null |
166,825 | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
import pandas as pd
from pathway.internals import api
from pathway.internals.schema import Schema, schema_from_pandas
class StaticDataSource(DataSource, AB... | null |
166,826 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
def _timedelta_to_rust(td: timedelta) -> int:
"""Returns duration in ns"""
return (td // MICROSECOND) * 1000
The provided code snippet includes necessary dependencies f... | Returns (timestamp [ns], is_timezone_aware) |
166,827 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
The provided code snippet includes necessary dependencies for implementing the `_pd_timestamp_to_rust` function. Write a Python function `def _pd_timestamp_to_rust(ts: pd.Times... | Returns (timestamp [ns], is_timezone_aware) |
166,828 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
The provided code snippet includes necessary dependencies for implementing the `_pd_timedelta_to_rust` function. Write a Python function `def _pd_timedelta_to_rust(td: pd.Timed... | Returns duration in ns |
166,829 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
The provided code snippet includes necessary dependencies for implementing the `_pd_timestamp_from_naive_ns` function. Write a Python function `def _pd_timestamp_from_naive_ns(... | Accepts timestamp in ns |
166,830 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
The provided code snippet includes necessary dependencies for implementing the `_pd_timestamp_from_utc_ns` function. Write a Python function `def _pd_timestamp_from_utc_ns(time... | Accepts timestamp in ns |
166,831 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
The provided code snippet includes necessary dependencies for implementing the `_pd_timedelta_from_ns` function. Write a Python function `def _pd_timedelta_from_ns(duration: in... | Accepts duration in ns |
166,832 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
import json as _json
The provided code snippet includes necessary dependencies for implementing the `_parse_to_json` function. Write a Python function `def _parse_to_json(valu... | Parse string to value wrapped in pw.Json |
166,833 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
import json as _json
The provided code snippet includes necessary dependencies for implementing the `_value_to_json` function. Write a Python function `def _value_to_json(valu... | Returns value wrapped in pw.Json |
166,834 | from datetime import datetime, timedelta
from typing import Any
import pandas as pd
from dateutil import tz
from pathway.internals import json
import json as _json
The provided code snippet includes necessary dependencies for implementing the `_json_dumps` function. Write a Python function `def _json_dumps(obj: Any) ... | Serialize obj as a JSON formatted string. |
166,835 | from __future__ import annotations
from typing import Any, Protocol
from pathway.internals import datasink
from pathway.internals.api import Pointer
from pathway.internals.table_io import table_to_datasink
class OnFinishCallback(Protocol):
"""
The callback function to be called when the stream of changes ends. ... | Calls a callback function on_change on every change happening in table. This method is similar to the one we expose to the user but provides more parameters for internal usage. Args: table: the table to subscribe. skip_persisted_batch: whether the output for fully-persisted data should be ignored in case the program re... |
166,836 | from __future__ import annotations
from collections.abc import Callable, MutableMapping, Sequence
from typing import Any
def as_arg_tuple(obj) -> ArgTuple:
if isinstance(obj, ArgTuple):
return obj
elif isinstance(obj, MutableMapping):
return MappingArgTuple(obj)
elif isinstance(obj, Sequence... | null |
166,837 | import dataclasses
import warnings
from typing import Any
import pathway.internals as pw
from pathway.internals import api, dtype as dt
from pathway.internals._io_helpers import _form_value_fields
from pathway.internals.api import ConnectorMode, PathwayType, ReadMethod
from pathway.internals.schema import ColumnDefinit... | null |
166,838 | import dataclasses
import warnings
from typing import Any
import pathway.internals as pw
from pathway.internals import api, dtype as dt
from pathway.internals._io_helpers import _form_value_fields
from pathway.internals.api import ConnectorMode, PathwayType, ReadMethod
from pathway.internals.schema import ColumnDefinit... | null |
166,839 | import dataclasses
import warnings
from typing import Any
import pathway.internals as pw
from pathway.internals import api, dtype as dt
from pathway.internals._io_helpers import _form_value_fields
from pathway.internals.api import ConnectorMode, PathwayType, ReadMethod
from pathway.internals.schema import ColumnDefinit... | null |
166,840 | from __future__ import annotations
from pathway.internals.table_subscription import (
OnChangeCallback,
OnFinishCallback,
OnTimeEndCallback,
subscribe as internal_subscribe,
)
class OnFinishCallback(Protocol):
"""
The callback function to be called when the stream of changes ends. It will be ca... | Calls a callback function on_change on every change happening in table. Args: table: the table to subscribe. on_change: the callback to be called on every change in the table. The function is required to accept four parameters: the key, the row changed, the time of the change in microseconds and the flag stating if the... |
166,841 | import asyncio
import copy
import json
import logging
import threading
import time
from collections import OrderedDict
from collections.abc import Awaitable, Callable
from typing import Any, Sequence
from uuid import uuid4
from warnings import warn
import aiohttp_cors
import yaml
from aiohttp import web
import pathway.... | Get request scheme taking into account the forwarded headers. |
166,842 | import asyncio
import copy
import json
import logging
import threading
import time
from collections import OrderedDict
from collections.abc import Awaitable, Callable
from typing import Any, Sequence
from uuid import uuid4
from warnings import warn
import aiohttp_cors
import yaml
from aiohttp import web
import pathway.... | Runs a lightweight HTTP server and inputs a collection from the HTTP endpoint, configured by the parameters of this method. On the output, the method provides a table and a callable, which needs to accept the result table of the computation, which entries will be tracked and put into respective request's responses. Arg... |
166,843 | import json
import random
import time
from typing import Any
import requests
import pathway as pw
def unescape(message: str, row: dict[str, Any], time: int, is_addition: bool):
message = message.replace("{table.time}", str(time))
message = message.replace("{table.diff}", "1" if is_addition else "-1")
for k,... | null |
166,844 | from __future__ import annotations
import json
import subprocess
import sys
from importlib.abc import MetaPathFinder
from importlib.util import spec_from_file_location
from os import environ
from pathlib import Path
PROFILE_ENV_VAR = "PATHWAY_PROFILE"
QUIET_ENV_VAR = "PATHWAY_QUIET"
FEATURES_ENV_VAR = "PATHWAY_FEATURES... | null |
166,845 | from warnings import warn
from pathway.internals import udfs
def __getattr__(name):
warn(
"pathway.asynchronous module is deprecated. Its content has been moved to pathway.udfs.",
DeprecationWarning,
stacklevel=2,
)
try:
return getattr(udfs, name)
except AttributeError:
... | null |
166,846 | import ast
import os
import time
import uuid
from collections import deque
from log import logger
from openai_server.backend_utils import convert_messages_to_structure
def decode(x, encoding_name="cl100k_base"):
try:
import tiktoken
encoding = tiktoken.get_encoding(encoding_name)
return enc... | null |
166,847 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,848 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | Health check. |
166,849 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,850 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,851 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,852 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,853 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,854 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,855 | import contextlib
import logging
import os
import sys
import ast
import json
from threading import Thread
import time
from traceback import print_exception
from typing import List, Dict
from pydantic import BaseModel, Field
import uvicorn
from fastapi import Depends, FastAPI, Header, HTTPException
from fastapi.middlewa... | null |
166,856 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,857 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | pytest create_data.py::test_scrape_dai_docs_all |
166,858 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | pytest -s -v create_data.py::test_scrape_dai_docs_all_pandoc :return: |
166,859 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | Needs to run from Driverless AI source directory. E.g. (base) jon@gpu:~/h2oai$ pytest -s -v /data/jon/h2ogpt/create_data.py::test_config_to_json ; cp config.json /data/jon/h2ogpt/ :return: |
166,860 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,861 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,862 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,863 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,864 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,865 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,866 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,867 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,868 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | https://huggingface.co/datasets/wikihow/blob/main/wikihow.py https://github.com/mahnazkoupaee/WikiHow-Dataset https://ucsb.box.com/s/ap23l8gafpezf4tq3wapr6u8241zz358 https://ucsb.app.box.com/s/ap23l8gafpezf4tq3wapr6u8241zz358 |
166,869 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,870 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,871 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,872 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,873 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,874 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | Flatten tree structure into one row per path from root to leaf Also turn into human_bot prompting format: <human>: question\n<bot>: answer <human>: question2\n<bot>: answer2 Etc. Also saves a .json locally as side-effect returns list of dicts, containing intput, prompt_type and source |
166,875 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,876 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,877 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,878 | import ast
import concurrent.futures
import contextlib
import hashlib
import json
import os
import shutil
import signal
import sys
import traceback
from concurrent.futures import ProcessPoolExecutor
import psutil
import pytest
import pandas as pd
import numpy as np
from tqdm import tqdm
from utils import flatten_list, ... | null |
166,879 | import ast
import asyncio
import copy
import functools
import glob
import gzip
import inspect
import json
import os
import pathlib
import pickle
import re
import shutil
import subprocess
import tempfile
import time
import traceback
import types
import typing
import urllib.error
import uuid
import zipfile
import tarfile... | null |
166,880 | import ast
import asyncio
import copy
import functools
import glob
import gzip
import inspect
import json
import os
import pathlib
import pickle
import re
import shutil
import subprocess
import tempfile
import time
import traceback
import types
import typing
import urllib.error
import uuid
import zipfile
import tarfile... | null |
166,881 | import ast
import asyncio
import copy
import functools
import glob
import gzip
import inspect
import json
import os
import pathlib
import pickle
import re
import shutil
import subprocess
import tempfile
import time
import traceback
import types
import typing
import urllib.error
import uuid
import zipfile
import tarfile... | do prep first time, involving downloads # FIXME: Add github caching then add here :return: |
166,882 | import ast
import asyncio
import copy
import functools
import glob
import gzip
import inspect
import json
import os
import pathlib
import pickle
import re
import shutil
import subprocess
import tempfile
import time
import traceback
import types
import typing
import urllib.error
import uuid
import zipfile
import tarfile... | null |
166,883 |
def noop_load(*args, **kwargs):
return None | null |
166,884 | import copy
import torch
from evaluate_params import eval_func_param_names, input_args_list
from gen import evaluate, check_locals
from prompter import non_hf_types
from utils import clear_torch_cache, NullContext, get_kwargs
input_args_list = ['model_state', 'my_db_state', 'selection_docs_state', 'requests_state', 'r... | null |
166,885 | from typing import List, Union, Any, Tuple, Optional
import requests
import torch
from langchain.docstore.document import Document
from langchain.document_loaders import ImageCaptionLoader
import numpy as np
from utils import get_device, clear_torch_cache, NullContext
from doctr.utils.common_types import AbstractFile
... | From left top to right bottom Params: boxes: [[x1, y1, x2, y2], [x1, y1, x2, y2], ...] |
166,886 | from typing import List, Union, Any, Tuple, Optional
import requests
import torch
from langchain.docstore.document import Document
from langchain.document_loaders import ImageCaptionLoader
import numpy as np
from utils import get_device, clear_torch_cache, NullContext
from doctr.utils.common_types import AbstractFile
... | Params: box1: [x1, y1, x2, y2] box2: [x1, y1, x2, y2] |
166,887 | from typing import List, Union, Any, Tuple, Optional
import requests
import torch
from langchain.docstore.document import Document
from langchain.document_loaders import ImageCaptionLoader
import numpy as np
from utils import get_device, clear_torch_cache, NullContext
from doctr.utils.common_types import AbstractFile
... | Params: box1: [x1, y1, x2, y2] box2: [x1, y1, x2, y2] |
166,888 | from typing import List, Union, Any, Tuple, Optional
import requests
import torch
from langchain.docstore.document import Document
from langchain.document_loaders import ImageCaptionLoader
import numpy as np
from utils import get_device, clear_torch_cache, NullContext
from doctr.utils.common_types import AbstractFile
... | null |
166,889 | from typing import List, Union, Any, Tuple, Optional
import requests
import torch
from langchain.docstore.document import Document
from langchain.document_loaders import ImageCaptionLoader
import numpy as np
from utils import get_device, clear_torch_cache, NullContext
from doctr.utils.common_types import AbstractFile
... | Read a PDF file and convert it into an image in numpy format >>> from doctr.documents import read_pdf >>> doc = read_pdf("path/to/your/doc.pdf") Args: file: the path to the PDF file scale: rendering scale (1 corresponds to 72dpi) rgb_mode: if True, the output will be RGB, otherwise BGR password: a password to unlock th... |
166,890 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | Sets the seed of the entire notebook so results are the same every time we run. This is for REPRODUCIBILITY. |
166,891 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,892 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,893 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,894 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,895 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,896 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,897 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,898 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | Faster deepcopy, can only work on things that are picklable. Naive Deepcopy is more general. Same method as for class Individual :param object: :return: |
166,899 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,900 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,901 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,902 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,903 | import ast
import contextlib
import functools
import gc
import getpass
import hashlib
import inspect
import json
import os
import pathlib
import pickle
import platform
import random
import shutil
import subprocess
import sys
import threading
import time
import traceback
import zipfile
import tarfile
from concurrent.fut... | null |
166,904 | import os
from functools import wraps
import psutil
def get_all_rlimit(pid=None):
if pid is None:
pid = os.getpid()
ps = psfunc(psutil.Process, pid)
result = {}
for rlim_str, rlim in zip(rlims_str, rlims):
if rlims is None:
continue
result[(rlim_str, rlim)] = rlimitpr... | null |
166,905 | import os
from functools import wraps
import psutil
def rlimitproc(pp, rlim):
try:
return pp.rlimit(rlim)
except (psutil.NoSuchProcess, psutil.AccessDenied, FileNotFoundError, OSError, TypeError, AttributeError):
pass
except ValueError as e:
if 'invalid resource specified' in str(e):... | null |
166,906 | import os
from functools import wraps
import psutil
def psfunc(func, *args, **kwargs):
"""
Safely ask for psutil function call
psutil accesses /proc entries that can random disappear, and psutil does not have sufficient protection
for user against various errors either direct or a cascade within the pac... | Decorate a function that uses psutil in case of ignorable exception |
166,907 | import os
from functools import wraps
import psutil
def psfunc(func, *args, **kwargs):
"""
Safely ask for psutil function call
psutil accesses /proc entries that can random disappear, and psutil does not have sufficient protection
for user against various errors either direct or a cascade within the pac... | null |
166,908 | import os
from functools import wraps
import psutil
The provided code snippet includes necessary dependencies for implementing the `psattr` function. Write a Python function `def psattr(obj, attr)` to solve the following problem:
Safely ask for an attributes value for psutil psutil accesses /proc entries that can rand... | Safely ask for an attributes value for psutil psutil accesses /proc entries that can random disappear, and psutil does not have sufficient protection for user against various errors either direct or a cascade within the package. :param obj: psutil object with attributes :param attr: attribute name to get :return: attri... |
166,909 | import os
from functools import wraps
import psutil
def rlimitproc(pp, rlim):
try:
return pp.rlimit(rlim)
except (psutil.NoSuchProcess, psutil.AccessDenied, FileNotFoundError, OSError, TypeError, AttributeError):
pass
except ValueError as e:
if 'invalid resource specified' in str(e):... | null |
166,910 | import sys
import os
import traceback
def protect_stream(stream_name):
if stream_name == "stdout":
sys.stdout = FinalizeStream(StreamProxy(sys.stdout))
elif stream_name == "stderr":
sys.stderr = FinalizeStream(StreamProxy(sys.stderr))
else:
raise ValueError("Unsupported stream name. ... | null |
166,911 | import textwrap
import re
from src.utils import flatten_list, have_emoji, have_langid
def setup_nltk():
import nltk # we'll use this to split into sentences
nltk.download("punkt") | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.