<commit_before>import sys
import os.path

ROOT = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, ROOT)

from ropetest import testutils
from rope.contrib.codeassist import code_assist
from rope.base.project import NoProject

from snaked.util import join_to_file_dir

from snaked.plugins.python.dochints import DocStringHintProvider

def get_proposals(project, source, offset=None, **kwargs):
    head = 'from scopetest import *\n\n'
    source = head + source

    if offset is None:
        offset = len(source)
    else:
        offset += len(head)

    resource = NoProject().get_file(join_to_file_dir(__file__, 'module.py'))
    resource.read = lambda: ''

    return code_assist(project, source, offset, resource=resource, **kwargs)

def pset(proposals):
    return set(p.name for p in proposals)

def pytest_funcarg__project(request):
    project = testutils.sample_project()
    project.pycore.hintdb = DocStringHintProvider(project)
    request.addfinalizer(lambda: testutils.remove_project(project))
    return project


def test_func_param_hint(project):
    code = '''
def func(param):
    """:type param: Trololo"""
    doc_string_return().s
    param.'''
<commit_msg>removed garbage from test code<commit_after>import sys
import os.path

ROOT = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, ROOT)

from ropetest import testutils
from rope.contrib.codeassist import code_assist
from rope.base.project import NoProject

from snaked.util import join_to_file_dir

from snaked.plugins.python.dochints import DocStringHintProvider

def get_proposals(project, source, offset=None, **kwargs):
    head = 'from scopetest import *\n\n'
    source = head + source

    if offset is None:
        offset = len(source)
    else:
        offset += len(head)

    resource = NoProject().get_file(join_to_file_dir(__file__, 'module.py'))
    resource.read = lambda: ''

    return code_assist(project, source, offset, resource=resource, **kwargs)

def pset(proposals):
    return set(p.name for p in proposals)

def pytest_funcarg__project(request):
    project = testutils.sample_project()
    project.pycore.hintdb = DocStringHintProvider(project)
    request.addfinalizer(lambda: testutils.remove_project(project))
    return project


def test_func_param_hint(project):
    code = '''
def func(param):
    """:type param: Trololo"""
    param.'''

{'fraction_non_alphanumeric': 0.1064366848969289, 'fraction_numerical': 0.0008413967185527977, 'mean_word_length': 4.367945823927765, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2817398', 'n_tokens_mistral': 758, 'n_tokens_neox': 748, 'n_words': 181}