Example #1
0
def main():
    commands = {
        'create-db': create_db,
        'serve': server.main,
        'set-password': set_password,
        'save-hucs': maps.save_hucs,
        'save-notices': usace_public_notices.save_notices,
        'pdftext': pdftext,
    }
    description = 'Catalog and process public notices for Section 404 permit applications.'
    horetu(commands, name = 'scott', description = description)
Example #2
0
File: cli.py Project: tlevine/mhdir
def m():
    horetu.horetu(show.m)
Example #3
0
File: cli.py Project: tlevine/mhdir
def inc():
    horetu.horetu(index.inc)
Example #4
0
def process_cutfile(infile, cuts, outdir, out_extension):
    cuts=list(cuts)
    xs = chain(['0'], *([str(end), ':', 'newfile'] for end, _ in cuts))

    prefix=os.path.abspath('.tmp')
    with tempfile.TemporaryDirectory(prefix=prefix) as tmp:
        outfile = os.path.join(tmp, out_extension)

        cmd = ['sox', infile, outfile, 'trim'] + list(xs)
        p = subprocess.Popen(cmd,
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        p.wait()

        if p.returncode == 0:
            zs = zip(sorted(os.listdir(tmp)), cuts)
            for intermediate, (_, name) in zs:
                final = intermediate.replace('.', '-' + name + '.')
                os.renames(os.path.join(tmp, intermediate),
                           os.path.join(outdir, final))
            os.makedirs(tmp, exist_ok = True) # undo os.renames cleanup
        else:
            cmd_str = ' \\ \n  '.join(map(quote, cmd))
            output =b''.join(p.communicate()).decode('utf-8')
            sys.stderr.write('$ %s\n%s\n' % (cmd_str, output))
            sys.exit(1)

if __name__ == '__main__':
    import horetu
    horetu.horetu(cutaudio)
Example #5
0
def cli():
    horetu.horetu(ypotf)
Example #6
0
#!/usr/bin/env python3
from horetu import horetu


def something(input_file, output_file, n_cores: int = 3):
    """
    Do something to a file with several cores.
    """
    # Pretend that something happens here.


if __name__ == "__main__":
    horetu(something)
Example #7
0
#!/usr/bin/env python3
from horetu import horetu
def main(input_file, output_file, n_cores: int = 3):
    '''
    Do something to a file with several cores.
    '''
    # Pretend that something happens here.
horetu(main)
Example #8
0
#!/usr/bin/env python3
from horetu import horetu


def something(input_file, output_file, n_cores: int = 3):
    '''
    Do something to a file with several cores.
    '''
    # Pretend that something happens here.


if __name__ == '__main__':
    horetu(something)