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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_control_variables.py | test_control_variable_used_correctly | assert_* | collection | 242 | import pytest
from wemake_python_styleguide.violations.best_practices import (
ControlVarUsedAfterBlockViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import (
AfterBlockVariablesVisitor,
)
correct_for_loop1 = """
def wrapper():
for i, j in ():
print(i, j)
"""
correct_for_loop2 = "... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_outer_scope_shadow.py | test_variable_used_correctly | assert_* | collection | 286 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.best_practices import (
OuterScopeShadowingViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
correct_for_loop1 = """
import ast
def wrapper():
for i, j in... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_blocks_overlap.py | test_block_correct_overlap | assert_* | collection | 130 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
import_and_class1 = """
import overlap
class overlap: ...
"""
i... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_class_block.py | test_class_block_usage | assert_* | collection | 56 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
class_def1 = 'class {0}():'
class_def2 = 'class {0}(object):'
class_def3 = 'class {0}:'
class_template1 = """
{0}
...
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_function_block.py | test_method_block_overlap | assert_* | collection | 71 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
function_def1 = 'def {0}():'
function_template1 = """
{0}
...
{1}
"""
function_template2 = """
{1}
{0}
...
"""
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_import_block.py | test_import_block_usage | assert_* | collection | 65 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
import_block = 'import {0}'
import_block_as = 'import some as {0}'
from_import_block = 'from some import {0}'
from_import_bl... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_loop_blocks.py | test_for_block_usage | assert_* | collection | 74 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
for_loop1 = 'for {0} in some():'
for_loop2 = 'for {0}, second in some():'
for_loop3 = 'for first, *{0} in some():'
for_temp... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_same_name.py | test_reuse_no_overlap | assert_* | collection | 62 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
context = """
{0}
{1}
"""
block_statement1 = 'from some import {0}, {1}'
@pytest.mark.parametrize('block_statement', [
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_try_block.py | test_except_block_usage | assert_* | collection | 147 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
except_block1 = 'except Exception as {0}:'
except_block2 = 'except (TypeError, ValueError) as {0}:'
try_template1 = """
try... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_blocks/test_overlap/test_with_block.py | test_with_block_usage | assert_* | collection | 78 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
with1 = 'with open() as {0}:'
with2 = 'with open() as ({0}, second):'
with3 = 'with open() as (first, *{0}):'
with4 = 'with ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_assign/test_multiple_assign.py | test_correct_assignments | assert_* | collection | 35 | import pytest
from wemake_python_styleguide.violations.best_practices import (
MultipleAssignmentsViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import (
WrongAssignmentVisitor,
)
single_assignment = 'constant = 1'
tuple_assignment = 'first, second = (1, 2)'
spread_assignment = 'first, *_, s... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_assign/test_unpacking_rules.py | test_correct_unpacking | assert_* | collection | 130 | import pytest
from wemake_python_styleguide.violations.best_practices import (
GettingElementByUnpackingViolation,
SingleElementDestructuringViolation,
WrongUnpackingViolation,
)
from wemake_python_styleguide.violations.consistency import (
UnpackingIterableToListViolation,
)
from wemake_python_stylegu... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_collection_hashes/test_float_keys.py | test_dict_with_regular | assert_* | collection | 42 | import pytest
from wemake_python_styleguide.violations.best_practices import FloatKeyViolation
from wemake_python_styleguide.visitors.ast.builtins import (
WrongCollectionVisitor,
)
dict_template1 = '{{ {0}: 1 }}'
dict_template2 = '{{ {0}: {0} }}'
dict_template3 = '{{ {0}: 1, **kwargs }}'
dict_template4 = '{{ {0}... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_collection_hashes/test_hash_elements.py | test_collection_with_impure | assert_* | collection | 53 | import pytest
from wemake_python_styleguide.violations.best_practices import (
NonUniqueItemsInHashViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import (
WrongCollectionVisitor,
)
set_literal_template = '{{{0}, {1}}}'
nested_set_template = """
{{
*{{
{0},
{1},
}},
}}... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_numbers/test_approximate_constants.py | test_no_violations_on_right_constants | assert_* | collection | 46 | import pytest
from wemake_python_styleguide.violations.best_practices import (
ApproximateConstantViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import WrongNumberVisitor
@pytest.mark.parametrize('variable_value', [
3.0,
3.1,
3.13,
3.142,
3.1416,
3.15,
6.2,
6.3,
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_numbers/test_magic_numbers.py | test_magic_number | assert_* | collection | 116 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.constants import MAGIC_NUMBERS_WHITELIST
from wemake_python_styleguide.violations.best_practices import (
MagicNumberViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import WrongNumberVisitor
ass... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_strings/test_alphabet_string.py | test_alphabet_as_string_no_violation | assert_* | collection | 34 | import string
import pytest
from wemake_python_styleguide.violations.best_practices import (
StringConstantRedefinedViolation,
)
from wemake_python_styleguide.violations.consistency import (
FormattedStringViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import WrongStringVisitor
@pytest.mark... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_strings/test_formatted_string.py | test_string_normal | assert_* | collection | 75 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooComplexFormattedStringViolation,
)
from wemake_python_styleguide.violations.consistency import (
FormattedStringViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import (
WrongFormatStringVisitor,
WrongStringVi... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_strings/test_modulo_formatting.py | test_regular_modulo_string | assert_* | collection | 83 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooComplexFormattedStringViolation,
)
from wemake_python_styleguide.violations.consistency import (
FormattedStringViolation,
ModuloStringFormatViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import WrongStringVisit... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_base_classes/test_base_builtin_classes.py | test_regular_subclass | assert_* | collection | 30 | import pytest
from wemake_python_styleguide.violations.oop import BuiltinSubclassViolation
from wemake_python_styleguide.visitors.ast.classes import WrongClassDefVisitor
class_with_base = """
class TestClass({0}):
'''Docs.'''
"""
@pytest.mark.parametrize('super_class', [
'type',
'object',
'Custom',
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_base_classes/test_class_definition_arguments.py | test_kwargs_unpacking_violation_except | assert_* | collection | 41 | import pytest
from wemake_python_styleguide.violations.best_practices import (
KwargsUnpackingInClassDefinitionViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassDefVisitor
class_definition_with_unpacking_one = """
kwargs = {'some_arg': 'some_arg'}
class TestClass(object, **kwargs):
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_base_classes/test_expression_base_class.py | test_correct_base_classes | assert_* | collection | 45 | import pytest
from wemake_python_styleguide.violations.oop import WrongBaseClassViolation
from wemake_python_styleguide.visitors.ast.classes import WrongClassDefVisitor
class_with_base = """
class Meta({0}):
'''Docs.'''
"""
@pytest.mark.parametrize('base', [
'RawName',
'Name.Attribute',
'Deep.Nested.... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_base_classes/test_object_as_parent.py | test_correct_class_definitions | assert_* | collection | 40 | import pytest
from wemake_python_styleguide.violations.consistency import (
ObjectInBaseClassesListViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassDefVisitor
extra_object = """
class TestClassName(FirstName, SecondName, object):
'''Docs.'''
"""
single_extra_object = """
class... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_base_classes/test_object_base_class.py | test_regular_base_classes | assert_* | collection | 66 | import pytest
from wemake_python_styleguide.violations.consistency import (
RequiredBaseClassViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassDefVisitor
class_without_base = """
class Meta:
'''Docs.'''
"""
class_with_empty_base = """
class Meta():
'''Docs.'''
"""
nested_c... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | test_correct_fields | assert_* | collection | 136 | import pytest
from wemake_python_styleguide.violations.oop import (
ShadowedClassAttributeViolation,
)
from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor
class_attribute = """
class ClassWithAttrs(object):
{0} = 0
def __init__(self) -> None:
self.{1} = 2
"""
class_an... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_class_attributes/test_slots_syntax.py | test_correct_slots | assert_* | collection | 90 | import pytest
from wemake_python_styleguide.violations.oop import WrongSlotsViolation
from wemake_python_styleguide.visitors.ast.classes import WrongSlotsVisitor
class_body_template = """
class ClassWithSlots(object):
__slots__ = {0}
"""
class_body_typed_template = """
class ClassWithSlots(object):
__slots__... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_getter_setter.py | test_valid_getter_and_setter | assert_* | collection | 202 | import pytest
from wemake_python_styleguide.violations.oop import (
UnpythonicGetterSetterViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassBodyVisitor
module_getter_and_setter = """
attribute = 1
def get_attribute():
...
def set_attribute():
...
"""
static_getter_and_set... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_method_order.py | test_correct_method_order | assert_* | collection | 84 | import pytest
from wemake_python_styleguide.violations.consistency import (
WrongMethodOrderViolation,
)
from wemake_python_styleguide.visitors.ast.classes import (
ClassMethodOrderVisitor,
)
correct_method_order = """
class Test(object):
def __init_subclass__(cls):
...
def __new__(self):
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_async_magic_methods.py | test_correct_async_magic_used | assert_* | collection | 41 | import pytest
from wemake_python_styleguide.violations.oop import AsyncMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
sync_method = """
class Example(object):
def {0}(self): ...
"""
async_method = """
class Example(object):
async def {0}(self): ...
"""
@pyt... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_async_yield_magic_methods.py | test_yield_is_always_allowed_in_aiter | assert_* | collection | 44 | import pytest
from wemake_python_styleguide.violations.oop import AsyncMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
sync_method = """
class Example(object):
def {0}(self, *args, **kwargs):
{1}
"""
async_method = """
class Example(object):
async def... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_magic_methods.py | test_correct_magic_method_used | assert_* | collection | 36 | import pytest
from wemake_python_styleguide.constants import MAGIC_METHODS_BLACKLIST
from wemake_python_styleguide.violations.oop import BadMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
magic_method = """
class Example(object):
def {0}(self): ...
"""
regular_fu... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_method_without_arguments.py | test_function_without_arguments | assert_* | collection | 28 | import pytest
from wemake_python_styleguide.violations.oop import (
MethodWithoutArgumentsViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
method_inside_class = """
class Example(object):
def some_name({0}): ...
"""
regular_function = 'def some_name({0}): ...'
def te... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_staticmethod.py | test_regular_decorator_used | assert_* | collection | 31 | import pytest
from wemake_python_styleguide.violations.oop import StaticMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
decorated_method = """
class Example(object):
@{0}
def should_fail(arg1): ...
"""
@pytest.mark.parametrize('decorator', [
'classmethod',
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_useless_overwriting_method.py | test_useful_due_to_invalid_decorator | assert_* | collection | 152 | from typing import List, NamedTuple
import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations import oop
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
regular_method_detailed = """
class Useless(object):
{decorator}
def fu... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_yield_magic_method.py | test_magic_statement | assert_* | collection | 51 | import pytest
from wemake_python_styleguide.violations.oop import YieldMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
method_template = """
class Test(object):
def {0}(self, *args, **kwargs):
{1}
"""
classmethod_template = """
class Test(object):
@cl... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_wrong_class_body.py | test_body_correct_items | assert_* | collection | 37 | import pytest
from wemake_python_styleguide.violations.oop import (
WrongClassBodyContentViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassBodyVisitor
class_body_template = """
class ClassWithBody(object):
{0}
"""
@pytest.mark.parametrize('code', [
'"""Docstring."""',
'... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_wrong_empty_lines_count.py | test_success | assert_* | collection | 141 | import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongEmptyLinesCountViolation,
)
from wemake_python_styleguide.visitors.ast.function_empty_lines import (
WrongEmptyLinesCountVisitor,
)
class_with_wrong_method = """
class WrongClass(object):
def wrong_method(self):
f... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_conditionals.py | test_valid_conditional | assert_* | collection | 85 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.consistency import (
ConstantConditionViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
create_variable = """
variable = 1
{0}
"""
if_statement ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_constant_compares/test_falsy_constant.py | test_falsy_constant_not_eq | assert_* | collection | 43 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.refactoring import (
FalsyConstantCompareViolation,
WrongIsCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConstantCompareVisitor,
)
wrong_comparators = [... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_constant_compares/test_is_constant_compare.py | test_correct_constant_is | assert_* | collection | 66 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.refactoring import (
FalsyConstantCompareViolation,
WrongIsCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConstantCompareVisitor,
)
wrong_comparators = [... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_float_complex_compare.py | test_correct_compares | assert_* | collection | 34 | import pytest
from wemake_python_styleguide.violations.best_practices import (
FloatComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongFloatComplexCompareVisitor,
)
@pytest.mark.parametrize('code', [
'x > 3',
'x <= y',
'abs(x - y) <= eps',
'isclose(x, ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_heterogenous_compare.py | test_correct_compare_operators | assert_* | collection | 28 | import pytest
from wemake_python_styleguide.violations.best_practices import (
HeterogeneousCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'x == y == z',
'z != y != x',
'call() == other.prop',
'x in y',
'x ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_in_type_check.py | test_compare_with_correct_type | assert_* | collection | 41 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.refactoring import (
InCompareWithSingleItemContainerViolation,
WrongInCompareTypeViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
InCompareSanityVisitor,
)
in_templat... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_in_with_single_item_container.py | test_multi_item_container | assert_* | collection | 39 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.refactoring import (
InCompareWithSingleItemContainerViolation,
WrongInCompareTypeViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
InCompareSanityVisitor,
)
@pytest.ma... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_literal.py | test_non_literal | assert_* | collection | 37 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.consistency import (
ConstantCompareViolation,
ReversedComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
chained_compares1 = '0 < {0} < {1}... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | test_compare_with_in | assert_* | collection | 47 | import pytest
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.violations.refactoring import (
InCompareWithSingleItemContainerViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
InCompareSanityVisitor,
)
if_wit... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_nested_ternary.py | test_non_nested_ternary | assert_* | collection | 118 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.refactoring import (
NestedTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
wrong_compare1 = 'x > (a if b else c)'
wrong_compare2 = '(a i... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_order.py | test_compare_variables | assert_* | collection | 63 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.consistency import (
CompareOrderViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongComparisonOrderVisitor,
)
wrong_comparators = [
('"string constant"', 'first_nam... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_redundant.py | test_not_useless | assert_* | collection | 47 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.consistency import (
UselessCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
create_variables = """
variable = 1
another_variable = 2
{0}
"""
correc... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_reversed_complex_compare.py | test_correct_compare | assert_* | collection | 29 | import pytest
from wemake_python_styleguide.violations.consistency import (
ReversedComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'x < y <= z',
'x < y < z',
'x <= y < z',
'x <= y <= z',
'x == y == z... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_expr.py | test_not_simplifiable_exp | assert_* | collection | 33 | import pytest
from wemake_python_styleguide.violations.refactoring import (
SimplifiableIfViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
if_expression = '{0} if some() else {1}'
@pytest.mark.parametrize('comparators', [
('variable', '"test"'),
('1... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_node.py | test_not_simplifiable_node | assert_* | collection | 96 | import pytest
from wemake_python_styleguide.violations.refactoring import (
SimplifiableIfViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
simple_if_template = """
if some_value:
{0} = {1}
else:
{2} = {3}
"""
simple_if_typed_template = """
if some_v... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_unary_compare/test_not_with_compare.py | test_correct_unary_operator | assert_* | collection | 30 | import pytest
from wemake_python_styleguide.violations.refactoring import (
NotOperatorWithCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import UnaryCompareVisitor
@pytest.mark.parametrize('code', [
'not some',
'some is not None',
'some not in other',
'not call()',
'x... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | test_correct_len_call | assert_* | collection | 41 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.refactoring import (
UselessLenCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'sum(some) == 0',
'min(som... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_access/test_access.py | test_correct_access | assert_* | collection | 41 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooDeepAccessViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.access import (
AccessVisitor,
)
subscript_access = 'my_matrix[0][0][0][0]'
attribute_access = 'self.attr.inner.wrapper.value'
mixed_access = 'self.attr[0]... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_annotation_complexity/test_annotation_complexity_nesting.py | test_correct_annotations | assert_* | collection | 90 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.complexity import (
TooComplexAnnotationViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.annotations import (
AnnotationComplexityVisitor,
)
annassign_template = 'some: {0}'
fun... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_call_chains/test_call_chains.py | test_correct_cases | assert_* | collection | 36 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongCallChainViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.calls import (
CallChainsVisitor,
)
deep_call_chain = 'foo(a)(b)(c)(d)'
call_chain = 'bar(a)(b)'
long_call_chain = 'baz(a)(b)(c)'
@pytest.mark.parame... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_classes/test_bases_classes_counts.py | test_correct_count | assert_* | collection | 58 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyBaseClassesViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.classes import (
ClassComplexityVisitor,
)
correct_count = """
class CorrectClassName(
FirstParentClass,
SecondParentClass,
ThirdParentCla... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_classes/test_method_counts.py | test_method_counts_normal | assert_* | collection | 128 | import pytest
from wemake_python_styleguide.visitors.ast.complexity.classes import (
MethodMembersVisitor,
TooManyMethodsViolation,
)
module_without_methods = """
def first(): ...
def second(): ...
"""
module_with_async_functions = """
async def first(): ...
async def second(): ...
"""
module_async_and_us... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_classes/test_public_attrs_count.py | test_correct_attributes | assert_* | collection | 68 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyPublicAttributesViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.classes import (
ClassComplexityVisitor,
)
class_template = """
class Test(object):
def __init__(self):
{0}
def other(self):
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_compare_complexity.py | test_module_compare_counts_normal | assert_* | collection | 56 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongCompareViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ConditionsVisitor,
)
empty_module = ''
one_compare = 'x > 1'
two_compare = 'x < y() >= 2'
one_equals = 'x == 1'
two_equals = 'x == call()... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_condition_counts.py | test_module_condition_counts_normal | assert_* | collection | 87 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyConditionsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ConditionsVisitor,
)
empty_module = ''
assignment = 'some = x > y or None'
condition_with_single_if = """
if 4 > 2 and 3 / 2 == 1.5:
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_decorators_count.py | test_decorators_normal | assert_* | collection | 60 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyDecoratorsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ModuleMembersVisitor,
)
function_with_decorators = """
@first
@second(param=4)
@third()
def function(): ...
"""
class_with_decorators ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_elifs.py | test_elif_correct_count | assert_* | collection | 188 | import pytest
from wemake_python_styleguide.violations.complexity import TooManyElifsViolation
from wemake_python_styleguide.visitors.ast.complexity.counts import ElifVisitor
module_with_one_elif = """
if 1 > 2:
...
elif 2 > 3:
...
else:
...
"""
module_with_two_elifs = """
if 1 > 2:
...
elif 2 > 3:
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_imports_counts.py | test_module_import_counts_normal | assert_* | collection | 43 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyImportedModuleMembersViolation,
TooManyImportedNamesViolation,
TooManyImportsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.imports import (
ImportMembersVisitor,
)
module_import = ''
module_with_regu... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | test_module_counts_normal | assert_* | collection | 138 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyModuleMembersViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ModuleMembersVisitor,
)
module_with_function_and_class = """
def first(): ...
class Second(object): ...
"""
module_with_function_a... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_output_length.py | test_output_length_normal | assert_* | collection | 50 | import pytest
from wemake_python_styleguide.constants import MAX_LEN_TUPLE_OUTPUT
from wemake_python_styleguide.violations.complexity import (
TooLongOutputTupleViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ReturnLikeStatementTupleVisitor,
)
RETURN_LIKE_STATEMENTS = ('retu... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_try_body_length.py | test_try_body_count_custom_options | assert_* | collection | 93 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongTryBodyViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
TryExceptVisitor,
)
try_without_except = """
try:
{0}
finally:
...
"""
simple_try_except = """
try:
{0}
except ValueError:
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_try_except.py | test_try_except_count_custom_settings | assert_* | collection | 76 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyExceptCasesViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
TryExceptVisitor,
)
try_without_except = """
try:
...
finally:
...
"""
simple_try_except = """
try:
...
except ValueError... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_tuple_unpack_length.py | test_unpack_length_normal | assert_* | collection | 48 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongTupleUnpackViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
TupleUnpackVisitor,
)
short_unpack = 'a, b = (1, 2)'
short_starred_unpack = 'a, b, *rest = (1, 2, 3, 4, 5)'
single_unpack = 'result = ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_arguments.py | test_correct_arguments_count | assert_* | collection | 22 | from wemake_python_styleguide.violations.complexity import (
TooManyArgumentsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
def test_correct_arguments_count(
assert_errors,
parse_ast_tree,
single_argument,
default_options,
m... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_arguments_lambda.py | test_correct_arguments_count | assert_* | collection | 44 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.complexity import (
TooManyArgumentsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
lambda_without_arguments = 'lambda: ...'
lambd... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_asserts_count.py | test_asserts_correct_count | assert_* | collection | 45 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyAssertsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
function_without_asserts = 'def function(): ...'
function_with_asserts = """
def function():
if some:
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_awaits_count.py | test_awaits_correct_count | assert_* | collection | 46 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyAwaitsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
function_without_awaits = 'def function(): ...'
function_async_without_awaits = 'async def function(): ...'
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_cognitive/test_cognitive_average.py | test_cognitive_average_default_options | assert_* | collection | 74 | import pytest
from wemake_python_styleguide.violations.complexity import (
CognitiveComplexityViolation,
CognitiveModuleComplexityViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
CognitiveComplexityVisitor,
)
single_item = '{0}'
multiple_items = """
def other():
...... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_cognitive/test_cognitive_score.py | test_complex_cognitive_default_options | assert_* | collection | 61 | import pytest
from wemake_python_styleguide.violations.complexity import (
CognitiveComplexityViolation,
CognitiveModuleComplexityViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
CognitiveComplexityVisitor,
)
complex_function = """
def literal_eval(node):
if isinsta... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_expressions.py | test_expressions_correct_count | assert_* | collection | 48 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyExpressionsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
function_without_expressions = """
def function():
return 1
"""
function_with_expressions = """
de... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_local_variables.py | test_locals_correct_count | assert_* | collection | 106 | import pytest
from wemake_python_styleguide.compat.constants import PY38
from wemake_python_styleguide.violations.complexity import (
TooManyLocalsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
function_with_locals = """
def function():
lo... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_raises.py | test_asserts_correct_count1 | assert_* | collection | 71 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyRaisesViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
module_many_raises = """
if some:
raise SomeException
raise SomeOtherException
"""
lambda_many_raises =... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_returns.py | test_returns_correct_count | assert_* | collection | 45 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyReturnsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
function_without_returns = 'def function(): ...'
function_with_returns = """
def function():
if 1 > 2:... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | test_regular_nodes | assert_* | collection | 83 | import pytest
from wemake_python_styleguide.violations.complexity import (
LineComplexityViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_complex_types = 'x: Dict[Tuple[str, str, int], Set... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_module_complexity.py | test_module_score | assert_* | collection | 50 | import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
JonesScoreViolation,
)
module_without_nodes = ''
module_with_nodes = """
some_value = 1 + 2
other = some_value if some_value > 2 else some_value * 8 + 34
"""
module_with_function = """
def some_function... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_classes.py | test_whitelist_nested_classes | assert_* | collection | 112 | import pytest
from wemake_python_styleguide.options.defaults import NESTED_CLASSES_WHITELIST
from wemake_python_styleguide.violations.best_practices import (
NestedClassViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NestedComplexityVisitor,
)
nested_class_in_class = """
cla... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | test_whitelist_nested_functions | assert_* | collection | 169 | import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedFunctionViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
)
nested_function_in_function = """
def container():
def {0}(): ...
"""
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | test_nested_offset | assert_* | collection | 94 | import pytest
from wemake_python_styleguide.visitors.ast.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_if2 = """
def container():
if some_value:
call_other()
"""
nested_for = """
def container():
fo... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_overuses/test_overused_expressions.py | test_class_expression_use | assert_* | collection | 196 | import pytest
from wemake_python_styleguide.violations.complexity import (
OverusedExpressionViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.overuses import (
ExpressionOveruseVisitor,
)
module_context = """
{0}
{1}
"""
function_context1 = """
def function():
{0}
{1}
"""
function_... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_overuses/test_overused_string.py | test_string_overuse_settings | assert_* | collection | 127 | import pytest
from wemake_python_styleguide.violations.complexity import (
OverusedStringViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.overuses import (
StringOveruseVisitor,
)
string_actions = """
first = {0}
second({0})
third[{0}]
'new' + {0}
{0}.join("1", "2", "3")
"""
string_function... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | test_compare_wrong_values | assert_* | collection | 85 | import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
ImplicitBoolPatternsVisitor,
)
less_or_less = '{0} < {1} or {2} < {3}'
less_or_more = '{0} < {1} or {2} > {3}'
more_or_more = '{0} > {1}... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_implicit_in.py | test_different_in_values | assert_* | collection | 44 | import pytest
from wemake_python_styleguide.violations.refactoring import (
ImplicitInConditionViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
ImplicitBoolPatternsVisitor,
)
eq_and = '{0} == some1 and {1} == some2'
noteq_or = '{0} != some1 or {1} != some2'
eq_or = '{0} == some1 or... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_multiline_conditions.py | test_correct_multiline_conditions | assert_* | collection | 80 | import pytest
from wemake_python_styleguide.violations.consistency import (
MultilineConditionsViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
incorrect_conditions1 = """if some and (
other == 1
):
...
"""
incorrect_conditions2 = """
if some or (
other == ... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_negated_conditions.py | test_negated_simple_conditions | assert_* | collection | 59 | import pytest
from wemake_python_styleguide.violations.refactoring import (
NegatedConditionsViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
if_expression = '1 if {0} else 2'
simple_conditions = """
if {0}:
...
"""
complex_elif_conditions = """
if {0}:
...
eli... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | test_regular_conditions | assert_* | collection | 31 | import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
@pytest.mark.parametrize('code', [
'some or other',
'other and some',
'first or second and th... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_simplifiable_if_statements.py | test_complex_early_returning_if | assert_* | collection | 94 | import pytest
from wemake_python_styleguide.violations.refactoring import (
SimplifiableReturningIfViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
complex_else = """
def some_function():
if some_condition:
return {0}
else:
a = 1
return {... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_unmerged_isinstance_calls.py | test_regular_isinstance_conditions | assert_* | collection | 34 | import pytest
from wemake_python_styleguide.violations.refactoring import (
UnmergedIsinstanceCallsViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
@pytest.mark.parametrize('code', [
'isinstance(some, int)',
'isinstance(some, (int, CustomType))',
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_useless_else/test_useless_if_else.py | test_else_that_can_not_be_removed1 | assert_* | collection | 166 | import pytest
from wemake_python_styleguide.violations.refactoring import (
UselessReturningElseViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import UselessElseVisitor
correct_example1 = """
def function():
if some_condition:
return None
return None
"""
correct_example2 = """... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_useless_else/test_useless_loop_else.py | test_else_that_can_not_be_removed | assert_* | collection | 124 | import pytest
from wemake_python_styleguide.violations.refactoring import (
UselessReturningElseViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import UselessElseVisitor
correct_example1 = """
def wrapper():
for x in ...:
raise ...
"""
correct_example2 = """
while ...:
raise ..... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_useless_else/test_useless_try_else.py | test_else_that_can_not_be_removed1 | assert_* | collection | 145 | import pytest
from wemake_python_styleguide.violations.refactoring import (
UselessReturningElseViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import UselessElseVisitor
correct_example1 = """
def function():
try:
...
except ...:
return None
return None
"""
correct_... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_conditions/test_useless_len_call.py | test_useful_len_call | assert_* | collection | 33 | import pytest
from wemake_python_styleguide.violations.refactoring import (
UselessLenCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
correct_call1 = 'print(len([]))'
correct_call2 = 'assert len([]) == len([])'
correct_call3 = 'if sum(x): ...'
wrong_len_call1 =... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_decorators/test_new_style_decorators.py | test_valid_decorators | assert_* | collection | 51 | import pytest
from wemake_python_styleguide.compat.constants import PY39
from wemake_python_styleguide.violations.best_practices import (
NewStyledDecoratorViolation,
)
from wemake_python_styleguide.visitors.ast.decorators import (
WrongDecoratorVisitor,
)
_reason = 'new-styled decorators appeared in 3.9'
_ma... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_exceptions/test_base_exception.py | test_use_exception | assert_* | collection | 48 | import pytest
from wemake_python_styleguide.violations.best_practices import (
BaseExceptionViolation,
)
from wemake_python_styleguide.visitors.ast.exceptions import (
WrongExceptHandlerVisitor,
)
use_base_exception = """
try:
...
except BaseException:
...
"""
use_except_exception = """
try:
...
... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.