MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / from_dict

Method from_dict

codewiki/cli/models/job.py:127–155  ·  view source on GitHub ↗

Create from dictionary.

(cls, data: Dict[str, Any])

Source from the content-addressed store, hash-verified

125
126 @classmethod
127 def from_dict(cls, data: Dict[str, Any]) -> 'DocumentationJob':
128 """Create from dictionary."""
129 job = cls(
130 job_id=data.get('job_id', str(uuid.uuid4())),
131 repository_path=data.get('repository_path', ''),
132 repository_name=data.get('repository_name', ''),
133 output_directory=data.get('output_directory', ''),
134 commit_hash=data.get('commit_hash', ''),
135 branch_name=data.get('branch_name'),
136 timestamp_start=data.get('timestamp_start', datetime.now().isoformat()),
137 timestamp_end=data.get('timestamp_end'),
138 status=JobStatus(data.get('status', 'pending')),
139 error_message=data.get('error_message'),
140 files_generated=data.get('files_generated', []),
141 module_count=data.get('module_count', 0),
142 )
143
144 # Parse nested objects
145 if 'generation_options' in data:
146 opts = data['generation_options']
147 job.generation_options = GenerationOptions(**opts)
148
149 if 'llm_config' in data and data['llm_config']:
150 job.llm_config = LLMConfig(**data['llm_config'])
151
152 if 'statistics' in data:
153 job.statistics = JobStatistics(**data['statistics'])
154
155 return job
156

Callers

nothing calls this directly

Calls 5

GenerationOptionsClass · 0.85
LLMConfigClass · 0.85
JobStatisticsClass · 0.85
getMethod · 0.80
JobStatusClass · 0.70

Tested by

no test coverage detected