1
1
# This Source Code Form is subject to the terms of the Mozilla Public
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
- from typing import Dict
5
4
from typing import Optional
6
5
7
6
FORMAT_HTML = "html"
@@ -18,7 +17,7 @@ def extra(
18
17
name : Optional [str ] = None ,
19
18
mime_type : Optional [str ] = None ,
20
19
extension : Optional [str ] = None ,
21
- ) -> Dict [str , Optional [str ]]:
20
+ ) -> dict [str , Optional [str ]]:
22
21
return {
23
22
"name" : name ,
24
23
"format_type" : format_type ,
@@ -28,7 +27,7 @@ def extra(
28
27
}
29
28
30
29
31
- def html (content : str ) -> Dict [str , Optional [str ]]:
30
+ def html (content : str ) -> dict [str , Optional [str ]]:
32
31
return extra (content , FORMAT_HTML )
33
32
34
33
@@ -37,31 +36,31 @@ def image(
37
36
name : str = "Image" ,
38
37
mime_type : str = "image/png" ,
39
38
extension : str = "png" ,
40
- ) -> Dict [str , Optional [str ]]:
39
+ ) -> dict [str , Optional [str ]]:
41
40
return extra (content , FORMAT_IMAGE , name , mime_type , extension )
42
41
43
42
44
- def png (content : str , name : str = "Image" ) -> Dict [str , Optional [str ]]:
43
+ def png (content : str , name : str = "Image" ) -> dict [str , Optional [str ]]:
45
44
return image (content , name , mime_type = "image/png" , extension = "png" )
46
45
47
46
48
- def jpg (content : str , name : str = "Image" ) -> Dict [str , Optional [str ]]:
47
+ def jpg (content : str , name : str = "Image" ) -> dict [str , Optional [str ]]:
49
48
return image (content , name , mime_type = "image/jpeg" , extension = "jpg" )
50
49
51
50
52
- def svg (content : str , name : str = "Image" ) -> Dict [str , Optional [str ]]:
51
+ def svg (content : str , name : str = "Image" ) -> dict [str , Optional [str ]]:
53
52
return image (content , name , mime_type = "image/svg+xml" , extension = "svg" )
54
53
55
54
56
- def json (content : str , name : str = "JSON" ) -> Dict [str , Optional [str ]]:
55
+ def json (content : str , name : str = "JSON" ) -> dict [str , Optional [str ]]:
57
56
return extra (content , FORMAT_JSON , name , "application/json" , "json" )
58
57
59
58
60
- def text (content : str , name : str = "Text" ) -> Dict [str , Optional [str ]]:
59
+ def text (content : str , name : str = "Text" ) -> dict [str , Optional [str ]]:
61
60
return extra (content , FORMAT_TEXT , name , "text/plain" , "txt" )
62
61
63
62
64
- def url (content : str , name : str = "URL" ) -> Dict [str , Optional [str ]]:
63
+ def url (content : str , name : str = "URL" ) -> dict [str , Optional [str ]]:
65
64
return extra (content , FORMAT_URL , name )
66
65
67
66
@@ -70,9 +69,9 @@ def video(
70
69
name : str = "Video" ,
71
70
mime_type : str = "video/mp4" ,
72
71
extension : str = "mp4" ,
73
- ) -> Dict [str , Optional [str ]]:
72
+ ) -> dict [str , Optional [str ]]:
74
73
return extra (content , FORMAT_VIDEO , name , mime_type , extension )
75
74
76
75
77
- def mp4 (content : str , name : str = "Video" ) -> Dict [str , Optional [str ]]:
76
+ def mp4 (content : str , name : str = "Video" ) -> dict [str , Optional [str ]]:
78
77
return video (content , name )
0 commit comments