Represent a Codebase header. Each tool that transforms the codebase should create a Header and append it to the Codebase.headers list.
| 188 | |
| 189 | @attr.s(slots=True) |
| 190 | class Header(object): |
| 191 | """ |
| 192 | Represent a Codebase header. Each tool that transforms the codebase |
| 193 | should create a Header and append it to the Codebase.headers list. |
| 194 | """ |
| 195 | |
| 196 | tool_name = String(help="Name of the tool used such as scancode-toolkit.") |
| 197 | tool_version = String(default="", help="Tool version used such as v1.2.3.") |
| 198 | options = Mapping(help="Mapping of key/values describing the options used with this tool.") |
| 199 | notice = String(default="", help="Notice text for this tool.") |
| 200 | start_timestamp = String(help="Start timestamp for this header.") |
| 201 | end_timestamp = String(help="End timestamp for this header.") |
| 202 | output_format_version = String(help="Version for the output data format, such as v1.1 .") |
| 203 | duration = String(help="Scan duration in seconds.") |
| 204 | message = String(help="Message text.") |
| 205 | errors = List(help="List of error messages.") |
| 206 | warnings = List(help="List of warning messages.") |
| 207 | extra_data = Mapping(help="Mapping of extra key/values for this tool.") |
| 208 | |
| 209 | def to_dict(self): |
| 210 | return attr.asdict(self, dict_factory=dict) |
| 211 | |
| 212 | @classmethod |
| 213 | def from_dict(cls, **kwargs): |
| 214 | """ |
| 215 | Return a Header object deserialized from a `kwargs` mapping of |
| 216 | key/values. Unknown attributes are ignored. |
| 217 | """ |
| 218 | known_attributes = set(attr.fields_dict(Header)) |
| 219 | kwargs = {k: v for k, v in kwargs.items() if k in known_attributes} |
| 220 | return cls(**kwargs) |
| 221 | |
| 222 | |
| 223 | def ignore_nothing(resource, codebase): |
no test coverage detected