<commit_before>import { User } from "../models/index";

interface IUserService {
    saveUser(user: User): ng.IPromise<User>;
}

class UserService implements IUserService {
    public static serviceName: string = "UserService";
    public static $inject: Array<string> = ["$timeout"];

    constructor(private $timeout: ng.ITimeoutService) {}

    public saveUser(user: User): ng.IPromise<User> {
        return this.$timeout(() => new User(user.id, user.name), 3000);
    }
}

export { IUserService, UserService };<commit_msg>refactor(UserService): add NotificationService deps, extract save logic to simulateSave method<commit_after>import { User } from "../models/index";

import { INotificationService, NotificationService } from "../../shared/index";

interface IUserService {
    saveUser(user: User): ng.IPromise<User>;
}

class UserService implements IUserService {
    public static serviceName: string = "UserService";
    public static $inject: Array<string> = ["$timeout", NotificationService.serviceName];

    constructor(
        private $timeout: ng.ITimeoutService,
        private notificationService: INotificationService
    ) {}

    public saveUser(user: User): ng.IPromise<User> {
        return this.$timeout(() => this.simulateSave(user), 3000);
    }

    private simulateSave(user: User): User {
        this.notificationService.showSuccess(`User ${user.name} successfully saved`);
        return new User(user.id, user.name);
    }
}

export { IUserService, UserService };
{'fraction_non_alphanumeric': 0.128, 'fraction_numerical': 0.005333333333333333, 'mean_word_length': 4.158075601374571, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6180349', 'n_tokens_mistral': 425, 'n_tokens_neox': 414, 'n_words': 107}