<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _detect_eggs_in_folder(folder):

 """
 Detect egg distributions located in the given folder.
 
 Only direct folder content is considered and subfolders are not searched
 recursively.
 
 """

    eggs = {}
    for x in os.listdir(folder):
        zip = x.endswith(_zip_ext)
        if zip:
            root = x[:-len(_zip_ext)]
            egg = _Egg.NONE
        elif x.endswith(_egg_ext):
            root = x[:-len(_egg_ext)]
            if os.path.isdir(os.path.join(folder, x)):
                egg = _Egg.FOLDER
            else:
                egg = _Egg.FILE
        else:
            continue
        try:
            info = eggs[root]
        except KeyError:
            eggs[root] = _Egg(os.path.join(folder, root), egg, zip)
        else:
            if egg is not _Egg.NONE:
                info.set_egg(egg)
            if zip:
                info.set_zip()
    return eggs.values()