<commit_before>package com.metacodestudio.hotsuploader.providers;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3Client;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.metacodestudio.hotsuploader.files.ReplayFile;
import com.metacodestudio.hotsuploader.files.Status;

import java.io.IOException;
import java.util.UUID;

public class HotSLogs extends Provider {

    public static final String ACCESS_KEY_ID = "<KEY>";
    public static final String SECRET_ACCESS_KEY = "<KEY>";
    private final AmazonS3Client s3Client;
    private final HttpRequestFactory requestFactory;
    private long maintenance;

    public HotSLogs() {
        super("HotSLogs.com");
        final NetHttpTransport client = new NetHttpTransport();
        requestFactory = client.createRequestFactory();
        final AWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
        s3Client = new AmazonS3Client(credentials);
    }

    @Override
    public Status upload(final ReplayFile replayFile) {
        if (isMaintenance()) {
            return null;
        }
        if (replayFile.getStatus() == Status.UPLOADED) {
            return replayFile.getStatus();
        }
        String fileName = UUID.randomUUID() + ".StormReplay";
        s3Client.putObject("heroesreplays", fileName, replayFile.getFile());

        try {
            String uri = "https://www.hotslogs.com/UploadFile.aspx?FileName=" + fileName;
            HttpResponse get = requestFactory.buildGetRequest(new GenericUrl(uri)).execute();
            String result = get.parseAsString();
            switch (result) {
                case "Duplicate":
                case "Success":
                    return Status.UPLOADED;
                case "Exception":
                    return Status.EXCEPTION;
                case "Maintenance":
                    maintenance = System.currentTimeMillis();
                    return null;
                default:
                    return Status.EXCEPTION;
            }

        } catch (IOException e) {
            e.printStackTrace();
            return Status.EXCEPTION;
        }

    }

    public boolean isMaintenance() {
        return maintenance + 6000000L > System.currentTimeMillis();
    }<commit_msg>hotslogs-provider: make maintenance check static<commit_after>package com.metacodestudio.hotsuploader.providers;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3Client;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.metacodestudio.hotsuploader.files.ReplayFile;
import com.metacodestudio.hotsuploader.files.Status;

import java.io.IOException;
import java.util.UUID;

public class HotSLogs extends Provider {

    public static final String ACCESS_KEY_ID = "<KEY>";
    public static final String SECRET_ACCESS_KEY = "<KEY>";
    private final AmazonS3Client s3Client;
    private final HttpRequestFactory requestFactory;
    private static long maintenance;

    public HotSLogs() {
        super("HotSLogs.com");
        final NetHttpTransport client = new NetHttpTransport();
        requestFactory = client.createRequestFactory();
        final AWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
        s3Client = new AmazonS3Client(credentials);
    }

    @Override
    public Status upload(final ReplayFile replayFile) {
        if (isMaintenance()) {
            return null;
        }
        if (replayFile.getStatus() == Status.UPLOADED) {
            return replayFile.getStatus();
        }
        String fileName = UUID.randomUUID() + ".StormReplay";
        s3Client.putObject("heroesreplays", fileName, replayFile.getFile());

        try {
            String uri = "https://www.hotslogs.com/UploadFile.aspx?FileName=" + fileName;
            HttpResponse get = requestFactory.buildGetRequest(new GenericUrl(uri)).execute();
            String result = get.parseAsString();
            switch (result) {
                case "Duplicate":
                case "Success":
                    return Status.UPLOADED;
                case "Exception":
                    return Status.EXCEPTION;
                case "Maintenance":
                    maintenance = System.currentTimeMillis();
                    return null;
                default:
                    return Status.EXCEPTION;
            }

        } catch (IOException e) {
            e.printStackTrace();
            return Status.EXCEPTION;
        }

    }

    public static boolean isMaintenance() {
        return maintenance + 6000000L > System.currentTimeMillis();
    }
{'fraction_non_alphanumeric': 0.09157292283402407, 'fraction_numerical': 0.005525952239984212, 'mean_word_length': 2.558988764044944, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '2405557', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1357, 'n_words': 284}