1212
1313# Third party imports
1414from pygments .style import Style
15- from pygments .token import (Name , Keyword , Comment , String , Number ,
16- Punctuation , Operator )
15+ from pygments .token import (
16+ Name ,
17+ Keyword ,
18+ Comment ,
19+ String ,
20+ Number ,
21+ Punctuation ,
22+ Operator ,
23+ )
1724
1825
1926def create_pygments_dict (color_scheme_dict ):
@@ -24,86 +31,99 @@ def create_pygments_dict(color_scheme_dict):
2431
2532 def give_font_weight (is_bold ):
2633 if is_bold :
27- return ' bold'
34+ return " bold"
2835 else :
29- return ''
36+ return ""
3037
3138 def give_font_style (is_italic ):
3239 if is_italic :
33- return ' italic'
40+ return " italic"
3441 else :
35- return ''
42+ return ""
3643
3744 color_scheme = color_scheme_dict
3845
39- fon_c , fon_fw , fon_fs = color_scheme [' normal' ]
40- font_color = fon_c
46+ fon_c , fon_fw , fon_fs = color_scheme [" normal" ]
47+ font_color = fon_c
4148 font_font_weight = give_font_weight (fon_fw )
4249 font_font_style = give_font_style (fon_fs )
4350
44- key_c , key_fw , key_fs = color_scheme [' keyword' ]
45- keyword_color = key_c
51+ key_c , key_fw , key_fs = color_scheme [" keyword" ]
52+ keyword_color = key_c
4653 keyword_font_weight = give_font_weight (key_fw )
4754 keyword_font_style = give_font_style (key_fs )
4855
49- bui_c , bui_fw , bui_fs = color_scheme [' builtin' ]
50- builtin_color = bui_c
56+ bui_c , bui_fw , bui_fs = color_scheme [" builtin" ]
57+ builtin_color = bui_c
5158 builtin_font_weight = give_font_weight (bui_fw )
5259 builtin_font_style = give_font_style (bui_fs )
5360
54- str_c , str_fw , str_fs = color_scheme [' string' ]
55- string_color = str_c
61+ str_c , str_fw , str_fs = color_scheme [" string" ]
62+ string_color = str_c
5663 string_font_weight = give_font_weight (str_fw )
5764 string_font_style = give_font_style (str_fs )
5865
59- num_c , num_fw , num_fs = color_scheme [' number' ]
60- number_color = num_c
66+ num_c , num_fw , num_fs = color_scheme [" number" ]
67+ number_color = num_c
6168 number_font_weight = give_font_weight (num_fw )
6269 number_font_style = give_font_style (num_fs )
6370
64- com_c , com_fw , com_fs = color_scheme [' comment' ]
65- comment_color = com_c
71+ com_c , com_fw , com_fs = color_scheme [" comment" ]
72+ comment_color = com_c
6673 comment_font_weight = give_font_weight (com_fw )
6774 comment_font_style = give_font_style (com_fs )
6875
69- def_c , def_fw , def_fs = color_scheme [' definition' ]
70- definition_color = def_c
76+ def_c , def_fw , def_fs = color_scheme [" definition" ]
77+ definition_color = def_c
7178 definition_font_weight = give_font_weight (def_fw )
7279 definition_font_style = give_font_style (def_fs )
7380
74- ins_c , ins_fw , ins_fs = color_scheme [' instance' ]
75- instance_color = ins_c
81+ ins_c , ins_fw , ins_fs = color_scheme [" instance" ]
82+ instance_color = ins_c
7683 instance_font_weight = give_font_weight (ins_fw )
7784 instance_font_style = give_font_style (ins_fs )
7885
79- font_token = font_font_style + ' ' + font_font_weight + ' ' + font_color
80- definition_token = (definition_font_style + ' ' + definition_font_weight +
81- ' ' + definition_color )
82- builtin_token = (builtin_font_style + ' ' + builtin_font_weight + ' ' +
83- builtin_color )
84- instance_token = (instance_font_style + ' ' + instance_font_weight + ' ' +
85- instance_color )
86- keyword_token = (keyword_font_style + ' ' + keyword_font_weight + ' ' +
87- keyword_color )
88- comment_token = (comment_font_style + ' ' + comment_font_weight + ' ' +
89- comment_color )
90- string_token = (string_font_style + ' ' + string_font_weight + ' ' +
91- string_color )
92- number_token = (number_font_style + ' ' + number_font_weight + ' ' +
93- number_color )
94-
95- syntax_style_dic = {Name : font_token .strip (),
96- Name .Class : definition_token .strip (),
97- Name .Function : definition_token .strip (),
98- Name .Builtin : builtin_token .strip (),
99- Name .Builtin .Pseudo : instance_token .strip (),
100- Keyword : keyword_token .strip (),
101- Keyword .Type : builtin_token .strip (),
102- Comment : comment_token .strip (),
103- String : string_token .strip (),
104- Number : number_token .strip (),
105- Punctuation : font_token .strip (),
106- Operator .Word : keyword_token .strip ()}
86+ font_token = font_font_style + " " + font_font_weight + " " + font_color
87+ definition_token = (
88+ definition_font_style
89+ + " "
90+ + definition_font_weight
91+ + " "
92+ + definition_color
93+ )
94+ builtin_token = (
95+ builtin_font_style + " " + builtin_font_weight + " " + builtin_color
96+ )
97+ instance_token = (
98+ instance_font_style + " " + instance_font_weight + " " + instance_color
99+ )
100+ keyword_token = (
101+ keyword_font_style + " " + keyword_font_weight + " " + keyword_color
102+ )
103+ comment_token = (
104+ comment_font_style + " " + comment_font_weight + " " + comment_color
105+ )
106+ string_token = (
107+ string_font_style + " " + string_font_weight + " " + string_color
108+ )
109+ number_token = (
110+ number_font_style + " " + number_font_weight + " " + number_color
111+ )
112+
113+ syntax_style_dic = {
114+ Name : font_token .strip (),
115+ Name .Class : definition_token .strip (),
116+ Name .Function : definition_token .strip (),
117+ Name .Builtin : builtin_token .strip (),
118+ Name .Builtin .Pseudo : instance_token .strip (),
119+ Keyword : keyword_token .strip (),
120+ Keyword .Type : builtin_token .strip (),
121+ Comment : comment_token .strip (),
122+ String : string_token .strip (),
123+ Number : number_token .strip (),
124+ Punctuation : font_token .strip (),
125+ Operator .Word : keyword_token .strip (),
126+ }
107127
108128 return syntax_style_dic
109129
0 commit comments