Skip to content

Commit 98c805e

Browse files
authored
fix flake8 errors in the script file (#6528)
* fix flake8 errors * fix E126 error * fix E123 error
1 parent 54bcb10 commit 98c805e

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

.github/scripts/sync-rpc-cmds.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,61 +14,63 @@ def checkIfDocIsPresent(title, headers):
1414
check_url = URL + "/" + title
1515
response = requests.get(check_url, headers=headers)
1616

17-
if (response.status_code == 200):
17+
if response.status_code == 200:
1818
return True
1919
else:
2020
return False
2121

2222

2323
def publishDoc(title, body, order):
24-
key = os.environ.get('README_API_KEY')
24+
key = os.environ.get("README_API_KEY")
2525
payload = {
2626
"title": title,
2727
"type": "basic",
2828
"body": body,
2929
"category": CATEGORY_ID,
3030
"hidden": False,
31-
"order": order
31+
"order": order,
3232
}
3333
headers = {
3434
"accept": "application/json",
3535
"content-type": "application/json",
36-
"authorization": "Basic " + key
36+
"authorization": "Basic " + key,
3737
}
3838

3939
isDocPresent = checkIfDocIsPresent(title, headers)
40-
if (isDocPresent):
40+
if isDocPresent:
4141
# update doc
4242
update_url = URL + "/" + title # title == slug
4343
response = requests.put(update_url, json=payload, headers=headers)
44-
if (response.status_code != 200):
44+
if response.status_code != 200:
4545
print(response.text)
4646
else:
4747
print("Updated ", title)
4848
else:
4949
# create doc
5050
response = requests.post(URL, json=payload, headers=headers)
51-
if (response.status_code != 201):
51+
if response.status_code != 201:
5252
print(response.text)
5353
else:
5454
print("Created ", title)
5555

5656

5757
def extract_rpc_commands(rst_content):
58-
manpages_block = re.search
59-
(r"\.\. block_start manpages(.*?)\.\. block_end manpages",
60-
rst_content, re.DOTALL)
58+
manpages_block = re.search(
59+
r"\.\. block_start manpages(.*?)" r"\.\. block_end manpages",
60+
rst_content,
61+
re.DOTALL,
62+
)
6163
if manpages_block:
62-
commands = re.findall
63-
(r'\b([a-zA-Z0-9_-]+)\s+<([^>]+)>\n',
64-
manpages_block.group(1))
64+
commands = re.findall(
65+
r"\b([a-zA-Z0-9_-]+)" r"\s+<([^>]+)>\n", manpages_block.group(1)
66+
)
6567
return commands
6668
return []
6769

6870

6971
def main():
7072
# path to the rst file from where we fetch all the RPC commands
71-
path_to_rst = 'doc/index.rst'
73+
path_to_rst = "doc/index.rst"
7274
with open(path_to_rst, "r") as file:
7375
rst_content = file.read()
7476

0 commit comments

Comments
 (0)