def code_unit_factory(morfs, file_locator):
<EOL>if not isinstance(morfs, (list, tuple)):<EOL><INDENT>morfs = [morfs]<EOL><DEDENT>globbed = []<EOL>for morf in morfs:<EOL><INDENT>if isinstance(morf, string_class) and ('<STR_LIT:?>' in morf or '<STR_LIT:*>' in morf):<EOL><INDENT>globbed.extend(glob.glob(morf))<EOL><DEDENT>else:<EOL><INDENT>globbed.append(morf)<EOL><DEDENT><DEDENT>morfs = globbed<EOL>code_units = [CodeUnit(morf, file_locator) for morf in morfs]<EOL>return code_units<EOL>
Construct a list of CodeUnits from polymorphic inputs.

    `morfs` is a module or a filename, or a list of same.

    `file_locator` is a FileLocator that can help resolve filenames.

    Returns a list of CodeUnit objects.