<commit_before>from yapsy.IPlugin import IPlugin

class Form_Checker(IPlugin):
    def __init__(self):
        self.database = None

    def setDb(self, DB):
        self.database = DB

    def check(self, transactionId, content):
        pass

    def getId(self):
        return "formChecker"<commit_msg>Basic information retrieval<commit_after>from yapsy.IPlugin import IPlugin
from bs4 import BeautifulSoup
import urlparse

class Form_Checker(IPlugin):
    def __init__(self):
        self.database = None

    def setDb(self, DB):
        self.database = DB

    def check(self, transactionId, content):
        soup = BeautifulSoup(content, 'html.parser')
        forms = soup.find_all('form')
        for form in forms:
            self.check_form(form, transactionId)

    def check_form(self, form, transactionId):
        method = self.get_method(form)
        action = self.get_action(form, transactionId)

    def get_method(self, form):
        if 'method' in form.attrs:
            return form['method'].to_lower()
        else:
            return 'get'

    def get_action(self, form, transactionId): 
        base = self.database.getUri(transactionId)
        if 'action' in form.attrs:
            return urlparse.urljoin(base, form['action'])
        else:
            return base

    def getId(self):
        return "formChecker"
{'fraction_non_alphanumeric': 0.09555555555555556, 'fraction_numerical': 0.0007407407407407407, 'mean_word_length': 2.555263157894737, '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': '7130834', 'n_tokens_mistral': 397, 'n_tokens_neox': 393, 'n_words': 102}