type stringclasses 2
values | id stringlengths 4 7 | package stringclasses 1
value | context stringclasses 1
value | split stringclasses 1
value | format stringclasses 1
value | question stringlengths 303 549 ⌀ | tests stringlengths 488 1.29k ⌀ |
|---|---|---|---|---|---|---|---|
context | seis | seismic_linter | # SEIS: using `seismic_linter` 0.2.0 from Python
The distribution is named `seismic-linter`; import it as `seismic_linter`. This package checks Python source for patterns that can leak future information into time-series training. Static analysis examines source text; it does not execute that text or require the libra... | null | null | null | null |
eval | seis_01 | null | null | target | python | Use the Python package `seismic_linter`. Implement `t003_line(source: str) -> int | None`. Analyze the Python source with seismic_linter and return the line number of its first T003 violation, or None if there is none.
Return the complete submission.py in exactly one fenced Python code block, with all required imports... | import unittest
import submission
class TestT003Line(unittest.TestCase):
def test_lines(self):
cases = [
("train_test_split(x, y)\n", 1),
("print('ok')\n\ntrain_test_split(x, y, shuffle=True)\ntrain_test_split(x, y)\n", 3),
("model.fit(data)\ntrain_test_split(x, y)\n", ... |
eval | seis_02 | null | null | target | python | Use the Python package `seismic_linter`. Implement `rule_ids(source: str) -> list[str]`. Analyze the Python source with seismic_linter and return its distinct violation rule IDs in lexicographic order.
Return the complete submission.py in exactly one fenced Python code block, with all required imports and no prose. | import unittest
import submission
class TestRuleIds(unittest.TestCase):
def test_ids(self):
cases = [
("print('ok')\n", []),
("train_test_split(x, y)\ntrain_test_split(x, y, shuffle=True)\n", ["T003"]),
("train_test_split(x, y)\nmodel.fit(data)\ntrain_test_split(x, y)\n... |
eval | seis_03 | null | null | target | python | Use the Python package `seismic_linter`. Implement `is_clean(source: str) -> bool`. Use seismic_linter to return True if the Python source has no reported violations, and False otherwise.
Return the complete submission.py in exactly one fenced Python code block, with all required imports and no prose. | import unittest
import submission
class TestIsClean(unittest.TestCase):
def test_sources(self):
cases = [
("print('ok')\n", True),
("train_test_split(x, y, shuffle=False)\n", True),
("train_test_split(x, y)\n", False),
("model.fit(data)\n", False),
]... |
eval | seis_04 | null | null | target | python | Use the Python package `seismic_linter`. Implement `count_violations_in_file(file_path: str) -> int`. Use the seismic_linter file-analysis API to return the number of violations in the file.
Return the complete submission.py in exactly one fenced Python code block, with all required imports and no prose. | import tempfile
from pathlib import Path
import unittest
import submission
class TestCountViolationsInFile(unittest.TestCase):
def test_counts(self):
cases = [
("print('ok')\n", 0),
("train_test_split(x, y)\n", 1),
("train_test_split(x, y)\nmodel.fit(data)\n", 2),
... |
eval | seis_05 | null | null | target | python | Use the Python package `seismic_linter`. Implement `split_ok(train_times: list[int], test_times: list[int]) -> bool`. Use the seismic_linter runtime split validator. Return True on successful validation and False on TemporalCausalityError. Inputs are nonempty lists of integers without missing values.
Return the comple... | import unittest
import submission
class TestSplit(unittest.TestCase):
def test_boundaries(self):
cases = [
([1, 2, 3], [4, 5], True),
([1, 2, 3], [3, 4], False),
([5, 6], [1, 2], False),
([3, 1], [5, 4], True),
([3, 1], [5, 2], False),
... |
eval | seis_06 | null | null | target | python | Use the Python package `seismic_linter`. Implement `lint_and_split_summary(source: str, train_times: list[int], test_times: list[int]) -> dict`. Use seismic_linter to return {"violations": <number of source violations>, "split_ok": <whether the temporal split passes validation>}. Inputs are nonempty integer lists. Trea... | import unittest
import submission
class TestLintAndSplitSummary(unittest.TestCase):
def test_combinations(self):
sources = [("print('ok')\n", 0), ("train_test_split(x, y)\nmodel.fit(data)\n", 2)]
splits = [([3, 1], [5, 4], True), ([1, 2], [2, 3], False)]
for source, count in sources:
... |
eval | seis_07 | null | null | target | python | Use the Python package `seismic_linter`. Implement `make_monotonic_df(times: list[int])`. Return a pandas DataFrame with a time column sorted in ascending order. Use the seismic_linter monotonicity decorator on an inner loader function to validate the returned frame. Inputs are nonempty integer lists.
Return the compl... | import pandas as pd
import unittest
import submission
class TestMakeMonotonicDf(unittest.TestCase):
def test_sorted(self):
for times in ([3, 1, 2], [9], [-2, 5, -2, 0], [8, 7, 6, 5]):
with self.subTest(times=times):
frame = submission.make_monotonic_df(list(times))
... |
eval | seis_08 | null | null | target | python | Use the Python package `seismic_linter`. Fix the function below, which uses a nonexistent seismic_linter API. Preserve its function name and return type.
```python
import seismic_linter
def count_violations(source: str) -> int:
return len(seismic_linter.analysis_code(source, filename="x.py"))
```
Return the compl... | import unittest
import submission
class TestCountViolations(unittest.TestCase):
def test_counts(self):
cases = [
("print('ok')\n", 0),
("train_test_split(x, y)\n", 1),
("train_test_split(x, y)\nmodel.fit(data)\n", 2),
]
for source, expected in cases:
... |
eval | seis_09 | null | null | target | python | Use the Python package `seismic_linter`. Fix the function below to use the input type expected by seismic_linter. Inputs are nonempty integer lists.
```python
import seismic_linter
def split_ok_debug(train_times: list[int], test_times: list[int]) -> bool:
try:
seismic_linter.validate_split_integrity(train_... | import unittest
import submission
class TestSplit(unittest.TestCase):
def test_boundaries(self):
cases = [
([1, 2, 3], [4, 5], True),
([1, 2, 3], [3, 4], False),
([5, 6], [1, 2], False),
([3, 1], [5, 4], True),
([3, 1], [5, 2], False),
... |
eval | seis_10 | null | null | target | python | Use the Python package `seismic_linter`. Fix the decorator usage below while preserving the function name and its returned DataFrame.
```python
import pandas as pd
import seismic_linter
@seismic_linter.verify_monotonicity
def load_df_sorted():
return pd.DataFrame({"time": [1, 2, 3]})
```
Return the complete submi... | import functools
import unittest
from unittest.mock import patch
import pandas as pd
import seismic_linter
import seismic_linter.runtime
original_factory = seismic_linter.verify_monotonicity
observed_calls = []
def tracked_factory(*args, **kwargs):
decorator = original_factory(*args, **kwargs)
def apply(f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.