<commit_before>//
//  Perfect.swift
//  PerfectLib
//
//  Created by <NAME> on 7/5/15.
//	Copyright (C) 2015 PerfectlySoft, Inc.
//
//===----------------------------------------------------------------------===//
//
// This source file is part of the Perfect.org open source project
//
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors
// Licensed under Apache License v2.0
//
// See http://perfect.org/licensing.html for license information
//
//===----------------------------------------------------------------------===//
//

#if os(Linux)
    import SwiftGlibc
#else
    import Darwin
#endif

/// Provides access to various system level features for the process.
/// A static instance of this class is created at startup and all access to this object go through the `PerfectServer.staticPerfectServer` static property.
public struct PerfectServer {
    /// Switch the current process to run with the permissions of the indicated user
    public static func switchTo(userName unam: String) throws {
        guard let pw = getpwnam(unam) else {
            try ThrowSystemError()
        }
        let gid = pw.pointee.pw_gid
        let uid = pw.pointee.pw_uid
        guard 0 == setgid(gid) else {
            try ThrowSystemError()
        }
        guard 0 == setuid(uid) else {
            try ThrowSystemError()
        }
    }
}
<commit_msg>Re-added initializeServices for compat<commit_after>//
//  Perfect.swift
//  PerfectLib
//
//  Created by <NAME> on 7/5/15.
//	Copyright (C) 2015 PerfectlySoft, Inc.
//
//===----------------------------------------------------------------------===//
//
// This source file is part of the Perfect.org open source project
//
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors
// Licensed under Apache License v2.0
//
// See http://perfect.org/licensing.html for license information
//
//===----------------------------------------------------------------------===//
//

#if os(Linux)
    import SwiftGlibc
#else
    import Darwin
#endif

/// Provides access to various system level features for the process.
/// A static instance of this class is created at startup and all access to this object go through the `PerfectServer.staticPerfectServer` static property.
public struct PerfectServer {
	
	@available(*, deprecated, message: "No longer required to call this")
	public func initializeServices() {
	
	}
	
    /// Switch the current process to run with the permissions of the indicated user
    public static func switchTo(userName unam: String) throws {
        guard let pw = getpwnam(unam) else {
            try ThrowSystemError()
        }
        let gid = pw.pointee.pw_gid
        let uid = pw.pointee.pw_uid
        guard 0 == setgid(gid) else {
            try ThrowSystemError()
        }
        guard 0 == setuid(uid) else {
            try ThrowSystemError()
        }
    }
}

{'fraction_non_alphanumeric': 0.1922149500516707, 'fraction_numerical': 0.013778849466069583, 'mean_word_length': 1.803088803088803, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '114861', 'n_tokens_mistral': 801, 'n_tokens_neox': 741, 'n_words': 281}