<commit_before>import os
import time

import subprocess

from django.conf import settings
from selenium import webdriver

from core.web.ofm_page_constants import Constants


class SiteManager:
    def __init__(self, user=None):
        self.browser = webdriver.PhantomJS()

        self._handle_aws_display_bug()

        if user:
            self._login_user = user.ofm_username
            self._login_password = <PASSWORD>
        else:
            self._login_user = os.environ('OFM_USERNAME')
            self._login_password = os.environ('OFM_PASSWORD')

    def login(self):
        self.browser.get(Constants.LOGIN)
        self._switch_to_login_div()

        self._insert_login_credentials()
        self._click_login_button()

    def jump_to_frame(self, frame):
        self.browser.get(frame)

    def kill(self):
        KILL_CMD = "ps -ef | grep phantomjs | grep -v grep | awk '{print $2}' | xargs kill"

        self.browser.stop_client()
        self.browser.close()
        self.browser.quit()
        
        subprocess.Popen(KILL_CMD, shell=True).communicate()

    def _handle_aws_display_bug(self):<commit_msg>do not kill phantom processes in docker environment<commit_after>import os
import time

import subprocess

from django.conf import settings
from selenium import webdriver

from core.web.ofm_page_constants import Constants


class SiteManager:
    def __init__(self, user=None):
        self.browser = webdriver.PhantomJS()

        self._handle_aws_display_bug()

        if user:
            self._login_user = user.ofm_username
            self._login_password = <PASSWORD>
        else:
            self._login_user = os.environ('OFM_USERNAME')
            self._login_password = os.environ('OF<PASSWORD>')

    def login(self):
        self.browser.get(Constants.LOGIN)
        self._switch_to_login_div()

        self._insert_login_credentials()
        self._click_login_button()

    def jump_to_frame(self, frame):
        self.browser.get(frame)

    def kill(self):
        self.browser.stop_client()
        self.browser.close()
        self.browser.quit()

    def _handle_aws_display_bug(self):
{'fraction_non_alphanumeric': 0.09154600653900047, 'fraction_numerical': 0.00046707146193367583, 'mean_word_length': 2.693103448275862, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '2452807', 'n_tokens_mistral': 665, 'n_tokens_neox': 637, 'n_words': 129}