The Function Chaining Language

Library

  1. encode.py
  2. fclio.py
  3. fclstd.py
  4. shell.py
  5. webrequest.py

list_open_dir

Opens the given directory and returns a list of it's content.

def list_open_dir(path):
    if exists(path):
        l = listdir(path)
        r = []

        for i in range(len(l)):
            r.append(f'{path}{l[i]}')

        return r

    print("fcl open_dir Error: cannot find path:", path)
    raise SystemExit

listen_on_dir

Listen on the given directory. Returns all results if not empty.

def listen_on_dir(d):
    while len(listdir(d)) == 0:
        sleep(1)

    return listdir(d)

open_file_as_list

Opens the specified file as a list, seperated by \n as new line.

def open_file_as_list(f):
    return open(f, "r").read().split("\n")

open_file

Default language specific, that reads the entire file as a string.

def open_file(f):
    return open(f, "r").read()

open_file_as_string

Default language specific, that reads the entire file as a string. dublicate of open_file.

def open_file_as_string(f):
    return open(f, "r").read()

file_append_new_line

Append data followed by \n as new line to the file.

def file_append_new_line(f, append):
    open(f, "a").write(f'{append}\n')

def file_append_new_line_join_list_newline(f, append_list):
    open(f, "a").write("\n".join(append))

new_json_hash_name_file

Create new json file with a hash as name. Note This is very useful if you need to write many files with similar but diffirent content.

def new_json_hash_name_file(w):
    fn = hashlib.sha512(f'{datetime.datetime}'.encode("ascii")).hexdigest()
    open(f'{fn}.json', "w").write(json_encode(w))
    print("Hashname File Created:", fn)

new_txt_hash_name_file

Create new txt file with a hash as name. Note This is very useful if you need to write many files with similar but diffirent content.

def new_txt_hash_name_file(w):
    fn = hashlib.sha512(f'{datetime.datetime}'.encode("ascii")).hexdigest()
    open(f'{fn}.txt', "w").write(w)
    print("Hashname File Created:", fn)

file_overwrite

Overwrite the current file with new data.

def file_overwrite(f, write):
    open(f, "a").write(f'{write}')