<commit_before>package com.github.mobile.android;

import static com.github.mobile.android.authenticator.Constants.GITHUB_ACCOUNT_TYPE;
import android.accounts.Account;
import android.accounts.AccountManager;

import com.github.kevinsawicki.http.HttpRequest;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;

import java.io.IOException;

import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
import org.eclipse.egit.github.core.client.PagedRequest;
import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.egit.github.core.service.IssueService;
import org.eclipse.egit.github.core.service.OrganizationService;
import org.eclipse.egit.github.core.service.PullRequestService;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.egit.github.core.service.UserService;

/**
 * Main module provide services and clients
 */
public class GitHubModule extends AbstractModule {

    @Override
    protected void configure() {
        HttpRequest.keepAlive(false);
    }

    @Provides
    Account currentAccount(AccountManager accountManager) {
        Account[] accounts = accountManager.getAccountsByType(GITHUB_ACCOUNT_TYPE);
        if (accounts.length > 0) {
            return accounts[0]; // at some point, support more than one github
            // account, ie vanilla and fi
        }
        return null;
    }

    @Provides
    GitHubClient client(Account account, AccountManager accountManager) {
        GitHubClient client = new GitHubClient();
        if (account != null)
            client.setCredentials(account.name, accountManager.getPassword(account));
        return client;
    }

    @Provides
    IssueService issueService(GitHubClient client) {
        return new IssueService(client);
    }

    @Provides
    PullRequestService pullRequestService(GitHubClient client) {
        return new PullRequestService(client);
    }

    @Provides
    UserService userService(GitHubClient client) {
        return new UserService(client);
    }

    @Provides
    GistService gistService(GitHubClient client) {
        return new GistService(client) {

            protected GitHubRequest createRequest() {
                GitHubRequest request = super.createRequest();
                request.setResponseContentType(ACCEPT_HTML);
                return request;<commit_msg>Request issue body/comments as HTML<commit_after>package com.github.mobile.android;

import static com.github.mobile.android.authenticator.Constants.GITHUB_ACCOUNT_TYPE;
import android.accounts.Account;
import android.accounts.AccountManager;

import com.github.kevinsawicki.http.HttpRequest;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;

import java.io.IOException;

import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
import org.eclipse.egit.github.core.client.PagedRequest;
import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.egit.github.core.service.IssueService;
import org.eclipse.egit.github.core.service.OrganizationService;
import org.eclipse.egit.github.core.service.PullRequestService;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.egit.github.core.service.UserService;

/**
 * Main module provide services and clients
 */
public class GitHubModule extends AbstractModule {

    @Override
    protected void configure() {
        HttpRequest.keepAlive(false);
    }

    @Provides
    Account currentAccount(AccountManager accountManager) {
        Account[] accounts = accountManager.getAccountsByType(GITHUB_ACCOUNT_TYPE);
        if (accounts.length > 0) {
            return accounts[0]; // at some point, support more than one github
            // account, ie vanilla and fi
        }
        return null;
    }

    @Provides
    GitHubClient client(Account account, AccountManager accountManager) {
        GitHubClient client = new GitHubClient();
        if (account != null)
            client.setCredentials(account.name, accountManager.getPassword(account));
        return client;
    }

    @Provides
    IssueService issueService(GitHubClient client) {
        return new IssueService(client) {

            protected GitHubRequest createRequest() {
                GitHubRequest request = super.createRequest();
                request.setResponseContentType(ACCEPT_HTML);
                return request;
            }

            protected <V> PagedRequest<V> createPagedRequest(int start, int size) {
                PagedRequest<V> request = super.createPagedRequest(start, size);
                request.setResponseContentType(ACCEPT_HTML);
                return request;
            }
        };
    }

    @Provides
    PullRequestService pullRequestService(GitHubClient client) {
        return new PullRequestService(client);
    }

    @Provides
    UserService userService(GitHubClient client) {
        return new UserService(client);
    }

    @Provides
    GistService gistService(GitHubClient client) {
        return new GistService(client) {

            protected GitHubRequest createRequest() {
                GitHubRequest request = super.createRequest();
                request.setResponseContentType(ACCEPT_HTML);
                return request;
{'fraction_non_alphanumeric': 0.08666178087211433, 'fraction_numerical': 0.0007328691828508611, 'mean_word_length': 3.2416472416472417, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '7393417', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1447, 'n_words': 294}