<commit_before>import os
import sys
import luigi

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from controllers.ApiController import ApiController


class SubmissionTarget(luigi.target.Target):
    def __init__(self, path, email, password):
        self.path = path
        self.fn = os.path.split(path)[1]
        self.apic = ApiController()
        self.auth = self.apic.login(email, password)
        self.username = self.auth['username']

    def exists(self):
        subs = self.apic.fetch_submissions()

        for s in subs['submissions']:
            if s['filename'] == self.fn:
                return True

        return False

    def submit(self):
        raise NotImplementedError<commit_msg>Completed method<commit_after>import os
import sys
import luigi

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from controllers.ApiController import ApiController


class SubmissionTarget(luigi.target.Target):
    def __init__(self, path, email, password):
        self.path = path
        self.fn = os.path.split(path)[1]
        self.apic = ApiController()
        self.auth = self.apic.login(email, password)
        self.username = self.auth['username']

    def exists(self):
        subs = self.apic.fetch_submissions()

        for s in subs['submissions']:
            if s['filename'] == self.fn:
                return True

        return False

    def submit(self):
        self.apic.upload_submission(self.path)
{'fraction_non_alphanumeric': 0.11415220293724966, 'fraction_numerical': 0.0013351134846461949, 'mean_word_length': 2.7475, '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': '218655', 'n_tokens_mistral': 457, 'n_tokens_neox': 444, 'n_words': 95}