<commit_before>import grp
import os
import posix1e
import pwd

from datastage.config import settings

def get_name(username):
    return pwd.getpwnam(username).pw_gecos.split(',')[0]

def sync_permissions():
    leaders = set(grp.getgrnam('datastage-leader').gr_mem)
    members = set(grp.getgrnam('datastage-member').gr_mem)
    collabs = set(grp.getgrnam('datastage-collaborator').gr_mem)

    data_directory = settings.DATA_DIRECTORY
    
    datastage_user = pwd.getpwnam(settings.get('main:datastage_user'))

    for user in leaders | members:
        for name in ('private', 'shared', 'collab'):<commit_msg>sync_permissions now makes sure that group leaders are superusers.<commit_after>import grp
import os
import posix1e
import pwd

from django.contrib.auth.models import User

from datastage.config import settings

def get_name(username):
    return pwd.getpwnam(username).pw_gecos.split(',')[0]

def sync_permissions():
    leaders = set(grp.getgrnam('datastage-leader').gr_mem)
    members = set(grp.getgrnam('datastage-member').gr_mem)
    collabs = set(grp.getgrnam('datastage-collaborator').gr_mem)

    data_directory = settings.DATA_DIRECTORY
    
    datastage_user = pwd.getpwnam(settings.get('main:datastage_user'))

    # Force leaders to be superusers
    for user in User.objects.all():
        user.is_staff = user.is_superuser = user.username in leaders
        user.save()

    for user in leaders | members:
        for name in ('private', 'shared', 'collab'):
{'fraction_non_alphanumeric': 0.11566913248150638, 'fraction_numerical': 0.0026899798251513113, 'mean_word_length': 4.333333333333333, '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': '1767629', 'n_tokens_mistral': 500, 'n_tokens_neox': 500, 'n_words': 104}