<commit_before>from flask import Flask
from flask import request
import json
import copy
import logging
import os

import arrow
import requests

app = Flask(__name__)

drone_url = 'http://localhost:8000'
if 'DRONE_URL' in os.environ:
    drone_url = os.environ['DRONE_URL']

@app.route('/hook', methods=['POST'])
def payload():
        # print(request.content_type)
        # print(str(request.form))
        try:
            payload = json.loads(request.form.get('payload'))
            commits = payload['commits']
            drone_modified = False
            new_commits = {}
            for commit in commits:
                modified_container = []
                modified_commits = []
                updated = False
                for modified in commit['added']:
                    if modified.startswith('.drone.yml'):
                        drone_modified = True
                    container_path = '/'.join(modified.split('/')[:-1])
                    if container_path and container_path not in modified_container:
                        modified_container.append(container_path + '/Dockerfile')
                        updated = True
                for modified in commit['modified']:
                    if modified.startswith('.drone.yml'):
                        drone_modified = True
                    container_path = '/'.join(modified.split('/')[:-1])
                    if container_path and container_path not in modified_container:
                        modified_container.append(container_path + '/Dockerfile')
                        updated = True
                if updated:
                    modified_commits.append(commit['id'])
                for modif in modified_container:
                    commit['added'] = []
                    commit['modified'] = [modif]
                    commit['removed'] = []
                    commit['message'] = container_dir + ':' + commit['message']<commit_msg>do not build for ci modifications<commit_after>from flask import Flask
from flask import request
import json
import copy
import logging
import os

import arrow
import requests

app = Flask(__name__)

drone_url = 'http://localhost:8000'
if 'DRONE_URL' in os.environ:
    drone_url = os.environ['DRONE_URL']

@app.route('/ping', methods=['GET'])
def ping():
    return "pong"

@app.route('/hook', methods=['POST'])
def payload():
        # print(request.content_type)
        # print(str(request.form))
        try:
            payload = json.loads(request.form.get('payload'))
            commits = payload['commits']
            drone_modified = False
            new_commits = {}
            for commit in commits:
                modified_container = []
                modified_commits = []
                updated = False
                for modified in commit['added']:
                    if modified.startswith('ci'):
                        continue
                    if modified.startswith('.drone.yml'):
                        drone_modified = True
                    container_path = '/'.join(modified.split('/')[:-1])
                    if container_path and container_path not in modified_container:
                        modified_container.append(container_path + '/Dockerfile')
                        updated = True
                for modified in commit['modified']:
                    if modified.startswith('ci'):
                        continue
                    if modified.startswith('.drone.yml'):
                        drone_modified = True
                    container_path = '/'.join(modified.split('/')[:-1])
                    if container_path and container_path not in modified_container:
                        modified_container.append(container_path + '/Dockerfile')
                        updated = True
                if updated:
                    modified_commits.append(commit['id'])
                for modif in modified_container:
                    commit['added'] = []
                    commit['modified'] = [modif]
                    commit['removed'] = []
                    commit['message'] = container_dir + ':' + commit['message']
{'fraction_non_alphanumeric': 0.10409638554216867, 'fraction_numerical': 0.002891566265060241, 'mean_word_length': 1.605775266792216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5966881', 'n_tokens_mistral': 1034, 'n_tokens_neox': 972, 'n_words': 232}