<commit_before>import requests

import jobs


class Sauce(object):

    def __init__(self, sauce_user, sauce_key):
        self.user = sauce_user
        self.key = sauce_key
        self.jobs = jobs.Jobs(self)
        self.base_url = 'https://{0}:{1}@saucelabs.com'.format(
            self.user, self.key)

    def request(self, method, rel_url, data=None, params=None):
        url = self.base_url + rel_url
        resp = requests.request(method, url, data=data, params=params)
        resp.raise_for_status()
        return resp.json()

    def download(self, rel_url):
        url = self.base_url + rel_url
        resp = requests.get(url)
        resp.raise_for_status()
        return resp.content
<commit_msg>Add temporary storage upload<commit_after>import os

import requests

import jobs


class Sauce(object):

    def __init__(self, sauce_user, sauce_key):
        self.user = sauce_user
        self.key = sauce_key
        self.jobs = jobs.Jobs(self)
        self.base_url = 'https://{0}:{1}@saucelabs.com'.format(
            self.user, self.key)

    def request(self, method, rel_url, data=None, params=None):
        url = self.base_url + rel_url
        resp = requests.request(method, url, data=data, params=params)
        resp.raise_for_status()
        return resp.json()

    def download(self, rel_url):
        url = self.base_url + rel_url
        resp = requests.get(url)
        resp.raise_for_status()
        return resp.content

    def upload_file(self, user_file, dest_file=None, overwrite=False):
        """
        Uploads a file to sauce's temporary storage.

        Args:
          user_file: relative or absolute path to the file to upload to sauce.
          dest_file: filename to use in sauce's system.
          overwrite: whether the file in sauce's system should be overwritten.

        Returns:
          None
        """
        if not dest_file:
            file_name = os.path.basename(user_file)
        url = self.base_url + '/storage/{0}/{1}'.format(self.user, file_name)
        user_file_path = os.path.abspath(user_file)
        with open(user_file_path) as upload_data:
            headers = {'Content-Type': 'application/octet-stream'}
            requests.post(url, data=upload_data, headers=headers)

{'fraction_non_alphanumeric': 0.10556537102473498, 'fraction_numerical': 0.00265017667844523, 'mean_word_length': 2.4422492401215807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6293011', 'n_tokens_mistral': 708, 'n_tokens_neox': 687, 'n_words': 166}