repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 19 | assert | numeric_literal | radon/tests/test_cli.py | test_config_converts_types | 86 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | cli.Config() | assert | func_call | radon/tests/test_cli.py | test_config_eq | 58 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | expected_result | assert | variable | radon/tests/test_complexity_utils.py | test_sorted_results | 65 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | []) | assert_* | collection | radon/tests/test_cli_harvest.py | test_cc_gobble | 142 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | names | assert | variable | radon/tests/test_complexity_utils.py | test_cc_visit | 109 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | '{\'a\': 2}' | assert | string_literal | radon/tests/test_cli.py | test_config_str | 54 | null | |
rubik/radon | import json
import os
import pytest
import radon.cli as cli
from radon.cli.harvest import (
SUPPORTS_IPYNB,
CCHarvester,
Harvester,
MIHarvester,
RawHarvester,
)
from radon.cli.tools import _is_python_file
from radon.tests.test_cli_harvest import MI_CONFIG, RAW_CONFIG
BASE_CONFIG_WITH_IPYNB = cli.... | 52 | assert | numeric_literal | radon/tests/test_ipynb.py | test_raw_ipynb_cells | 135 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | classes_complexity | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_module | 671 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | {'a': 2, 'b': 3} | assert | collection | radon/tests/test_cli.py | test_config_base_behavior | 40 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 'Y' | assert | string_literal | radon/tests/test_cli.py | test_config_converts_types | 85 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | base_config.ignore) | assert_* | complex_expr | radon/tests/test_cli_harvest.py | test_base_iter_filenames | 74 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | total_class_complexity | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_classes | 596 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | total_complexity | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_module | 672 | null | |
rubik/radon | import json
import os
import pytest
import radon.cli as cli
from radon.cli.harvest import (
SUPPORTS_IPYNB,
CCHarvester,
Harvester,
MIHarvester,
RawHarvester,
)
from radon.cli.tools import _is_python_file
from radon.tests.test_cli_harvest import MI_CONFIG, RAW_CONFIG
BASE_CONFIG_WITH_IPYNB = cli.... | filenames | assert | variable | radon/tests/test_ipynb.py | test_harvestor_yields_ipynb | 36 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | diff | assert | variable | radon/tests/test_complexity_utils.py | test_cc_visit | 108 | null | |
rubik/radon | import textwrap
import pytest
from radon.raw import *
dedent = lambda code: textwrap.dedent(code).strip()
FIND_CASES = [
(
'''
return 0
''',
None,
),
(
'''
# most useless comment :
''',
None,
),
(
'''
if a: pass
''',
2... | expected) | pytest.raises | variable | radon/tests/test_raw.py | test_analyze | 456 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | mi_config.multi) | assert_* | complex_expr | radon/tests/test_cli_harvest.py | test_mi_gobble | 349 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | 1 | assert | numeric_literal | radon/tests/test_complexity_visitor.py | test_visitor_single_functions | 483 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | expected_cs_cc | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_closures | 721 | null | |
rubik/radon | import json
import os
import pytest
import radon.cli as cli
from radon.cli.harvest import (
SUPPORTS_IPYNB,
CCHarvester,
Harvester,
MIHarvester,
RawHarvester,
)
from radon.cli.tools import _is_python_file
from radon.tests.test_cli_harvest import MI_CONFIG, RAW_CONFIG
BASE_CONFIG_WITH_IPYNB = cli.... | 2 | assert | numeric_literal | radon/tests/test_ipynb.py | test_raw_ipynb | 122 | null | |
rubik/radon | import textwrap
import pytest
from radon.metrics import *
dedent = lambda code: textwrap.dedent(code).strip()
def _compute_mi_rank(score):
if 0 <= score < 10:
res = 'C'
elif 10 <= score < 20:
res = 'B'
elif 20 <= score <= 100:
res = 'A'
else:
raise ValueError(score)
... | expected | assert | variable | radon/tests/test_other_metrics.py | test_mi_rank | 41 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | 0 | assert | numeric_literal | radon/tests/test_complexity_visitor.py | test_visitor_classes | 594 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | ( res[2:], 109, 4, ) | assert | collection | radon/tests/test_cli_tools.py | test_cc_to_terminal | 602 | null | |
rubik/radon | import json
import os
import pytest
import radon.cli as cli
from radon.cli.harvest import (
SUPPORTS_IPYNB,
CCHarvester,
Harvester,
MIHarvester,
RawHarvester,
)
from radon.cli.tools import _is_python_file
from radon.tests.test_cli_harvest import MI_CONFIG, RAW_CONFIG
BASE_CONFIG_WITH_IPYNB = cli.... | 63 | assert | numeric_literal | radon/tests/test_ipynb.py | test_raw_ipynb | 116 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | 1 | assert | numeric_literal | radon/tests/test_cli_harvest.py | test_cc_as_md | 189 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | [ 'file.py', 'test_all.py', 'tests/run.py', 'sub/amod.py', 'sub/bmod.py', ]) | assert_* | collection | radon/tests/test_cli_tools.py | test_iter_files | 121 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | sys.stdin | assert | complex_expr | radon/tests/test_cli_tools.py | test_open | 42 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 'mystr') | assert_* | string_literal | radon/tests/test_cli.py | test_log_result | 279 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 4 | assert | numeric_literal | radon/tests/test_cli.py | test_log | 215 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | v.blocks | assert | complex_expr | radon/tests/test_complexity_visitor.py | test_visitor_closures | 726 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | ( res[1:-1], 75, 4, ) | assert | collection | radon/tests/test_cli_tools.py | test_cc_to_terminal | 607 | null | |
rubik/radon | import textwrap
import pytest
from radon.raw import *
dedent = lambda code: textwrap.dedent(code).strip()
FIND_CASES = [
(
'''
return 0
''',
None,
),
(
'''
# most useless comment :
''',
None,
),
(
'''
if a: pass
''',
2... | result.blank + result.sloc + result.single_comments + result.multi | assert | complex_expr | radon/tests/test_raw.py | test_analyze | 461 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | mocker.sentinel.two) | assert_* | complex_expr | radon/tests/test_cli_harvest.py | test_raw_gobble | 235 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | number_of_blocks | assert | variable | radon/tests/test_complexity_utils.py | test_cc_visit | 104 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | len(expected) | assert | func_call | radon/tests/test_complexity_visitor.py | test_visitor_functions | 538 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | [('-', 42)] | assert | collection | radon/tests/test_cli_harvest.py | test_base_run | 105 | null | |
rubik/radon | import textwrap
import pytest
from radon.raw import *
dedent = lambda code: textwrap.dedent(code).strip()
FIND_CASES = [
(
'''
return 0
''',
None,
),
(
'''
# most useless comment :
''',
None,
),
(
'''
if a: pass
''',
2... | Module(*expected) | assert | func_call | radon/tests/test_raw.py | test_analyze | 460 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | _md | assert | variable | radon/tests/test_cli_tools.py | test_cc_to_md | 401 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | functions_complexity | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_module | 670 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 2 | assert | numeric_literal | radon/tests/test_cli.py | test_config_base_behavior | 41 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | expected_letter | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_containers | 752 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | b | assert | variable | radon/tests/test_cli_tools.py | assert_pequal | 37 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | [(7, 0, 'R701 \'f\' is too complex (4)', type(c))] | assert | collection | radon/tests/test_complexity_utils.py | test_flake8_checker | 118 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | [] | assert | collection | radon/tests/test_complexity_utils.py | test_flake8_checker | 116 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | { 'loc': 103, 'lloc': 123, 'sloc': 98, 'comments': 8, 'multi': 19, 'blank': 5, 'single_comments': 3, } | assert | collection | radon/tests/test_cli_tools.py | test_raw_to_dict | 319 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | ['file.py', 'amod.py', 'test_all.py', 'sub/amod.py', 'sub/bmod.py']) | assert_* | collection | radon/tests/test_cli_tools.py | test_iter_files | 132 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | expected_average | assert | variable | radon/tests/test_complexity_utils.py | test_average_complexity | 70 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import HalsteadVisitor
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a and b: pass
''',
(1, 2, 1, 2),
),
(
'''
if a and b: pass
elif b or c: pass
''',
(2... | ( visitor.operators, visitor.operands, visitor.distinct_operators, visitor.distinct_operands, ) | assert | collection | radon/tests/test_halstead.py | test_visitor | 108 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | True | assert | bool_literal | radon/tests/test_cli.py | test_config_converts_types | 83 | null | |
rubik/radon | import json
import os
import pytest
import radon.cli as cli
from radon.cli.harvest import (
SUPPORTS_IPYNB,
CCHarvester,
Harvester,
MIHarvester,
RawHarvester,
)
from radon.cli.tools import _is_python_file
from radon.tests.test_cli_harvest import MI_CONFIG, RAW_CONFIG
BASE_CONFIG_WITH_IPYNB = cli.... | 3 | assert | numeric_literal | radon/tests/test_ipynb.py | test_raw_ipynb | 119 | null | |
rubik/radon | import pytest
import radon.cli.harvest as harvest
import radon.complexity as cc_mod
from radon.cli import Config
BASE_CONFIG = Config(
exclude=r'test_[^.]+\.py',
ignore='tests,docs',
include_ipynb=False,
ipynb_cells=False,
)
CC_CONFIG = Config(
order=getattr(cc_mod, 'SCORE'),
no_assert=False,... | 2 | assert | numeric_literal | radon/tests/test_cli_harvest.py | test_cc_to_dicts | 157 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | closure_names | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_closures | 718 | null | |
rubik/radon | import json
import os
import pytest
import radon.cli as cli
from radon.cli.harvest import (
SUPPORTS_IPYNB,
CCHarvester,
Harvester,
MIHarvester,
RawHarvester,
)
from radon.cli.tools import _is_python_file
from radon.tests.test_cli_harvest import MI_CONFIG, RAW_CONFIG
BASE_CONFIG_WITH_IPYNB = cli.... | 27 | assert | numeric_literal | radon/tests/test_ipynb.py | test_raw_ipynb_cells | 136 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | expected_total_cc | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_closures | 722 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | ['file.py', 'amod.py', 'test_all.py']) | assert_* | collection | radon/tests/test_cli_tools.py | test_iter_files | 137 | null | |
rubik/radon | import textwrap
import pytest
from radon.raw import *
dedent = lambda code: textwrap.dedent(code).strip()
FIND_CASES = [
(
'''
return 0
''',
None,
),
(
'''
# most useless comment :
''',
None,
),
(
'''
if a: pass
''',
2... | expected_number_of_lines | assert | variable | radon/tests/test_raw.py | test_logical | 189 | null | |
rubik/radon | import textwrap
import pytest
from radon.raw import *
dedent = lambda code: textwrap.dedent(code).strip()
FIND_CASES = [
(
'''
return 0
''',
None,
),
(
'''
# most useless comment :
''',
None,
),
(
'''
if a: pass
''',
2... | result | assert | variable | radon/tests/test_raw.py | test_find | 52 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 'msg\n') | assert_* | string_literal | radon/tests/test_cli.py | test_log_list | 222 | null | |
rubik/radon | import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is re... | -1 | assert | numeric_literal | radon/tests/test_complexity_utils.py | test_flake8_checker | 114 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 3 | assert | numeric_literal | radon/tests/test_cli.py | test_config_base_behavior | 42 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 'B' | assert | string_literal | radon/tests/test_cli.py | test_config_converts_types | 84 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | 'randomfile.py') | assert_* | string_literal | radon/tests/test_cli_tools.py | test_open | 55 | null | |
rubik/radon | import sys
import textwrap
import pytest
from radon.visitors import *
dedent = lambda code: textwrap.dedent(code).strip()
SIMPLE_BLOCKS = [
(
'''
if a: pass
''',
2,
{},
),
(
'''
if a: pass
else: pass
''',
2,
{},
),
(
... | methods_complexity | assert | variable | radon/tests/test_complexity_visitor.py | test_visitor_classes | 597 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | 0 | assert | numeric_literal | radon/tests/test_cli.py | test_log_result | 256 | null | |
rubik/radon | import textwrap
import pytest
from radon.raw import *
dedent = lambda code: textwrap.dedent(code).strip()
FIND_CASES = [
(
'''
return 0
''',
None,
),
(
'''
# most useless comment :
''',
None,
),
(
'''
if a: pass
''',
2... | ValueError) | pytest.raises | variable | radon/tests/test_raw.py | test_find | 49 | null | |
rubik/radon | import textwrap
import pytest
from radon.metrics import *
dedent = lambda code: textwrap.dedent(code).strip()
def _compute_mi_rank(score):
if 0 <= score < 10:
res = 'C'
elif 10 <= score < 20:
res = 'B'
elif 20 <= score <= 100:
res = 'A'
else:
raise ValueError(score)
... | 0 | assert | numeric_literal | radon/tests/test_other_metrics.py | test_mi_compute | 33 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | cli.Config(b=3) | assert | func_call | radon/tests/test_cli.py | test_config_for | 66 | null | |
rubik/radon | import os
import sys
from configparser import ConfigParser
import pytest
import radon.cli as cli
import radon.complexity as cc_mod
from radon.cli.harvest import CCHarvester, Harvester, MIHarvester, RawHarvester
from radon.tests.test_cli_harvest import (
BASE_CONFIG,
CC_CONFIG,
MI_CONFIG,
RAW_CONFIG,
)... | cli.Config(b=2) | assert | func_call | radon/tests/test_cli.py | test_config_eq | 60 | null | |
rubik/radon | import json
import locale
import os
import platform
import sys
import pytest
import radon.cli.tools as tools
from radon.raw import Module
from radon.visitors import Class, Function
def fake_isfile(filename):
if filename == 'file.py':
return True
return False
def fake_walk(start):
dirs = ['tests'... | ( res[:-2], 47, 4, ) | assert | collection | radon/tests/test_cli_tools.py | test_cc_to_terminal | 592 | null | |
ekzhu/datasketch | import pickle
import struct
import unittest
from unittest.mock import patch
import numpy as np
from datasketch.hyperloglog import HyperLogLog, HyperLogLogPlusPlus
from test.utils import fake_hash_func
class TestHyperLogLog(unittest.TestCase):
_class = HyperLogLog
def test_eq(self):
h1 = self._class(... | h2) | self.assertNotEqual | variable | test/test_hyperloglog.py | test_eq | TestHyperLogLog | 111 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import LeanMinHash, MinHash
from test.utils import fake_hash_func
class TestLeanMinHash(unittest.TestCase):
def test_eq(self):
m1 = MinHash(4, 1, hashfunc=fake_hash_func)
m2 = MinHash(4, 1, hashfunc=fake_hash_func)
m3 = Min... | lm4) | self.assertNotEqual | variable | test/test_lean_minhash.py | test_eq | TestLeanMinHash | 146 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import MinHash
def _make_data(n: int):
return [f"token-{i}".encode("utf-8") for i in range(n)]
class TestMinHashGPU(unittest.TestCase):
@unittest.skipUnless(GPU_AVAILABLE, "CuPy/CUDA not available")
def test_detect_mode_matches_cpu(self):... | np.array_equal(m_cpu.hashvalues, m_auto.hashvalues)) | self.assertTrue | func_call | test/test_minhash_gpu.py | test_detect_mode_matches_cpu | TestMinHashGPU | 52 | null |
ekzhu/datasketch | import os
import unittest
from glob import glob
import numpy as np
from datasketch.lsh_bloom import BloomTable, MinHashLSHBloom
from datasketch.minhash import MinHash
class TestBloomTable(unittest.TestCase):
def test_save(self):
fname = "/tmp/bloomfilter.bf" # noqa: S108
if os.path.exists(fname... | b_.query(item)) | self.assertTrue | func_call | test/test_lshbloom.py | test_save | TestBloomTable | 48 | null |
ekzhu/datasketch | import os
import unittest
from glob import glob
import numpy as np
from datasketch.lsh_bloom import BloomTable, MinHashLSHBloom
from datasketch.minhash import MinHash
class TestMinHashLSHBloom(unittest.TestCase):
def test_init(self):
lsh = MinHashLSHBloom(threshold=0.8, n=10, fp=0.01)
b1, r1 = ls... | len(lsh.hashtables) == lsh.b) | self.assertTrue | func_call | test/test_lshbloom.py | test_init | TestMinHashLSHBloom | 59 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_pickle(self):
m = minhash.MinHash(4, 1, hashfunc=fake_hash_func)
m.update(123)
... | np.array_equal(p.hashvalues, m.hashvalues)) | self.assertTrue | func_call | test/test_minhash.py | test_pickle | TestMinHash | 72 | null |
ekzhu/datasketch | import pickle
import struct
import unittest
from unittest.mock import patch
import numpy as np
from datasketch.hyperloglog import HyperLogLog, HyperLogLogPlusPlus
from test.utils import fake_hash_func
class TestHyperLogLog(unittest.TestCase):
_class = HyperLogLog
def test_update(self):
h = self._cla... | 1) | self.assertEqual | numeric_literal | test/test_hyperloglog.py | test_update | TestHyperLogLog | 37 | null |
ekzhu/datasketch | import os
import numpy as np
import pytest
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
STORAGE_CONFIG_REDIS = {
"basename": b"lsh_test",
"type": "redis",
"redis": {"host": "localhost", "port": 6379},
}
STOR... | lsh.b | assert | complex_expr | test/test_integration.py | test_get_counts | TestMinHashLSH | 252 | null |
ekzhu/datasketch | import os
import numpy as np
import pytest
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
STORAGE_CONFIG_REDIS = {
"basename": b"lsh_test",
"type": "redis",
"redis": {"host": "localhost", "port": 6379},
}
STOR... | r2 | assert | variable | test/test_integration.py | test_init | TestMinHashLSH | 74 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_eq(self):
m1 = minhash.MinHash(4, 1, hashfunc=fake_hash_func)
m2 = minhash.MinHash... | m5) | self.assertEqual | variable | test/test_minhash.py | test_eq | TestMinHash | 89 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestbBitMinHash(unittest.TestCase):
def setUp(self):
self.m = minhash.MinHash(hashfunc=fake_hash_func)
self.m.update(11)
... | bm2) | self.assertEqual | variable | test/test_minhash.py | test_pickle | TestbBitMinHash | 198 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import MinHash
def _make_data(n: int):
return [f"token-{i}".encode("utf-8") for i in range(n)]
class TestMinHashGPU(unittest.TestCase):
def test_always_mode_raises_when_no_device(self):
"""If GPU is unavailable, 'always' must raise at... | RuntimeError) | self.assertRaises | variable | test/test_minhash_gpu.py | test_always_mode_raises_when_no_device | TestMinHashGPU | 78 | null |
ekzhu/datasketch | import asyncio
import os
import pickle
import random
import string
from itertools import chain, islice
import numpy as np
import pytest
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo import MongoClient
from datasketch.experimental.aio.lsh import AsyncMinHashLSH
from datasketch.minhash import MinHash
... | 1 | assert | numeric_literal | test/aio/test_lsh.py | test_arbitrary_collection | TestAsyncMinHashLSH | 389 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_jaccard(self):
m1 = minhash.MinHash(4, 1, hashfunc=fake_hash_func)
m2 = minhash.Mi... | m1.jaccard(m2) == 0.0) | self.assertTrue | func_call | test/test_minhash.py | test_jaccard | TestMinHash | 48 | null |
ekzhu/datasketch | import pickle
import unittest
from unittest.mock import patch
import mockredis
import numpy as np
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
def fake_redis(**kwargs):
redis = mockredis.mock_redis_client(**kwargs)
... | 2) | self.assertEqual | numeric_literal | test/test_lsh.py | test_get_counts | TestMinHashLSH | 274 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_count(self):
m = minhash.MinHash(hashfunc=fake_hash_func)
m.update(11)
m.u... | 0) | self.assertGreaterEqual | numeric_literal | test/test_minhash.py | test_count | TestMinHash | 104 | null |
ekzhu/datasketch | import os
import unittest
from glob import glob
import numpy as np
from datasketch.lsh_bloom import BloomTable, MinHashLSHBloom
from datasketch.minhash import MinHash
class TestBloomTable(unittest.TestCase):
def test_insert(self):
r = 3
x = np.array([2, 3, 31], dtype=np.uint32)
b = BloomT... | RuntimeError) | self.assertRaises | variable | test/test_lshbloom.py | test_insert | TestBloomTable | 17 | null |
ekzhu/datasketch | import pickle
import unittest
from unittest.mock import patch
import mockredis
import numpy as np
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
def fake_redis(**kwargs):
redis = mockredis.mock_redis_client(**kwargs)
... | "b" in lsh) | self.assertTrue | string_literal | test/test_lsh.py | test_insert | TestMinHashLSH | 69 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
import scipy as sp
import scipy.sparse
from datasketch.weighted_minhash import WeightedMinHash, WeightedMinHashGenerator
class TestWeightedMinHashGenerator(unittest.TestCase):
def test_init(self):
mg = WeightedMinHashGenerator(2, 4, 1)
self.assert... | 4) | self.assertEqual | numeric_literal | test/test_weighted_minhash.py | test_init | TestWeightedMinHashGenerator | 23 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import WeightedMinHashGenerator
from datasketch.lshforest import MinHashLSHForest
from datasketch.minhash import MinHash
class TestMinHashLSHForest(unittest.TestCase):
def _setup(self):
d = "abcdefghijklmnopqrstuvwxyz"
data = {}
... | forest.is_empty()) | self.assertTrue | func_call | test/test_lshforest.py | test_init | TestMinHashLSHForest | 58 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_jaccard(self):
m1 = minhash.MinHash(4, 1, hashfunc=fake_hash_func)
m2 = minhash.Mi... | m1.jaccard(m2) < 1.0) | self.assertTrue | func_call | test/test_minhash.py | test_jaccard | TestMinHash | 50 | null |
ekzhu/datasketch | import os
import unittest
from glob import glob
import numpy as np
from datasketch.lsh_bloom import BloomTable, MinHashLSHBloom
from datasketch.minhash import MinHash
class TestBloomTable(unittest.TestCase):
def test_save(self):
fname = "/tmp/bloomfilter.bf" # noqa: S108
if os.path.exists(fname... | b.query(item)) | self.assertTrue | func_call | test/test_lshbloom.py | test_save | TestBloomTable | 41 | null |
ekzhu/datasketch | import pickle
import unittest
from unittest.mock import patch
import mockredis
import numpy as np
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
def fake_redis(**kwargs):
redis = mockredis.mock_redis_client(**kwargs)
... | lsh.b) | self.assertEqual | complex_expr | test/test_lsh.py | test_get_counts | TestMinHashLSH | 272 | null |
ekzhu/datasketch | import os
import numpy as np
import pytest
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
STORAGE_CONFIG_REDIS = {
"basename": b"lsh_test",
"type": "redis",
"redis": {"host": "localhost", "port": 6379},
}
STOR... | lsh | assert | variable | test/test_integration.py | test_insert | TestMinHashLSH | 106 | null |
ekzhu/datasketch | import pickle
import unittest
from unittest.mock import patch
import mockredis
import numpy as np
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
def fake_redis(**kwargs):
redis = mockredis.mock_redis_client(**kwargs)
... | ValueError) | self.assertRaises | variable | test/test_lsh.py | test_insert | TestMinHashLSH | 74 | null |
ekzhu/datasketch | import os
import numpy as np
import pytest
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
STORAGE_CONFIG_REDIS = {
"basename": b"lsh_test",
"type": "redis",
"redis": {"host": "localhost", "port": 6379},
}
STOR... | 1 | assert | numeric_literal | test/test_integration.py | test_insert | TestMinHashLSH | 100 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import MinHash
def _make_data(n: int):
return [f"token-{i}".encode("utf-8") for i in range(n)]
class TestMinHashGPU(unittest.TestCase):
def test_pickle_roundtrip_is_portable(self):
"""Pickle should drop device state so round-tripped o... | m2._b_gpu) | self.assertIsNotNone | complex_expr | test/test_minhash_gpu.py | test_pickle_roundtrip_is_portable | TestMinHashGPU | 68 | null |
ekzhu/datasketch | import pickle
import unittest
from unittest.mock import patch
import mockredis
import numpy as np
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
def fake_redis(**kwargs):
redis = mockredis.mock_redis_client(**kwargs)
... | r1 > r2) | self.assertTrue | complex_expr | test/test_lsh.py | test_init | TestMinHashLSH | 28 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_update_batch(self):
m1 = minhash.MinHash(4, 1, hashfunc=fake_hash_func)
m2 = minha... | m1.hashvalues[i] < m2.hashvalues[i]) | self.assertTrue | complex_expr | test/test_minhash.py | test_update_batch | TestMinHash | 34 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import MinHash
def _make_data(n: int):
return [f"token-{i}".encode("utf-8") for i in range(n)]
class TestMinHashGPU(unittest.TestCase):
@unittest.skipUnless(GPU_AVAILABLE, "CuPy/CUDA not available")
def test_update_batch_gpu_matches_cpu(se... | np.array_equal(m_cpu.hashvalues, m_gpu.hashvalues)) | self.assertTrue | func_call | test/test_minhash_gpu.py | test_update_batch_gpu_matches_cpu | TestMinHashGPU | 36 | null |
ekzhu/datasketch | import pickle
import unittest
import numpy as np
from datasketch import minhash
from datasketch.b_bit_minhash import bBitMinHash
from test.utils import fake_hash_func
class TestMinHash(unittest.TestCase):
def test_union(self):
m1 = minhash.MinHash(4, 1, hashfunc=fake_hash_func)
m2 = minhash.MinH... | u.jaccard(m2) == 1.0) | self.assertTrue | func_call | test/test_minhash.py | test_union | TestMinHash | 64 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.