예제 #1
0
def prune_processes(args=[]):
    procs = []
    for p in text_lines(list_processes(args)):
        p = split(' +', p)
        if p[7:]:
            procs.append('kill -9 %-10s # %s' % (p[1], ' '.join(p[7:])[:20]))
    return '\n'.join(procs)
예제 #2
0
def unc_student_test():
    output = ['Sensei Users: ', list_users()]

    for course in unc_courses():
        # import_test_students()
        students = list_students(course)
        output.append(students)
    return '%s Student Records' % len(text_lines(text_join(output)))
예제 #3
0
 def render_sections(markdown_text):
     output = []
     sections = markdown_text.split("\n## ")
     for text in sections:
         body = fix_images(text, '../images')
         title = text_lines(text)[0]
         settings = create_slide_section(title, body)
         output.append(settings)
     return output
예제 #4
0
def source():
    print('source code:')
    source_text = source_code()
    print('%s files, %s lines of source code' % (len(code_files()), len(text_lines(source_text))))
예제 #5
0
def count_lines(text, min, max):
    x = len(text_lines(text))
    if x > max or x < min:
        return '%d Lines in output (should be between %s and %s)' % (x, min, max)
    else:
        return 'Lines in output (is between %s and %s)' % (min, max)
예제 #6
0
def code_source_test():
    files = len(code_files())
    source = len(text_lines(source_code()))
    functions = len(text_lines(list_functions()))
    return '%s files, %s functions, %s lines of source code' % (files, functions, source)
예제 #7
0
def code_files(path='.'):
    exclude = ['env', '.venv']
    files = shell_file_list(path, 'py', exclude)
    files = delete_lines(files, '.DS_Store')
    return text_lines(files)
예제 #8
0
def html_files():
    exclude = ['env', '.venv']
    files = text_lines(shell_file_list('.', 'html', exclude))
    files += text_lines(shell_file_list('.', 'css', exclude))
    return files
예제 #9
0
def doc_files():
    exclude = ['.git', 'env', '.venv']
    files = shell_file_list('Documents', '', exclude)
    files = delete_lines(files, '.DS_Store')
    files = delete_lines(files, 'dktht')
    return text_lines(files)
예제 #10
0
def no_blank_lines(text):
    text = text_lines(text)
    text = [x for x in text if x.strip() != '']
    text = text_join(text)
    return text