Skip to content

Commit c1ce9c9

Browse files
authored
Merge pull request #2202 from Pinata-Consulting/python-black
python: ran black .
2 parents 730eb6e + ffca5c5 commit c1ce9c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2845
-2555
lines changed

.github/workflows/black.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Lint Python
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: psf/black@stable
11+

docs/conf.py

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = 'OpenROAD Flow'
21-
copyright = 'The Regents of the University of California, 2021'
22-
author = 'OpenROAD Team'
20+
project = "OpenROAD Flow"
21+
copyright = "The Regents of the University of California, 2021"
22+
author = "OpenROAD Team"
2323

2424

2525
# -- General configuration ---------------------------------------------------
@@ -28,56 +28,56 @@
2828
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2929
# ones.
3030
extensions = [
31-
'sphinx.ext.autodoc',
32-
'sphinx.ext.ifconfig',
33-
'sphinx.ext.mathjax',
34-
'sphinx.ext.napoleon',
35-
'sphinx.ext.todo',
36-
'sphinx_external_toc',
37-
'sphinx_copybutton',
38-
'myst_parser',
39-
'sphinxcontrib.mermaid'
31+
"sphinx.ext.autodoc",
32+
"sphinx.ext.ifconfig",
33+
"sphinx.ext.mathjax",
34+
"sphinx.ext.napoleon",
35+
"sphinx.ext.todo",
36+
"sphinx_external_toc",
37+
"sphinx_copybutton",
38+
"myst_parser",
39+
"sphinxcontrib.mermaid",
4040
]
4141

4242
myst_enable_extensions = [
43-
'amsmath',
44-
'colon_fence',
45-
'deflist',
46-
'dollarmath',
47-
'html_admonition',
48-
'html_image',
49-
'replacements',
50-
'smartquotes',
51-
'substitution',
52-
'tasklist',
53-
'html_image',
43+
"amsmath",
44+
"colon_fence",
45+
"deflist",
46+
"dollarmath",
47+
"html_admonition",
48+
"html_image",
49+
"replacements",
50+
"smartquotes",
51+
"substitution",
52+
"tasklist",
53+
"html_image",
5454
]
5555

56-
external_toc_path = 'toc.yml'
56+
external_toc_path = "toc.yml"
5757

5858
# Add any paths that contain templates here, relative to this directory.
59-
templates_path = ['_templates']
59+
templates_path = ["_templates"]
6060

6161
# The suffix(es) of source filenames.
6262
# You can specify multiple suffix as a list of string:
63-
source_suffix = ['.md']
63+
source_suffix = [".md"]
6464

6565
# The master toctree document.
66-
master_doc = 'index2.md'
66+
master_doc = "index2.md"
6767

6868
# List of patterns, relative to source directory, that match files and
6969
# directories to ignore when looking for source files.
7070
# This pattern also affects html_static_path and html_extra_path.
7171
exclude_patterns = [
72-
'_build',
73-
'Thumbs.db',
74-
'.DS_Store',
75-
'**/LICENSE',
76-
'**/LICENSE.md',
77-
'README.md',
78-
'docs/releases/PostAlpha2.1BranchMethodology.md',
79-
'main',
80-
'index.md'
72+
"_build",
73+
"Thumbs.db",
74+
".DS_Store",
75+
"**/LICENSE",
76+
"**/LICENSE.md",
77+
"README.md",
78+
"docs/releases/PostAlpha2.1BranchMethodology.md",
79+
"main",
80+
"index.md",
8181
]
8282

8383
# The name of the Pygments (syntax highlighting) style to use.
@@ -97,7 +97,6 @@
9797
"show_navbar_depth": 2,
9898
"use_issues_button": True,
9999
"use_download_button": True,
100-
101100
# list for more fine-grained ordering of icons
102101
"icon_links": [
103102
{
@@ -126,81 +125,87 @@
126125
"icon": "https://img.shields.io/github/stars/The-OpenROAD-Project/OpenROAD-flow-scripts",
127126
"type": "url",
128127
},
129-
],
128+
],
130129
}
131130

132131
# Add any paths that contain custom static files (such as style sheets) here,
133132
# relative to this directory. They are copied after the builtin static files,
134133
# so a file named "default.css" will overwrite the builtin "default.css".
135134

135+
136136
def get_file_from_url(url, fname):
137137
r = requests.get(url)
138-
with open(fname, 'wb') as f:
138+
with open(fname, "wb") as f:
139139
f.write(r.content)
140140

141+
141142
def swap_prefix(file, old, new):
142-
with open(file, 'r') as f:
143+
with open(file, "r") as f:
143144
lines = f.read()
144145
lines = lines.replace(old, new)
145-
with open(file, 'wt') as f:
146+
with open(file, "wt") as f:
146147
f.write(lines)
147148

149+
148150
def setup(app):
149151
import shutil
150-
152+
151153
# symlink does not work for ORFS because of long recursive file links
152-
shutil.copy('../README.md', 'mainREADME.md')
153-
swap_prefix('mainREADME.md', '```mermaid', '```{mermaid}\n:align: center\n')
154+
shutil.copy("../README.md", "mainREADME.md")
155+
swap_prefix("mainREADME.md", "```mermaid", "```{mermaid}\n:align: center\n")
154156

155157
# Grab the reference file from OR
156-
url = 'https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/docs/contrib/GitGuide.md'
157-
get_file_from_url(url, 'contrib/GitGuide.md')
158-
158+
url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/docs/contrib/GitGuide.md"
159+
get_file_from_url(url, "contrib/GitGuide.md")
160+
159161
# Temporarily using commit number, will change once OR commit merged.
160-
url = 'https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/3563176d00daeb613eed2ccf9442137b0ae2cad3/docs/index.md'
161-
get_file_from_url(url, 'SupportedOS.md')
162+
url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/3563176d00daeb613eed2ccf9442137b0ae2cad3/docs/index.md"
163+
get_file_from_url(url, "SupportedOS.md")
162164

163165
# edit OpenROAD to OpenROAD-flow-scripts for GitGuide
164-
with open('contrib/GitGuide.md', 'r') as f:
166+
with open("contrib/GitGuide.md", "r") as f:
165167
content = f.read()
166-
content = content.replace('user/Build.md', '../index.md#build-or-installing-orfs-dependencies')
167-
content = content.replace('OpenROAD', 'OpenROAD-flow-scripts')
168-
content = content.replace('The-OpenROAD-flow-scripts', 'The-OpenROAD')
169-
with open('contrib/GitGuide.md', 'w') as f:
168+
content = content.replace(
169+
"user/Build.md", "../index.md#build-or-installing-orfs-dependencies"
170+
)
171+
content = content.replace("OpenROAD", "OpenROAD-flow-scripts")
172+
content = content.replace("The-OpenROAD-flow-scripts", "The-OpenROAD")
173+
with open("contrib/GitGuide.md", "w") as f:
170174
f.write(content)
171175

172176
# Create a copy of the index.md file
173177
import shutil
174-
shutil.copy('index.md', 'index2.md')
175178

176-
# Use re to find the desired content
177-
start_pattern = '## Supported Operating Systems'
178-
end_pattern = '## Code of conduct'
179-
with open('SupportedOS.md', 'r') as f:
179+
shutil.copy("index.md", "index2.md")
180+
181+
# Use re to find the desired content
182+
start_pattern = "## Supported Operating Systems"
183+
end_pattern = "## Code of conduct"
184+
with open("SupportedOS.md", "r") as f:
180185
markdown_content = f.read()
181186

182-
match = re.search(f'{start_pattern}(.*?){end_pattern}', markdown_content, re.DOTALL)
183-
184-
assert match is not None, 'No match found, check the OR Doc pattern on index.md'
187+
match = re.search(f"{start_pattern}(.*?){end_pattern}", markdown_content, re.DOTALL)
188+
189+
assert match is not None, "No match found, check the OR Doc pattern on index.md"
185190
extracted_content = match.group(1)
186191
extracted_content = "\n#### Supported Operating Systems" + extracted_content
187192
print(extracted_content)
188-
193+
189194
# Find insert position
190-
with open('index2.md', 'r') as f:
195+
with open("index2.md", "r") as f:
191196
existing_content = f.read()
192-
match = re.search(r'### Setup', existing_content)
193-
assert match is not None, 'Check search keyword.'
194-
with open('index2.md', 'w') as f:
197+
match = re.search(r"### Setup", existing_content)
198+
assert match is not None, "Check search keyword."
199+
with open("index2.md", "w") as f:
195200
insert_position = match.end() + 1
196201
before_insert = existing_content[:insert_position]
197202
after_insert = existing_content[insert_position:]
198203

199204
# Combine the parts with the extracted content
200205
updated_content = before_insert + extracted_content + after_insert
201-
206+
202207
f.write(updated_content)
203-
208+
204209
# Get Manpage file
205-
url = 'https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/src/utl/README.md'
206-
get_file_from_url(url, 'Manpage.md')
210+
url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/src/utl/README.md"
211+
get_file_from_url(url, "Manpage.md")

docs/revert-links.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env python3
22

3+
34
def swap_prefix(file, old, new):
4-
with open(file, 'r') as f:
5+
with open(file, "r") as f:
56
lines = f.read()
67
lines = lines.replace(old, new)
7-
with open(file, 'wt') as f:
8+
with open(file, "wt") as f:
89
f.write(lines)
910

1011

11-
swap_prefix('mainREADME.md', '```{mermaid}\n:align: center\n', '```mermaid')
12+
swap_prefix("mainREADME.md", "```{mermaid}\n:align: center\n", "```mermaid")

flow/designs/asap7/mock-array/config.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
# make_tracks M5 -x_offset 0.012 -x_pitch 0.048 -y_offset 0.012 -y_pitch 0.048
99
#
1010
# the macro needs to be on a multiple of the track pattern
11-
placement_grid_x = 0.048 * int(os.environ.get("MOCK_ARRAY_SCALE"))
12-
placement_grid_y = 0.048 * int(os.environ.get("MOCK_ARRAY_SCALE"))
11+
placement_grid_x = 0.048 * int(os.environ.get("MOCK_ARRAY_SCALE"))
12+
placement_grid_y = 0.048 * int(os.environ.get("MOCK_ARRAY_SCALE"))
1313

14-
# number of Elements in row and column, can be control by user via environment variable
14+
# number of Elements in row and column, can be control by user via environment variable
1515
# MOCK_ARRAY_TABLE (rows, cols, width, height, pitch_x, pitch_y)
1616
# rows, cols - number of Element in rows, cols
1717
# width, height - width and height of each Element
@@ -21,15 +21,17 @@
2121
#
2222
# pitch_x, pitch_y - placement pitch for each Element, in x and y direction
2323
# specification are in unit of placement grid
24-
rows, cols, ce_x, ce_y, pitch_x, pitch_y = map(int, os.environ.get("MOCK_ARRAY_TABLE").split())
24+
rows, cols, ce_x, ce_y, pitch_x, pitch_y = map(
25+
int, os.environ.get("MOCK_ARRAY_TABLE").split()
26+
)
2527

2628
# Element size is set to multiple of placement grid above
27-
ce_width = ce_x * placement_grid_x
28-
ce_height = ce_y * placement_grid_y
29+
ce_width = ce_x * placement_grid_x
30+
ce_height = ce_y * placement_grid_y
2931

30-
# top level core offset
31-
margin_x = placement_grid_x
32-
margin_y = placement_grid_y
32+
# top level core offset
33+
margin_x = placement_grid_x
34+
margin_y = placement_grid_y
3335

3436
# Element core margin
3537
ce_margin_x = placement_grid_x * 0.5
@@ -43,8 +45,12 @@
4345
array_offset_y = array_spacing_y + margin_y
4446

4547
# top level core and die size
46-
core_width = 2 * array_spacing_x + ((placement_grid_x * pitch_x) * (cols - 1)) + ce_width
47-
core_height = 2 * array_spacing_y + ((placement_grid_y * pitch_y) * (rows - 1)) + ce_height
48-
49-
die_width = core_width + (margin_x * 2)
48+
core_width = (
49+
2 * array_spacing_x + ((placement_grid_x * pitch_x) * (cols - 1)) + ce_width
50+
)
51+
core_height = (
52+
2 * array_spacing_y + ((placement_grid_y * pitch_y) * (rows - 1)) + ce_height
53+
)
54+
55+
die_width = core_width + (margin_x * 2)
5056
die_height = core_height + (margin_y * 2)

0 commit comments

Comments
 (0)