<commit_before>#!/usr/bin/env python
from pyvisdk.base.managed_object_types import ManagedObjectTypes
from pyvisdk.mo.datacenter import Datacenter
from pyvisdk.mo.host_system import HostSystem
from pyvisdk.mo.virtual_machine import VirtualMachine
import logging
import pyvisdk.core

#
# Assumptions:  Must connect to the vSphere vCenter
#               Must be version 4.0 or greater
# 

log = logging.getLogger(__name__)

class Vim(pyvisdk.core.VimBase):
    def __init__(self, server, connect=True, verbose=3):
        super(Vim, self).__init__(server, connect, verbose)
        self.loggedin = False
        self.username = None
        self.password = <PASSWORD>
        
    def login(self, username, password, locale=None):
        """
        Log into the vmware server.
        """
        self.username = username
        self.password = password
        
        if not locale:
            if hasattr(self.session_manager, 'defaultLocale'):
                locale = self.session_manager.defaultLocale
            else:
                locale = 'en_US'
        
        if self.verbose > 5:
            self.displayAbout()

        self.session_manager.Login(self.username, self.password, locale)
        if self.verbose > 2:
            log.info("Successfully logged into %s" % self.client.url)
        self.loggedin = True

    def logout(self):
        """
        Log out of the vmware server.
        """
        self.session_manager.Logout(self.username, self.password)
        self.loggedin = False

    def relogin(self):
        """
        Re-logs in to the vmware server.<commit_msg>Logout shouldn't take any arguments... doh<commit_after>#!/usr/bin/env python
from pyvisdk.base.managed_object_types import ManagedObjectTypes
from pyvisdk.mo.datacenter import Datacenter
from pyvisdk.mo.host_system import HostSystem
from pyvisdk.mo.virtual_machine import VirtualMachine
import logging
import pyvisdk.core

#
# Assumptions:  Must connect to the vSphere vCenter
#               Must be version 4.0 or greater
# 

log = logging.getLogger(__name__)

class Vim(pyvisdk.core.VimBase):
    def __init__(self, server, connect=True, verbose=3):
        super(Vim, self).__init__(server, connect, verbose)
        self.loggedin = False
        self.username = None
        self.password = <PASSWORD>
        
    def login(self, username, password, locale=None):
        """
        Log into the vmware server.
        """
        self.username = username
        self.password = password
        
        if not locale:
            if hasattr(self.session_manager, 'defaultLocale'):
                locale = self.session_manager.defaultLocale
            else:
                locale = 'en_US'
        
        if self.verbose > 5:
            self.displayAbout()

        self.session_manager.Login(self.username, self.password, locale)
        if self.verbose > 2:
            log.info("Successfully logged into %s" % self.client.url)
        self.loggedin = True

    def logout(self):
        """
        Log out of the vmware server.
        """
        self.session_manager.Logout()
        self.loggedin = False

    def relogin(self):
        """
        Re-logs in to the vmware server.
{'fraction_non_alphanumeric': 0.09011537262238853, 'fraction_numerical': 0.0031181789834736516, 'mean_word_length': 2.2208835341365463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1301520', 'n_tokens_mistral': 936, 'n_tokens_neox': 910, 'n_words': 235}