@classmethod<EOL><INDENT>def from_doecode(klass, record):<DEDENT>
if not isinstance(record, dict):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>project = klass()<EOL>project['<STR_LIT:name>'] = record['<STR_LIT>']<EOL>logger.debug('<STR_LIT>', record['<STR_LIT>'])<EOL>link = record.get('<STR_LIT>', '<STR_LIT>')<EOL>if not link:<EOL><INDENT>link = record.get('<STR_LIT>')<EOL>logger.warning('<STR_LIT>', link)<EOL><DEDENT>project['<STR_LIT>'] = link<EOL>project['<STR_LIT:description>'] = record['<STR_LIT:description>']<EOL>licenses = set(record['<STR_LIT>'])<EOL>licenses.discard(None)<EOL>logger.debug('<STR_LIT>', licenses)<EOL>license_objects = []<EOL>if '<STR_LIT>' in licenses:<EOL><INDENT>licenses.remove('<STR_LIT>')<EOL>license_objects = [{<EOL>'<STR_LIT:name>': '<STR_LIT>',<EOL>'<STR_LIT>': record['<STR_LIT>']<EOL>}]<EOL><DEDENT>if licenses:<EOL><INDENT>license_objects.extend([_license_obj(license) for license in licenses])<EOL><DEDENT>project['<STR_LIT>']['<STR_LIT>'] = license_objects<EOL>if record['<STR_LIT>']:<EOL><INDENT>usage_type = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>usage_type = '<STR_LIT>'<EOL>project['<STR_LIT>']['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>project['<STR_LIT>']['<STR_LIT>'] = usage_type<EOL>project['<STR_LIT>'] = <NUM_LIT:0><EOL>project['<STR_LIT>'] = ['<STR_LIT>']<EOL>lab_name = record.get('<STR_LIT>')<EOL>if lab_name is not None:<EOL><INDENT>project['<STR_LIT>'].append(lab_name)<EOL><DEDENT>project['<STR_LIT>']['<STR_LIT:email>'] = record['<STR_LIT>']<EOL>if '<STR_LIT>' in record and record['<STR_LIT>']:<EOL><INDENT>project['<STR_LIT:version>'] = record['<STR_LIT>']<EOL><DEDENT>if lab_name is not None:<EOL><INDENT>project['<STR_LIT>'] = lab_name<EOL><DEDENT>status = record.get('<STR_LIT>')<EOL>if status is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>elif status:<EOL><INDENT>status = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>status = '<STR_LIT>'<EOL><DEDENT>project['<STR_LIT:status>'] = status<EOL>vcs = None<EOL>link = project['<STR_LIT>']<EOL>if '<STR_LIT>' in link:<EOL><INDENT>vcs = '<STR_LIT>'<EOL><DEDENT>if vcs is None:<EOL><INDENT>logger.debug('<STR_LIT>', project['<STR_LIT:name>'], link)<EOL>vcs = '<STR_LIT>'<EOL><DEDENT>if vcs:<EOL><INDENT>project['<STR_LIT>'] = vcs<EOL><DEDENT>url = record.get('<STR_LIT>', '<STR_LIT>')<EOL>if url:<EOL><INDENT>project['<STR_LIT>'] = url<EOL><DEDENT>if '<STR_LIT>' in record:<EOL><INDENT>project['<STR_LIT>'] = record['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in record and '<STR_LIT>' in record:<EOL><INDENT>project['<STR_LIT:date>'] = {<EOL>'<STR_LIT>': record['<STR_LIT>'],<EOL>'<STR_LIT>': record['<STR_LIT>']<EOL>}<EOL><DEDENT>return project<EOL>
Create CodeGovProject object from DOE CODE record

Handles crafting Code.gov Project