<commit_before>import ConfigParser
import os
import argparse
from grouper_ws import GrouperWS

parser = argparse.ArgumentParser(description='List the members of a group', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('group_name', help='is the name of the group including stems, e.g duke:gcb:security:admins')
parser.add_argument('--config', help='location of the config file', default=os.path.expanduser('~/.grouper_script.cfg'))
args = parser.parse_args()

config = ConfigParser.ConfigParser()
config.readfp(open(args.config))

ws_config = dict(config.items('GrouperWebServices'))
ws = GrouperWS(ws_config['base_url'], ws_config['account_id'], ws_config['account_password'])

for member in ws.group_members(args.group_name):
  print member['id'], member['name']<commit_msg>Pulling down the user netids via LDAP<commit_after>import ConfigParser
import os
import argparse
from grouper_ws import GrouperWS
import ldap

parser = argparse.ArgumentParser(description='List the members of a group', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('group_name', help='is the name of the group including stems, e.g duke:gcb:security:admins')
parser.add_argument('--config', help='location of the config file', default=os.path.expanduser('~/.grouper_script.cfg'))
args = parser.parse_args()

config = ConfigParser.ConfigParser()
config.readfp(open(args.config))

ws_config = dict(config.items('GrouperWebServices'))
ws = GrouperWS(ws_config['base_url'], ws_config['account_id'], ws_config['account_password'])

duke_ldap = ldap.open("ldap.duke.edu")
for member in ws.group_members(args.group_name):
  r = duke_ldap.search("dc=duke,dc=edu", ldap.SCOPE_SUBTREE, "duDukeID="+member['id'], ['uid'])
  ldap_result = duke_ldap.result(r,0)
  if ldap_result[0] == 100:
    print '{0}:{1}:{2}'.format(member['id'], ldap_result[1][0][1]['uid'][0], member['name'])
  else:
    print ":("
{'fraction_non_alphanumeric': 0.14537902388369678, 'fraction_numerical': 0.006230529595015576, 'mean_word_length': 7.921296296296297, 'pattern_counts': {'":': 1, '<': 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': '6461869', 'n_tokens_mistral': 651, 'n_tokens_neox': 631, 'n_words': 130}