<commit_before>#!/usr/bin/env python

import clitool

def listvb(mc):
    vbs = mc.stats('vbucket')
    for (vb, state) in sorted(list(vbs.items())):
        print "vbucket", vb[3:], state

if __name__ == '__main__':

    c = clitool.CliTool()

    c.addCommand('list', listvb)
    c.addCommand('set', 'set_vbucket_state', 'set [vbid] [vbstate]')
    c.addCommand('rm', 'delete_vbucket', 'rm [vbid]')

    c.execute()<commit_msg>bug 1988 - added optional sasl auth<commit_after>#!/usr/bin/env python

import clitool

def listvb(mc,auth="none",username="",password=""):
    if auth == "sasl":
        mc.sasl_auth_plain(username,password)
    vbs = mc.stats('vbucket')
    for (vb, state) in sorted(list(vbs.items())):
        print "vbucket", vb[3:], state

def setvb(mc,vbid,vbstate,auth="none",username="",password=""):
    if auth == "sasl":
        mc.sasl_auth_plain(username,password)
    mc.set_vbucket_state(vbid,vbstate)

def rmvb(mc,vbid,auth="none",username="",password=""):
    if auth == "sasl":
        mc.sasl_auth_plain(username,password)
    mc.delete_vbucket(vbid)

if __name__ == '__main__':

    c = clitool.CliTool()

    c.addCommand('list', listvb, 'list sasl [username] [password]')
    c.addCommand('set', setvb, 'set [vbid] [vbstate] sasl [username] [password]')
    c.addCommand('rm', rmvb, 'rm [vbid] sasl [username] [password]')

    c.execute()
{'fraction_non_alphanumeric': 0.1841339155749636, 'fraction_numerical': 0.004366812227074236, 'mean_word_length': 4.169172932330827, 'pattern_counts': {'":': 3, '<': 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': '5252622', 'n_tokens_mistral': 548, 'n_tokens_neox': 526, 'n_words': 100}