import classes

def dircontrol(d :classes.dir):

    li = [e for e in d.subdirs()]

    numdir = len(d.subdirs())
    numsvg = len([f for f in d.ownfiles() if f.endswith(".svg")])
    numjsn = len([f for f in d.ownfiles() if f.endswith(".json")])
    if numdir > 0:
        if ((numsvg > 1) or (numjsn > 1) or (numsvg != numjsn)):
            print("- ERRORE:  Troppi file nella directoryy " + d.name())
            return False
    else:
        if (numsvg != 1) or (numjsn !=1):
            print("- ERRORE:  numero di file non congruente nella directoryy " + d.name())
            return False
    return True



if False:
    dir1 = dir('/home/miki/')

    [print(a) for a in dir1.subdirs()]
    w = input()
    print(type(dir1.ownfiles()))
    print(str(len(dir1.ownfiles())))
    [print(b) for b in dir1.ownfiles()]
    w = input()

if True:
    dir2 = classes.dir('/home/')
    if dircontrol(dir2):
        print("VAI")
        a= input()