@classmethod<EOL><INDENT>def from_gitlab(klass, repository, labor_hours=True):<DEDENT>
if not isinstance(repository, gitlab.v4.objects.Project):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>project = klass()<EOL>logger.debug(<EOL>'<STR_LIT>',<EOL>repository.id,<EOL>repository.path_with_namespace,<EOL>)<EOL>project['<STR_LIT:name>'] = repository.name<EOL>project['<STR_LIT>'] = repository.http_url_to_repo<EOL>project['<STR_LIT:description>'] = repository.description<EOL>project['<STR_LIT>']['<STR_LIT>'] = None<EOL>web_url = repository.web_url<EOL>public_server = web_url.startswith('<STR_LIT>')<EOL>if repository.visibility in ('<STR_LIT>') and public_server:<EOL><INDENT>project['<STR_LIT>']['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>elif date_parse(repository.created_at) < POLICY_START_DATE:<EOL><INDENT>project['<STR_LIT>']['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if labor_hours:<EOL><INDENT>project['<STR_LIT>'] = labor_hours_from_url(project['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>project['<STR_LIT>'] = <NUM_LIT:0><EOL><DEDENT>project['<STR_LIT>'] = ['<STR_LIT>'] + repository.tag_list<EOL>project['<STR_LIT>'] = {<EOL>'<STR_LIT:email>': '<STR_LIT>',<EOL>'<STR_LIT>': web_url,<EOL>}<EOL>project['<STR_LIT>'] = repository.namespace['<STR_LIT:name>']<EOL>project['<STR_LIT:status>'] = '<STR_LIT>'<EOL>project['<STR_LIT>'] = '<STR_LIT>'<EOL>project['<STR_LIT>'] = repository.web_url<EOL>api_url = repository.manager.gitlab._url<EOL>archive_suffix = '<STR_LIT>' % repository.get_id()<EOL>project['<STR_LIT>'] = api_url + archive_suffix<EOL>project['<STR_LIT:date>'] = {<EOL>'<STR_LIT>': date_parse(repository.created_at).date().isoformat(),<EOL>'<STR_LIT>': date_parse(repository.last_activity_at).date().isoformat(),<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>}<EOL>_prune_dict_null_str(project)<EOL>return project<EOL>
Create CodeGovProject object from GitLab Repository