repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_parse_range | assert | func_call | 372 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | RangeTuple(after=start_date.timestamp(), before=end_date.timestamp(), within=None) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | tests_misc/tweets.py | test_tweet | assert | func_call | 43 | from my.tests.common import skip_if_not_karlicoss as pytestmark
from datetime import datetime, timezone
import json
def test_tweet() -> None:
from my.twitter.archive import Tweet
raw = """
{
"retweeted" : false,
"entities" : {
"hashtags" : [ ],
"symbols" : [ ],
"user_mentions" : [ ],
"url... | datetime(year=2012, month=8, day=30, hour=7, minute=12, second=48, tzinfo=timezone.utc) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/compat.py | test_fromisoformat | assert | func_call | 24 | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from datetime import datetime
def test_fromisoformat() -> None:
from datetime import timezone
# fmt: off
# feedbin has this format
assert fromisoformat('2020-05-01T10:32:02.925961Z') == datetime(
2020, 5, 1, 10, 3... | datetime( 2020, 11, 30, 0, 53, 12, 0, timezone.utc, ) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/compat.py | test_fromisoformat | assert | func_call | 14 | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from datetime import datetime
def test_fromisoformat() -> None:
from datetime import timezone
# fmt: off
# feedbin has this format
assert fromisoformat('2020-05-01T10:32:02.925961Z') == | datetime( 2020, 5, 1, 10, 32, 2, 925961, timezone.utc, ) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/compat.py | test_fromisoformat | assert | func_call | 19 | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from datetime import datetime
def test_fromisoformat() -> None:
from datetime import timezone
# fmt: off
# feedbin has this format
assert fromisoformat('2020-05-01T10:32:02.925961Z') == datetime(
2020, 5, 1, 10, 3... | datetime( 2018, 11, 28, 22, 4, 1, 304000, timezone.utc, ) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/pandas.py | test_as_dataframe | assert_* | func_call | 158 | from __future__ import annotations
import dataclasses
from collections.abc import Iterable, Iterator
from datetime import datetime, timezone
from pprint import pformat
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
TypeVar,
)
from decorator import decorator
from . import warnings
fro... | pd.DataFrame(data={ 'value': ['test', np.nan ], 'error': [np.nan, 'RuntimeError: i failed\n'], 'dt' : [np.nan, np.nan ], }).astype(dtype={'dt': 'float'})) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/pandas.py | test_as_dataframe | assert_* | func_call | 129 | from __future__ import annotations
import dataclasses
from collections.abc import Iterable, Iterator
from datetime import datetime, timezone
from pprint import pformat
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
TypeVar,
)
from decorator import decorator
from . import warnings
fro... | pd.DataFrame({ 'i' : [0 , 1 , 2 , 3 , 4 ], 's' : ['str0', 'str1', 'str2', 'str3', 'str4'], # NOTE: error column is always added 'error': [None , None , None , None , None ], })) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/core_config.py | test_active_modules | assert | bool_literal | 35 | from __future__ import annotations
import re
from collections.abc import Sequence
from dataclasses import dataclass
from pathlib import Path
from . import warnings
_HPI_CACHE_DIR_DEFAULT = ''
def _reset_config() -> Iterator[Config]:
# todo maybe have this decorator for the whole of my.config?
from .cfg impo... | True | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_range_predicate | assert | bool_literal | 376 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | True | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_range_predicate | assert | bool_literal | 377 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | False | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/discovery_pure.py | test_pure | assert | collection | 180 | from __future__ import annotations
REQUIRES = 'REQUIRES'
NOT_HPI_MODULE_VAR = '__NOT_HPI_MODULE__'
import ast
import logging
import os
import re
from collections.abc import Iterable, Sequence
from pathlib import Path
from typing import Any, NamedTuple, Optional, cast
Requires = Optional[Sequence[str]]
def ignored(m... | [] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/error.py | test_sort_res_by | assert | collection | 144 | from __future__ import annotations
import traceback
from collections.abc import Iterable, Iterator
from datetime import datetime
from itertools import tee
from typing import (
Any,
Callable,
Literal,
TypeVar,
Union,
cast,
)
from .types import Json
T = TypeVar('T')
E = TypeVar('E', bound=Excep... | [] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/pandas.py | test_check_dateish | assert | collection | 51 | from __future__ import annotations
import dataclasses
from collections.abc import Iterable, Iterator
from datetime import datetime, timezone
from pprint import pformat
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
TypeVar,
)
from decorator import decorator
from . import warnings
fro... | [] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/stats.py | test_stat | assert | collection | 106 | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
Any,
Ca... | {} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_get_files.py | test_no_files | assert | collection | 36 | import os
import shutil
import tempfile
import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from ..common import get_files
from kompress import CPath, ZipPath
def _get_files(x, *args, **kwargs):
from ..common import get_files as get_files_orig
def repl(x):
if isin... | () | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/utils/itertools.py | test_warn_if_empty_iterator | assert | collection | 104 | from __future__ import annotations
import warnings
from collections.abc import Hashable, Iterable, Iterator, Sized
from typing import (
TYPE_CHECKING,
Callable,
TypeVar,
Union,
cast,
)
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
from ..compat imp... | [] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_filter_in_timeframe | assert | collection | 386 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | [obj] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/utils/itertools.py | test_unique_everseen | assert | collection | 137 | from __future__ import annotations
import warnings
from collections.abc import Hashable, Iterable, Iterator, Sized
from typing import (
TYPE_CHECKING,
Callable,
TypeVar,
Union,
cast,
)
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
from ..compat imp... | [123] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/utils/itertools.py | test_listify | assert | collection | 68 | from __future__ import annotations
import warnings
from collections.abc import Hashable, Iterable, Iterator, Sized
from typing import (
TYPE_CHECKING,
Callable,
TypeVar,
Union,
cast,
)
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
from ..compat imp... | [1, 2] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/serialize.py | test_dumps | assert | collection | 200 | from __future__ import annotations
import datetime
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import cache
from pathlib import Path
from typing import Any, Callable, NamedTuple
from .error import error_to_json
from .pytest import parametrize
from .types import is_namedtupl... | [5, 5.0] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/freezer.py | test_freezer | assert | collection | 36 | from __future__ import annotations
from .internal import assert_subpackage
assert_subpackage(__name__)
import dataclasses
import inspect
from typing import Any, Generic, TypeVar
D = TypeVar('D')
def _freeze_dataclass(Orig: type[D]):
ofields = [(f.name, f.type, f) for f in dataclasses.fields(Orig)] # type: ign... | [1, 2, 3] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_cachew.py | test_cachew | assert | collection | 27 | from __future__ import annotations
from .common import skip_if_uses_optional_deps as pytestmark
def test_cachew() -> None:
from cachew import settings
settings.ENABLE = True # by default it's off in tests (see conftest.py)
from my.core.cachew import mcachew
called = 0
# TODO ugh. need doublew... | [1, 2, 3] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_cachew.py | test_cachew_dir_none | assert | collection | 24 | from __future__ import annotations
from .common import skip_if_uses_optional_deps as pytestmark
def test_cachew_dir_none() -> None:
from cachew import settings
settings.ENABLE = True # by default it's off in tests (see conftest.py)
from my.core.cachew import cache_dir, mcachew
from my.core.core_con... | [1, 1, 1] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_cachew.py | test_cachew_dir_none | assert | collection | 25 | from __future__ import annotations
from .common import skip_if_uses_optional_deps as pytestmark
def test_cachew_dir_none() -> None:
from cachew import settings
settings.ENABLE = True # by default it's off in tests (see conftest.py)
from my.core.cachew import cache_dir, mcachew
from my.core.core_con... | [2, 2, 2] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/utils/itertools.py | test_ensure_unique | assert | collection | 40 | from __future__ import annotations
import warnings
from collections.abc import Hashable, Iterable, Iterator, Sized
from typing import (
TYPE_CHECKING,
Callable,
TypeVar,
Union,
cast,
)
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
from ..compat imp... | [1, 2, 3] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/stats.py | test_stat | assert | collection | 87 | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
Any,
Ca... | {'count': 3} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/hpi_compat.py | test_always_supports_sequence_list_constructor | assert | collection | 125 | from __future__ import annotations
import inspect
import os
import re
from collections.abc import Iterator, Sequence
from types import ModuleType
from typing import TypeVar
from . import warnings
def handle_legacy_import(
parent_module_name: str,
legacy_submodule_name: str,
parent_module_path: list[str],... | ['a', 'b', 'c'] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_range_predicate | assert | collection | 384 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | ["0", "1", "2"] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_get_files.py | repl | assert | collection | 19 | import os
import shutil
import tempfile
import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from ..common import get_files
from kompress import CPath, ZipPath
def repl(x):
if isinstance(x, str):
return x.replace('/tmp', TMP)
elif isinstance(x, Path)... | (os.sep, 'tmp') | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/serialize.py | test_dumps | assert | collection | 236 | from __future__ import annotations
import datetime
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import cache
from pathlib import Path
from typing import Any, Callable, NamedTuple
from .error import error_to_json
from .pytest import parametrize
from .types import is_namedtupl... | {'1970-01-01': 5} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query.py | test_basic_orders | assert | collection | 511 | from __future__ import annotations
import dataclasses
import importlib
import inspect
import itertools
from collections.abc import Iterable, Iterator
from datetime import datetime
from typing import (
Any,
Callable,
NamedTuple,
Optional,
TypeVar,
)
import more_itertools
from . import error as err... | [_Int(1), _Int(3)] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/serialize.py | test_dumps | assert | collection | 216 | from __future__ import annotations
import datetime
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import cache
from pathlib import Path
from typing import Any, Callable, NamedTuple
from .error import error_to_json
from .pytest import parametrize
from .types import is_namedtupl... | {"x": 6, "y": 6.0} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/serialize.py | test_dumps_namedtuple | assert | collection | 184 | from __future__ import annotations
import datetime
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import cache
from pathlib import Path
from typing import Any, Callable, NamedTuple
from .error import error_to_json
from .pytest import parametrize
from .types import is_namedtupl... | {'x': 1, 'y': 2.0} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/serialize.py | test_dumps | assert | collection | 228 | from __future__ import annotations
import datetime
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import cache
from pathlib import Path
from typing import Any, Callable, NamedTuple
from .error import error_to_json
from .pytest import parametrize
from .types import is_namedtupl... | {"x": 10, "y": 10.0} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/stats.py | test_stat | assert | collection | 94 | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
Any,
Ca... | {'fun': {'count': 3}} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_range_predicate | assert | collection | 380 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | ["0", "1", "2", "3", "4"] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/error.py | test_sort_res_by | assert | collection | 143 | from __future__ import annotations
import traceback
from collections.abc import Iterable, Iterator
from datetime import datetime
from itertools import tee
from typing import (
Any,
Callable,
Literal,
TypeVar,
Union,
cast,
)
from .types import Json
T = TypeVar('T')
E = TypeVar('E', bound=Excep... | ['a', 'aba', 'caba', 'daba'] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_config.py | test_dynamic_module_import | assert | collection | 47 | import os
import sys
from pathlib import Path
import pytest
import pytz
import my.config
from my.core import notnone
from my.demo import items, make_config
from .common import tmp_environ_set
@pytest.mark.parametrize('run_id', ['1', '2'])
def test_dynamic_module_import(tmp_path: Path, run_id: str) -> None:
"""
... | {f'total_{run_id}': 1 + 123} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_config.py | test_dynamic_module_import | assert | collection | 48 | import os
import sys
from pathlib import Path
import pytest
import pytz
import my.config
from my.core import notnone
from my.demo import items, make_config
from .common import tmp_environ_set
@pytest.mark.parametrize('run_id', ['1', '2'])
def test_dynamic_module_import(tmp_path: Path, run_id: str) -> None:
"""
... | {f'total_{run_id}': 2 + 456} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/error.py | test_sort_res_by | assert | collection | 141 | from __future__ import annotations
import traceback
from collections.abc import Iterable, Iterator
from datetime import datetime
from itertools import tee
from typing import (
Any,
Callable,
Literal,
TypeVar,
Union,
cast,
)
from .types import Json
T = TypeVar('T')
E = TypeVar('E', bound=Excep... | [Exc('last'), 0] + results[:-1] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_get_files.py | test_single_file | assert | collection | 48 | import os
import shutil
import tempfile
import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from ..common import get_files
from kompress import CPath, ZipPath
def _get_files(x, *args, **kwargs):
from ..common import get_files as get_files_orig
def repl(x):
if isin... | (Path('/tmp/hpi_test/file.ext'),) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/sqlite.py | _get_sqlite_master | assert | collection | 107 | from __future__ import annotations
from .internal import assert_subpackage # noqa: I001
assert_subpackage(__name__)
import shutil
import sqlite3
from collections.abc import Iterator
from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Callabl... | {'table', 'index', 'view', 'trigger'} | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_get_files.py | test_single_file | assert | collection | 53 | import os
import shutil
import tempfile
import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from ..common import get_files
from kompress import CPath, ZipPath
def _get_files(x, *args, **kwargs):
from ..common import get_files as get_files_orig
def repl(x):
if isin... | (Path('~').expanduser() / '.bashrc',) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/structure.py | test_gdpr_structure_exists | assert | collection | 14 | from pathlib import Path
import pytest
from ..structure import match_structure
structure_data: Path = Path(__file__).parent / "structure_data"
gdpr_expected = ("comments", "messages/index.csv", "profile")
def test_gdpr_structure_exists() -> None:
with match_structure(structure_data, expected=gdpr_expected) as ... | (structure_data / "gdpr_subdirs" / "gdpr_export",) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_query_range_float_value_type | assert | collection | 360 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | [_Float(2.5), _Float(3.5), _Float(4.5), _Float(5.5)] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/query_range.py | test_filter_in_timeframe | assert | collection | 375 | from __future__ import annotations
import re
import time
from collections.abc import Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, Callable, NamedTuple
import more_itertools
from .compat import fromisoformat
from .query import (
ET,
OrderFunc,
... | [_B(y=datetime(year=2015, month=5, day=10, hour=4, minute=10, second=1))] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/tests/body/weight.py | test_body_weight | assert | collection | 13 | from pathlib import Path
import pytest
import pytz
from my.body.weight import from_orgmode
from my.core.cfg import tmp_config
def test_body_weight() -> None:
weights = [0.0 if isinstance(x, Exception) else x.value for x in from_orgmode()]
assert weights == | [ 0.0, 62.0, 0.0, 61.0, 62.0, 0.0, ] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/error.py | test_sort_res_by | assert | collection | 129 | from __future__ import annotations
import traceback
from collections.abc import Iterable, Iterator
from datetime import datetime
from itertools import tee
from typing import (
Any,
Callable,
Literal,
TypeVar,
Union,
cast,
)
from .types import Json
T = TypeVar('T')
E = TypeVar('E', bound=Excep... | [ 1, 'bad', 2, 3, Exc('first'), Exc('second'), 5, Exc('last'), ] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/core/tests/test_get_files.py | test_implicit_glob | assert | collection | 46 | import os
import shutil
import tempfile
import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from ..common import get_files
from kompress import CPath, ZipPath
def _get_files(x, *args, **kwargs):
from ..common import get_files as get_files_orig
def repl(x):
if isin... | ( Path('/tmp/hpi_test/123/file.gz'), Path('/tmp/hpi_test/456/file.gz'), ) | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/tests/tz.py | test_iter_tzs | assert | collection | 28 | import sys
from datetime import datetime, timedelta
import pytest
import pytz
import my.time.tz.main as tz_main
import my.time.tz.via_location as tz_via_location
from my.core import notnone
from my.core.compat import fromisoformat
from .shared_tz_config import config # autoused fixture
def getzone(dt: datetime) ->... | [ 'Europe/Rome', 'Europe/Rome', 'Europe/Vienna', 'Europe/Vienna', 'Europe/Vienna', ] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/HPI | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | train | train | src/my/tests/tz.py | test_iter_tzs | assert | collection | 36 | import sys
from datetime import datetime, timedelta
import pytest
import pytz
import my.time.tz.main as tz_main
import my.time.tz.via_location as tz_via_location
from my.core import notnone
from my.core.compat import fromisoformat
from .shared_tz_config import config # autoused fixture
def getzone(dt: datetime) ->... | [ 'Europe/Rome', 'Europe/Rome', 'Europe/Ljubljana', 'Europe/Ljubljana', 'Europe/Ljubljana', ] | cf8b03131fb1b5bf53f58e83f250d5d39fb7d064 | 125 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/kjson.py | test_json_processor | assert | numeric_literal | 51 | from typing import Any, Dict, List, Union, Tuple, cast
JDict = Dict[str, Any] # TODO not sure if we can do recursive..
JList = List[Any]
JPrim = Union[str, int, float] # , type(None)]
Json = Union[JDict, JList, JPrim]
JPathPart = Tuple[Json, Union[str, int]]
JPath = Tuple[JPathPart, ...]
def test_json_processor():... | 0 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/kjson.py | test_json_processor | assert | string_literal | 55 | from typing import Any, Dict, List, Union, Tuple, cast
JDict = Dict[str, Any] # TODO not sure if we can do recursive..
JList = List[Any]
JPrim = Union[str, int, float] # , type(None)]
Json = Union[JDict, JList, JPrim]
JPathPart = Tuple[Json, Union[str, int]]
JPath = Tuple[JPathPart, ...]
def test_json_processor():... | 'http://reddit.com' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/kjson.py | test_json_processor | assert | collection | 57 | from typing import Any, Dict, List, Union, Tuple, cast
JDict = Dict[str, Any] # TODO not sure if we can do recursive..
JList = List[Any]
JPrim = Union[str, int, float] # , type(None)]
Json = Union[JDict, JList, JPrim]
JPathPart = Tuple[Json, Union[str, int]]
JPath = Tuple[JPathPart, ...]
def test_json_processor():... | ['x', 'y', 1, 'link'] | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_auto.py | test_auto | assert | complex_expr | 37 | from itertools import groupby
import os
from ...sources import auto
from ..common import get_testdata, throw
sa2464 = 'https://www.scottaaronson.com/blog/?p=2464'
_JSON_URLS = {
'https://johncarlosbaez.wordpress.com/2016/09/09/struggles-with-the-continuum-part-2/',
sa2464,
}
def makemap(visits):
key = ... | v.context | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_auto.py | test_json | assert | variable | 28 | from itertools import groupby
import os
from ...sources import auto
from ..common import get_testdata, throw
sa2464 = 'https://www.scottaaronson.com/blog/?p=2464'
_JSON_URLS = {
'https://johncarlosbaez.wordpress.com/2016/09/09/struggles-with-the-continuum-part-2/',
sa2464,
}
def makemap(visits):
key = ... | _JSON_URLS | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_auto.py | test_json | assert | string_literal | 32 | from itertools import groupby
import os
from ...sources import auto
from ..common import get_testdata, throw
sa2464 = 'https://www.scottaaronson.com/blog/?p=2464'
_JSON_URLS = {
'https://johncarlosbaez.wordpress.com/2016/09/09/struggles-with-the-continuum-part-2/',
sa2464,
}
def makemap(visits):
key = ... | 'list::yyy::given_url' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_auto.py | test_auto | assert | string_literal | 35 | from itertools import groupby
import os
from ...sources import auto
from ..common import get_testdata, throw
sa2464 = 'https://www.scottaaronson.com/blog/?p=2464'
_JSON_URLS = {
'https://johncarlosbaez.wordpress.com/2016/09/09/struggles-with-the-continuum-part-2/',
sa2464,
}
def makemap(visits):
key = ... | 'orgs' + os.sep + 'file.org:14' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer_2 | assert | numeric_literal | 19 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 6 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_url_in_properties | assert | numeric_literal | 19 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 2 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer | assert | variable | 27 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | exp | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer_2 | assert | string_literal | 21 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'https://link.com' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_url_in_properties | assert | string_literal | 21 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'http://example.org/a_test' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_url_in_properties | assert | string_literal | 20 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'https://example.org/ref_example' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer_2 | assert | string_literal | 22 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'https://en.wikipedia.org/wiki/Resilio_Sync' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer | assert | string_literal | 19 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'https://www.youtube.com/watch?v=rHIkrotSwcc' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer | assert | string_literal | 29 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'https://twitter.com/Mappletons/status/1255221220263563269' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_org_indexer_2 | assert | string_literal | 20 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | 'https://www.reddit.com/r/androidapps/comments/4i36z9/how_you_use_your_android_to_the_maximum/d2uq24i' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/sources/test_org.py | test_heading | assert | collection | 18 | from typing import Optional
from ...common import Visit
from ...sources.org import extract_from_file
from ..common import get_testdata, throw
def delrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure how ot handle this properly, ideally should be via pytest?
# not s... | { 'https://en.wikipedia.org/wiki/Computational_topology', 'http://graphics.stanford.edu/courses/cs468-09-fall/', 'https://en.wikipedia.org/wiki/Triangulation_(topology)', 'https://en.wikipedia.org/wiki/Digital_manifold', } | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_cannon.py | test_same_norm | assert | variable | 37 | from typing import cast
import pytest
from ..cannon import canonify, CanonifyException
param = pytest.mark.parametrize
TODO = cast(str, object())
def check(url, expected):
if expected is TODO:
pytest.skip(f"'{url}' will be handled later")
assert canonify(url) == expected
def test(url, expected):
... | c | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_cannon.py | check | assert | variable | 15 | from typing import cast
import pytest
from ..cannon import canonify, CanonifyException
param = pytest.mark.parametrize
TODO = cast(str, object())
def check(url, expected):
if expected is TODO:
pytest.skip(f"'{url}' will be handled later")
assert canonify(url) == | expected | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_cannon.py | test_error | pytest.raises | variable | 22 | from typing import cast
import pytest
from ..cannon import canonify, CanonifyException
param = pytest.mark.parametrize
TODO = cast(str, object())
def check(url, expected):
if expected is TODO:
pytest.skip(f"'{url}' will be handled later")
assert canonify(url) == expected
def test(url, expected):
... | CanonifyException) | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_cli.py | test_demo | assert | numeric_literal | 40 | import os
import time
from ..common import _is_windows
from .common import get_testdata, promnesia_bin, tmp_popen
import pytest
import requests
ox_hugo_data = get_testdata('ox-hugo/test/site')
def test_demo() -> None:
if _is_windows:
# for some reason fails to connect to server..
# not sure may... | 1 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_cli.py | test_demo | assert | numeric_literal | 37 | import os
import time
from ..common import _is_windows
from .common import get_testdata, promnesia_bin, tmp_popen
import pytest
import requests
ox_hugo_data = get_testdata('ox-hugo/test/site')
def test_demo() -> None:
if _is_windows:
# for some reason fails to connect to server..
# not sure may... | 50 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_minimal | assert | numeric_literal | 60 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 1 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_sources_errors | assert | numeric_literal | 71 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 2 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | index | assert | numeric_literal | 40 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 0 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_sources_style_1 | assert | string_literal | 104 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 'cfg' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_sources_style_1 | assert | string_literal | 97 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 'demo' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_sources_style_2 | assert | string_literal | 86 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 'nice name' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_legacy | assert | string_literal | 59 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | 'legacy name' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_config.py | test_no_sources | pytest.raises | variable | 51 | from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Union, List
from ..common import Source
from ..config import import_config, Config
from more_itertools import ilen
import pytest
from .common import throw
def make(body: str) -> Config:
with... | RuntimeError) | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_db_dump.py | make_visits | assert | numeric_literal | 29 | from __future__ import annotations
from datetime import datetime, timedelta, timezone
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Iterable
from hypothesis import settings, given
from hypothesis.strategies import from_type
import pytest
import pytz
from ..common import Lo... | 0 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_db_dump.py | test_one_visit | assert | collection | 70 | from __future__ import annotations
from datetime import datetime, timedelta, timezone
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Iterable
from hypothesis import settings, given
from hypothesis.strategies import from_type
import pytest
import pytz
from ..common import Lo... | [visit] | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_db_dump.py | test_no_visits | assert | func_call | 43 | from __future__ import annotations
from datetime import datetime, timedelta, timezone
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Iterable
from hypothesis import settings, given
from hypothesis.strategies import from_type
import pytest
import pytz
from ..common import Lo... | str(err) | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_db_dump.py | test_one_visit | assert | collection | 58 | from __future__ import annotations
from datetime import datetime, timedelta, timezone
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Iterable
from hypothesis import settings, given
from hypothesis.strategies import from_type
import pytest
import pytz
from ..common import Lo... | { 'context': None, 'dt': '2023-11-14T23:11:01+01:00', 'duration': 123, 'locator_href': 'https://whatever.com', 'locator_title': 'title', 'norm_url': 'google.com', 'orig_url': 'https://google.com', 'src': 'whatever', } | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_db_dump.py | test_read_db_visits | assert | func_call | 69 | from __future__ import annotations
from datetime import datetime, timedelta, timezone
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Iterable
from hypothesis import settings, given
from hypothesis.strategies import from_type
import pytest
import pytz
from ..common import Lo... | DbVisit( norm_url='i.redd.it/alala.jpg', orig_url='https://i.redd.it/alala.jpg', dt=datetime(2019, 4, 13, 11, 55, 9, tzinfo=timezone(timedelta(hours=-4))), locator=Loc.make(title='Reddit save', href='https://reddit.com/r/whatever'), src='reddit', context='', ) | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_extract_urls.py | test_extract_simple | assert | collection | 9 | from ..common import extract_urls
def test_extract_simple() -> None:
lines = """
I've enjoyed [Chandler Carruth's _There Are No Zero-cost Abstractions_](
https://www.youtube.com/watch?v=rHIkrotSwcc) very much.
""".strip()
assert set(extract_urls(lines)) == | {'https://www.youtube.com/watch?v=rHIkrotSwcc'} | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_extract_urls.py | test_extract_2 | assert | collection | 10 | from ..common import extract_urls
def test_extract_2() -> None:
text = '''♂️ Чтобы снизить вероятность ошибиться, важно знать про когнитивные искажения.
Если для вас это новое словосочетание, начните с книжки
"Гарри Поттер и Методы рационального мышления" - http://hpmor.ru/, если вы знакомы с понятием - ч... | {'http://hpmor.ru/', 'lesswrong.ru', 'lesswrong.com', 'https://t.me/ontologics'} | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_extract_urls.py | test_extract_3 | assert | collection | 10 | from ..common import extract_urls
def test_extract_3() -> None:
lines = '''
python.org/one.html ?? https://python.org/two.html some extra text
whatever.org
'''
assert set(extract_urls(lines, syntax='org')) == | { 'python.org/one.html', 'https://python.org/two.html', 'whatever.org', } | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_extract_urls.py | test_extract_md | assert | collection | 8 | from ..common import extract_urls
def test_extract_md() -> None:
lines = '''
Hey, I recently implemented a new extension for that [addons.mozilla.org](https://addons.mozilla.org/en-US/firefox/addon/org-grasp-for-org-capture/), [github](https://github.com/karlicoss/grasp), perhaps it could be useful for you!
''... | { 'addons.mozilla.org', 'https://addons.mozilla.org/en-US/firefox/addon/org-grasp-for-org-capture/', 'https://github.com/karlicoss/grasp', } | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_indexer.py | test_indexing_mode | assert | collection | 38 | from collections import Counter
import inspect
from pathlib import Path
from textwrap import dedent
import pytest
from ..__main__ import do_index
from ..database.load import get_all_db_visits
def get_stats(tmp_path: Path) -> Counter:
visits = get_all_db_visits(tmp_path / 'promnesia.sqlite')
return Counter(v.... | {'demo1': 10, 'demo2': 20} | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_indexer.py | test_indexing_mode | assert | collection | 59 | from collections import Counter
import inspect
from pathlib import Path
from textwrap import dedent
import pytest
from ..__main__ import do_index
from ..database.load import get_all_db_visits
def get_stats(tmp_path: Path) -> Counter:
visits = get_all_db_visits(tmp_path / 'promnesia.sqlite')
return Counter(v.... | {'demo2': 30, 'demo3': 40} | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_indexer.py | test_indexing_mode | assert | collection | 56 | from collections import Counter
import inspect
from pathlib import Path
from textwrap import dedent
import pytest
from ..__main__ import do_index
from ..database.load import get_all_db_visits
def get_stats(tmp_path: Path) -> Counter:
visits = get_all_db_visits(tmp_path / 'promnesia.sqlite')
return Counter(v.... | {'demo1': 10, 'demo2': 30, 'demo3': 40} | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_server.py | test_status_error | assert | numeric_literal | 22 | from pathlib import Path
from subprocess import check_call
from .common import promnesia_bin
from .server_helper import run_server
def test_status_error() -> None:
"""
If DB doesn't exist, server should handle it gracefully and respond with error
"""
with run_server(db='/does/not/exist') as server:
... | 2 | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_server.py | test_basic | assert | collection | 24 | from pathlib import Path
from subprocess import check_call
from .common import promnesia_bin
from .server_helper import run_server
def test_basic(tmp_path: Path) -> None:
# TODO use tmp_path to index
cfg = tmp_path / 'config.py'
# TODO simplify this, make sure it can just use default demo provider
cfg... | [] | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_server.py | test_status_error | assert | none_literal | 21 | from pathlib import Path
from subprocess import check_call
from .common import promnesia_bin
from .server_helper import run_server
def test_status_error() -> None:
"""
If DB doesn't exist, server should handle it gracefully and respond with error
"""
with run_server(db='/does/not/exist') as server:
... | None | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_server.py | test_basic | assert | string_literal | 30 | from pathlib import Path
from subprocess import check_call
from .common import promnesia_bin
from .server_helper import run_server
def test_basic(tmp_path: Path) -> None:
# TODO use tmp_path to index
cfg = tmp_path / 'config.py'
# TODO simplify this, make sure it can just use default demo provider
cfg... | 'demo' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_server.py | test_status_error | assert | complex_expr | 24 | from pathlib import Path
from subprocess import check_call
from .common import promnesia_bin
from .server_helper import run_server
def test_status_error() -> None:
"""
If DB doesn't exist, server should handle it gracefully and respond with error
"""
with run_server(db='/does/not/exist') as server:
... | body['db'] | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
karlicoss/promnesia | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | train | train | src/promnesia/tests/test_server.py | test_basic | assert | string_literal | 28 | from pathlib import Path
from subprocess import check_call
from .common import promnesia_bin
from .server_helper import run_server
def test_basic(tmp_path: Path) -> None:
# TODO use tmp_path to index
cfg = tmp_path / 'config.py'
# TODO simplify this, make sure it can just use default demo provider
cfg... | 'demo.com/page0.html' | 66bd18a60546c9e6c1e1bcfd6bd65336c850e4c7 | 273 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.