<commit_before># -*- coding: utf-8 -*-
from fabric.api import *
from fabric.contrib.files import exists
from datetime import datetime
import re
import os

def getisotime():
    """Convenience method to get current UTC time in yyyymmddhhmm format"""
    ct = datetime.utcnow()
    return ct.strftime("%Y%m%d%H%M")

@task
def uname():
    """Show kernel version"""
    run("uname -a")

@task
def df():
    """Check available disk space"""
    run("df -h")

@task
def install_sudo():
    """Install sudo, if it's not present"""
    import vars
    vars = vars.Vars()
    with settings(warn_only=True):
        if run("which sudo").failed:
            run(vars.os.package_install_cmd % "sudo")

@task
def put_and_chown(localfile, remotefile, mode="0644", owner="root", group="root", overwrite=True):
    """Put a file to remote server and chown it"""
    # Configure the exists() check differently depending on whether we're
    # copying over a file or a directory.
    with hide("everything"), settings(warn_only=True):
        if local("test -d "+localfile).succeeded:
            target = remotefile+"/"+os.path.basename(localfile)
        else:
            target = remotefile

    # Only copy things that are not already there
    if not exists(target) or overwrite:
        put(localfile, remotefile, use_sudo=True, mode=mode)
        sudo("chown "+owner+":"+group+" "+remotefile)

@task
def add_host_entry(ip, hostname, domain):<commit_msg>Make chown recursive if util.put_and_chown is operating on a directory<commit_after># -*- coding: utf-8 -*-
from fabric.api import *
from fabric.contrib.files import exists
from datetime import datetime
import re
import os

def getisotime():
    """Convenience method to get current UTC time in yyyymmddhhmm format"""
    ct = datetime.utcnow()
    return ct.strftime("%Y%m%d%H%M")

@task
def uname():
    """Show kernel version"""
    run("uname -a")

@task
def df():
    """Check available disk space"""
    run("df -h")

@task
def install_sudo():
    """Install sudo, if it's not present"""
    import vars
    vars = vars.Vars()
    with settings(warn_only=True):
        if run("which sudo").failed:
            run(vars.os.package_install_cmd % "sudo")

@task
def put_and_chown(localfile, remotefile, mode="0644", owner="root", group="root", overwrite=True):
    """Put a file to remote server and chown it"""
    # Configure the exists() check and chown differently depending on whether
    # we're copying over a file or a directory.
    with hide("everything"), settings(warn_only=True):
        if local("test -d "+localfile).succeeded:
            target = remotefile+"/"+os.path.basename(localfile)
            chown_cmd = "chown -R"
        else:
            target = remotefile
            chown_cmd = "chown"

    # Only copy things that are not already there
    if not exists(target) or overwrite:
        put(localfile, remotefile, use_sudo=True, mode=mode)
        sudo(chown_cmd+" "+owner+":"+group+" "+remotefile)

@task
def add_host_entry(ip, hostname, domain):
{'fraction_non_alphanumeric': 0.13049223653782624, 'fraction_numerical': 0.003303600925008259, 'mean_word_length': 3.3694083694083696, 'pattern_counts': {'":': 2, '<': 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': '3880694', 'n_tokens_mistral': 971, 'n_tokens_neox': 937, 'n_words': 297}