<commit_before>#pylint: disable=C0111
#pylint: disable=W0621

from lettuce import world, step
from django.conf import settings
import requests
import string
import random
import os

TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
HTTP_PREFIX = "http://localhost:8001"


@step(u'I go to the files and uploads page')
def go_to_uploads(_step):
    menu_css = 'li.nav-course-courseware'
    uploads_css = 'li.nav-course-courseware-uploads'
    world.css_click(menu_css)
    world.css_click(uploads_css)


@step(u'I upload the file "([^"]*)"$')
def upload_file(_step, file_name):
    upload_css = 'a.upload-button'
    world.css_click(upload_css)

    file_css = 'input.file-input'
    upload = world.css_click(file_css)
    #uploading the file itself
    path = os.path.join(TEST_ROOT, 'uploads/', file_name)
    upload._element.send_keys(os.path.abspath(path))

    close_css = 'a.close-button'
    world.css_click(close_css)


@step(u'I should( not)? see the file "([^"]*)" was uploaded$')
def check_upload(_step, do_not_see_file, file_name):
    index = get_index(file_name)
    if do_not_see_file:
        assert index == -1
    else:
        assert index != -1


@step(u'The url for the file "([^"]*)" is valid$')
def check_url(_step, file_name):
    r = get_file(file_name)
    assert r.status_code == 200


@step(u'I delete the file "([^"]*)"$')<commit_msg>Overzealous changing of find to click<commit_after>#pylint: disable=C0111
#pylint: disable=W0621

from lettuce import world, step
from django.conf import settings
import requests
import string
import random
import os

TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
HTTP_PREFIX = "http://localhost:8001"


@step(u'I go to the files and uploads page')
def go_to_uploads(_step):
    menu_css = 'li.nav-course-courseware'
    uploads_css = 'li.nav-course-courseware-uploads'
    world.css_click(menu_css)
    world.css_click(uploads_css)


@step(u'I upload the file "([^"]*)"$')
def upload_file(_step, file_name):
    upload_css = 'a.upload-button'
    world.css_click(upload_css)

    file_css = 'input.file-input'
    upload = world.css_find(file_css)
    #uploading the file itself
    path = os.path.join(TEST_ROOT, 'uploads/', file_name)
    upload._element.send_keys(os.path.abspath(path))

    close_css = 'a.close-button'
    world.css_click(close_css)


@step(u'I should( not)? see the file "([^"]*)" was uploaded$')
def check_upload(_step, do_not_see_file, file_name):
    index = get_index(file_name)
    if do_not_see_file:
        assert index == -1
    else:
        assert index != -1


@step(u'The url for the file "([^"]*)" is valid$')
def check_url(_step, file_name):
    r = get_file(file_name)
    assert r.status_code == 200


@step(u'I delete the file "([^"]*)"$')
{'fraction_non_alphanumeric': 0.13465056714233442, 'fraction_numerical': 0.012440541529454811, 'mean_word_length': 4.197718631178708, 'pattern_counts': {'":': 0, '<': 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': '6262848', 'n_tokens_mistral': 1028, 'n_tokens_neox': 977, 'n_words': 223}