@@ -18,15 +18,15 @@ def generate_github_annotation(match: re.Match[str], branch_url: str) -> Tuple[s
18
18
func = match .group (3 )
19
19
msg = match .group (4 )
20
20
assert isinstance (msg , str )
21
- msg_splitpos = msg .find (" " , 21 )
21
+ msg_split_pos = msg .find (" " , 21 )
22
22
file = match .group (1 )
23
- linktext = os .path .basename (file ).split ("." )[0 ]
24
- source_link = f"[`{ linktext } `]({ branch_url } /{ file } #L{ lineno } )"
23
+ link_text = os .path .basename (file ).split ("." )[0 ]
24
+ source_link = f"[`{ link_text } `]({ branch_url } /{ file } #L{ lineno } )"
25
25
row = {
26
26
"Location" : source_link ,
27
27
"Function" : f"`{ func } `" ,
28
28
"Error code" : code ,
29
- "Error message" : msg [:msg_splitpos ] + "<br>" + msg [msg_splitpos + 1 :],
29
+ "Error message" : msg [:msg_split_pos ] + "<br>" + msg [msg_split_pos + 1 :],
30
30
"Error description" : "" ,
31
31
}
32
32
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message
@@ -49,8 +49,8 @@ def skip_uninteresting_lines(line: str) -> bool:
49
49
return True
50
50
if line [0 ] == "[" :
51
51
pos = line .rfind (os .getcwd ())
52
- printfrom = pos + len (os .getcwd ()) + 1 if pos > 0 else line .index ("]" ) + 2
53
- info ("PROGRESS: " + line [1 :].split ("]" )[0 ] + ": " + line [printfrom :])
52
+ print_from = pos + len (os .getcwd ()) + 1 if pos > 0 else line .index ("]" ) + 2
53
+ info ("PROGRESS: " + line [1 :].split ("]" )[0 ] + ": " + line [print_from :])
54
54
return True
55
55
if line .startswith ("ninja: " ):
56
56
line = line [7 :]
@@ -139,17 +139,17 @@ def run_pytype_and_parse_annotations(xfail_files: List[str], branch_url: str):
139
139
140
140
141
141
def to_markdown (me , fp , returncode , results , branch_url ):
142
- mylink = f"[{ me } ]({ branch_url } /{ me } .py)"
142
+ my_link = f"[{ me } ]({ branch_url } /{ me } .py)"
143
143
pytype_link = "[pytype](https://google.github.io/pytype)"
144
144
if len (results ) or returncode :
145
- fp .write (f"\n #### { mylink } reports these { pytype_link } error messages:\n " )
145
+ fp .write (f"\n #### { my_link } reports these { pytype_link } error messages:\n " )
146
146
fp .write (pd .DataFrame (results ).to_markdown ())
147
147
else :
148
- fp .write (f"\n #### Congratulations, { mylink } reports no { pytype_link } errors.\n " )
148
+ fp .write (f"\n #### Congratulations, { my_link } reports no { pytype_link } errors.\n " )
149
149
fp .write ("\n " )
150
150
151
151
152
- def setup_and_run_pytype_action (scriptname : str ):
152
+ def setup_and_run_pytype_action (script_name : str ):
153
153
config = load ("pyproject.toml" )
154
154
pytype = config ["tool" ].get ("pytype" )
155
155
xfail_files = pytype .get ("xfail" , []) if pytype else []
@@ -167,12 +167,12 @@ def setup_and_run_pytype_action(scriptname: str):
167
167
summary_file = os .environ .get ("GITHUB_STEP_SUMMARY" , None )
168
168
if summary_file :
169
169
with open (summary_file , "w" , encoding = "utf-8" ) as fp :
170
- to_markdown (scriptname , fp , retcode , results , filelink_baseurl )
170
+ to_markdown (script_name , fp , retcode , results , filelink_baseurl )
171
171
else :
172
- to_markdown (scriptname , sys .stdout , retcode , results , filelink_baseurl )
172
+ to_markdown (script_name , sys .stdout , retcode , results , filelink_baseurl )
173
173
174
174
175
175
if __name__ == "__main__" :
176
176
script_basename = os .path .basename (__file__ ).split ("." )[0 ]
177
177
basicConfig (format = script_basename + ": %(message)s" , level = INFO )
178
- sys .exit (setup_and_run_pytype_action (scriptname = script_basename ))
178
+ sys .exit (setup_and_run_pytype_action (script_name = script_basename ))
0 commit comments