from pic import Picture
from path import Path
import argparse, json
parser = argparse.ArgumentParser(
    description=
    "Process the picture or the directory, given the json config file")
parser.add_argument("path", help="Path for the picture or the directory")
parser.add_argument(
    "-n",
    "--nb_faces",
    type=int,
    help=
    "0 | 1 | n to don't search for any face | search and expect exactly one face | search for multiple face"
)


def process(dir_path, nb_faces=1, margin=0.4):
    dir = Path(dir_path)
    print(dir)


if __name__ == '__main__':
    args = parser.parse_args()
    print(args)

@@ -58,14 +58,8 @@
 arse
-, json
 %0Apar
@@ -440,169 +440,1045 @@
 %22%0A)%0A
-%0A%0Adef process(dir_path, nb_faces=1, margin=0.4):%0A    dir = Path(dir_path)%0A    print(dir)%0A%0A%0Aif __name__ == '__main__':%0A    args = parser.parse_args()%0A    print(args
+parser.add_argument(%0A    %22--margin%22,%0A    %22-m%22,%0A    type=float,%0A    help=%22Specify the margin around the face if the face_crop is activate%22)%0Aparser.add_argument(%22--json%22, %22-j%22, help=%22Path to a config file%22)%0A%0A%0Adef load_json_config(path):%0A    %22%22%22%0A    Import a config file written in json%0A    %22%22%22%0A    import json%0A    # Pretend that we load the following JSON file:%0A    return json.loads(Path(path).text())%0A%0A%0Adef process_pic(path, nb_faces=1, face_crop=False, margin=0.4):%0A    file_path = Path(path)%0A    pass%0A%0A%0Adef merge(dict_1, dict_2):%0A    %22%22%22Merge two dictionaries.%0A    Values that evaluate to true take priority over falsy values.%0A    %60dict_1%60 takes priority over %60dict_2%60.%0A    %22%22%22%0A    return dict((str(key), dict_1.get(key) or dict_2.get(key))%0A                for key in set(dict_2) %7C set(dict_1))%0A%0A%0Aif __name__ == '__main__':%0A    args = parser.parse_args()%0A    if args.json:%0A        config = load_json_config(args.json)%0A    else:%0A        config = %7B%7D%0A    # Shell options takes priority over json config%0A    config = merge(vars(args), config
 )%0A

Add a function to read json config files