<commit_before>__author__ = 'wenju'

from oss import oss_api
import service_config
import time

bucket_name = "simage"
#oss_host="oss-cn-beijing.aliyuncs.com"
oss_host="oss-cn-beijing-internal.aliyuncs.com"
appid="MKD6WfLZOSq03lKl"
appkey="<KEY>"

config = service_config.config

def upload_file_to_oss(target_path,local_file_path):
        oss = oss_api.OssAPI(oss_host,appid,appkey)
        fmt = "%a, %d %b %Y %H:%M%S GMT"
        gmt_string = time.strftime(fmt,time.gmtime(time.time()+config.img_ttl))
        header={'Expires': gmt_string}
        oss_resp = oss.put_object_from_file(bucket_name,target_path,local_file_path, content_type='image/jpeg',headers=header)
        if oss_resp.status != 200:
            raise Exception(oss_resp.read())

def delete_from_oss(object_path):

        oss = oss_api.OssAPI(oss_host,appid,appkey)
        oss_resp = oss.delete_object(bucket_name,object_path)
        if oss_resp.status != 204:
            raise Exception(oss_resp.read())<commit_msg>removed some items<commit_after>__author__ = 'wenju'

from oss import oss_api
import service_config
import time

#the part has been moved due to security reasons.

config = service_config.config

def upload_file_to_oss(target_path,local_file_path):
        oss = oss_api.OssAPI(oss_host,appid,appkey)
        fmt = "%a, %d %b %Y %H:%M%S GMT"
        gmt_string = time.strftime(fmt,time.gmtime(time.time()+config.img_ttl))
        header={'Expires': gmt_string}
        oss_resp = oss.put_object_from_file(bucket_name,target_path,local_file_path, content_type='image/jpeg',headers=header)
        if oss_resp.status != 200:
            raise Exception(oss_resp.read())

def delete_from_oss(object_path):

        oss = oss_api.OssAPI(oss_host,appid,appkey)
        oss_resp = oss.delete_object(bucket_name,object_path)
        if oss_resp.status != 204:
            raise Exception(oss_resp.read())
{'fraction_non_alphanumeric': 0.11481481481481481, 'fraction_numerical': 0.007936507936507936, 'mean_word_length': 4.097035040431267, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2756957', 'n_tokens_mistral': 718, 'n_tokens_neox': 671, 'n_words': 108}