|
2 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
|
5 | | -FORMAT_HTML = 'html' |
6 | | -FORMAT_IMAGE = 'image' |
7 | | -FORMAT_JSON = 'json' |
8 | | -FORMAT_TEXT = 'text' |
9 | | -FORMAT_URL = 'url' |
| 5 | +FORMAT_HTML = "html" |
| 6 | +FORMAT_IMAGE = "image" |
| 7 | +FORMAT_JSON = "json" |
| 8 | +FORMAT_TEXT = "text" |
| 9 | +FORMAT_URL = "url" |
10 | 10 |
|
11 | 11 |
|
12 | 12 | def extra(content, format, name=None, mime_type=None, extension=None): |
13 | | - return {'name': name, 'format': format, 'content': content, |
14 | | - 'mime_type': mime_type, 'extension': extension} |
| 13 | + return { |
| 14 | + "name": name, |
| 15 | + "format": format, |
| 16 | + "content": content, |
| 17 | + "mime_type": mime_type, |
| 18 | + "extension": extension, |
| 19 | + } |
15 | 20 |
|
16 | 21 |
|
17 | 22 | def html(content): |
18 | 23 | return extra(content, FORMAT_HTML) |
19 | 24 |
|
20 | 25 |
|
21 | | -def image(content, name='Image', mime_type='image/png', extension='png'): |
| 26 | +def image(content, name="Image", mime_type="image/png", extension="png"): |
22 | 27 | return extra(content, FORMAT_IMAGE, name, mime_type, extension) |
23 | 28 |
|
24 | 29 |
|
25 | | -def png(content, name='Image'): |
26 | | - return image(content, name, mime_type='image/png', extension='png') |
| 30 | +def png(content, name="Image"): |
| 31 | + return image(content, name, mime_type="image/png", extension="png") |
27 | 32 |
|
28 | 33 |
|
29 | | -def jpg(content, name='Image'): |
30 | | - return image(content, name, mime_type='image/jpeg', extension='jpg') |
| 34 | +def jpg(content, name="Image"): |
| 35 | + return image(content, name, mime_type="image/jpeg", extension="jpg") |
31 | 36 |
|
32 | 37 |
|
33 | | -def svg(content, name='Image'): |
34 | | - return image(content, name, mime_type='image/svg+xml', extension='svg') |
| 38 | +def svg(content, name="Image"): |
| 39 | + return image(content, name, mime_type="image/svg+xml", extension="svg") |
35 | 40 |
|
36 | 41 |
|
37 | | -def json(content, name='JSON'): |
38 | | - return extra(content, FORMAT_JSON, name, 'application/json', 'json') |
| 42 | +def json(content, name="JSON"): |
| 43 | + return extra(content, FORMAT_JSON, name, "application/json", "json") |
39 | 44 |
|
40 | 45 |
|
41 | | -def text(content, name='Text'): |
42 | | - return extra(content, FORMAT_TEXT, name, 'text/plain', 'txt') |
| 46 | +def text(content, name="Text"): |
| 47 | + return extra(content, FORMAT_TEXT, name, "text/plain", "txt") |
43 | 48 |
|
44 | 49 |
|
45 | | -def url(content, name='URL'): |
| 50 | +def url(content, name="URL"): |
46 | 51 | return extra(content, FORMAT_URL, name) |
0 commit comments