Skip to content

Commit bf28332

Browse files
committed
uvx pre-commit run --all-files
1 parent c0fd78b commit bf28332

29 files changed

+1554
-1287
lines changed

dev.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,66 @@
55

66

77
REPO_ROOT = os.path.dirname(os.path.abspath(__file__))
8-
VENVS = os.path.join(REPO_ROOT, '.venvs')
8+
VENVS = os.path.join(REPO_ROOT, ".venvs")
99

1010

11-
def resolve_venv_root(kind='dev', venvsdir=VENVS):
11+
def resolve_venv_root(kind="dev", venvsdir=VENVS):
1212
import sysconfig
13+
1314
if sysconfig.is_python_build():
14-
sys.exit('please install your built Python first (or pass it using --python)')
15+
sys.exit("please install your built Python first (or pass it using --python)")
1516
# XXX Handle other implementations too?
16-
base = os.path.join(venvsdir, kind or 'dev')
17+
base = os.path.join(venvsdir, kind or "dev")
1718
major, minor = sys.version_info[:2]
18-
pyloc = ((os.path.abspath(sys.executable)
19-
).partition(os.path.sep)[2].lstrip(os.path.sep)
20-
).replace(os.path.sep, '-')
21-
return f'{base}-{major}.{minor}-{pyloc}'
19+
pyloc = (
20+
(os.path.abspath(sys.executable)).partition(os.path.sep)[2].lstrip(os.path.sep)
21+
).replace(os.path.sep, "-")
22+
return f"{base}-{major}.{minor}-{pyloc}"
2223

2324

24-
def ensure_venv_ready(venvroot=None, kind='dev', venvsdir=VENVS):
25+
def ensure_venv_ready(venvroot=None, kind="dev", venvsdir=VENVS):
2526
if sys.prefix != sys.base_prefix:
26-
assert os.path.exists(os.path.join(sys.prefix, 'pyvenv.cfg'))
27+
assert os.path.exists(os.path.join(sys.prefix, "pyvenv.cfg"))
2728
venvroot = sys.prefix
2829
python = sys.executable
29-
readyfile = os.path.join(sys.prefix, 'READY')
30+
readyfile = os.path.join(sys.prefix, "READY")
3031
isready = os.path.exists(readyfile)
3132
else:
3233
import venv
34+
3335
if not venvroot:
3436
venvroot = resolve_venv_root(kind, venvsdir)
3537
# Make sure the venv exists.
36-
readyfile = os.path.join(venvroot, 'READY')
38+
readyfile = os.path.join(venvroot, "READY")
3739
isready = os.path.exists(readyfile)
3840
if not isready:
3941
relroot = os.path.relpath(venvroot)
4042
if not os.path.exists(venvroot):
41-
print(f'creating venv at {relroot}...')
43+
print(f"creating venv at {relroot}...")
4244
else:
43-
print(f'venv {relroot} not ready, re-creating...')
45+
print(f"venv {relroot} not ready, re-creating...")
4446
venv.create(venvroot, with_pip=True, clear=True)
4547
else:
46-
assert os.path.exists(os.path.join(venvroot, 'pyvenv.cfg'))
48+
assert os.path.exists(os.path.join(venvroot, "pyvenv.cfg"))
4749
# Return the venv's Python executable.
48-
binname = 'Scripts' if os.name == 'nt' else 'bin'
50+
binname = "Scripts" if os.name == "nt" else "bin"
4951
exename = os.path.basename(sys.executable)
5052
python = os.path.join(venvroot, binname, exename)
5153

5254
# Now make sure the venv has pyperformance installed.
5355
if not isready:
5456
import subprocess
57+
5558
relroot = os.path.relpath(venvroot)
56-
print(f'venv {relroot} not ready, installing dependencies...')
59+
print(f"venv {relroot} not ready, installing dependencies...")
5760
proc = subprocess.run(
58-
[python, '-m', 'pip', 'install',
59-
'--upgrade',
60-
'--editable', REPO_ROOT],
61+
[python, "-m", "pip", "install", "--upgrade", "--editable", REPO_ROOT],
6162
)
6263
if proc.returncode != 0:
63-
sys.exit('ERROR: install failed')
64-
with open(readyfile, 'w'):
64+
sys.exit("ERROR: install failed")
65+
with open(readyfile, "w"):
6566
pass
66-
print('...venv {relroot} ready!')
67+
print("...venv {relroot} ready!")
6768

6869
return venvroot, python
6970

@@ -77,8 +78,9 @@ def main(venvroot=None):
7778

7879
# Now run pyperformance.
7980
import pyperformance.cli
81+
8082
pyperformance.cli.main()
8183

8284

83-
if __name__ == '__main__':
85+
if __name__ == "__main__":
8486
main()

doc/conf.py

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@
3434
extensions = []
3535

3636
# Add any paths that contain templates here, relative to this directory.
37-
templates_path = ['_templates']
37+
templates_path = ["_templates"]
3838

3939
# The suffix(es) of source filenames.
4040
# You can specify multiple suffix as a list of string:
4141
#
4242
# source_suffix = ['.rst', '.md']
43-
source_suffix = '.rst'
43+
source_suffix = ".rst"
4444

4545
# The master toctree document.
46-
master_doc = 'index'
46+
master_doc = "index"
4747

4848
# General information about the project.
49-
project = 'Python Performance Benchmark Suite'
50-
copyright = '2017, Victor Stinner'
51-
author = 'Victor Stinner'
49+
project = "Python Performance Benchmark Suite"
50+
copyright = "2017, Victor Stinner"
51+
author = "Victor Stinner"
5252

5353
# The version info for the project you're documenting, acts as replacement for
5454
# |version| and |release|, also used in various other places throughout the
5555
# built documents.
5656
#
5757
# The short X.Y version.
58-
version = release = '1.0.6'
58+
version = release = "1.0.6"
5959

6060
# The language for content autogenerated by Sphinx. Refer to documentation
6161
# for a list of supported languages.
@@ -67,10 +67,10 @@
6767
# List of patterns, relative to source directory, that match files and
6868
# directories to ignore when looking for source files.
6969
# This patterns also effect to html_static_path and html_extra_path
70-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
70+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7171

7272
# The name of the Pygments (syntax highlighting) style to use.
73-
pygments_style = 'sphinx'
73+
pygments_style = "sphinx"
7474

7575
# If true, `todo` and `todoList` produce output, else they produce nothing.
7676
todo_include_todos = False
@@ -81,7 +81,7 @@
8181
# The theme to use for HTML and HTML Help pages. See the documentation for
8282
# a list of builtin themes.
8383
#
84-
html_theme = 'alabaster'
84+
html_theme = "alabaster"
8585

8686
# Theme options are theme-specific and customize the look and feel of a theme
8787
# further. For a list of options available for each theme, see the
@@ -92,13 +92,13 @@
9292
# Add any paths that contain custom static files (such as style sheets) here,
9393
# relative to this directory. They are copied after the builtin static files,
9494
# so a file named "default.css" will overwrite the builtin "default.css".
95-
html_static_path = ['_static']
95+
html_static_path = ["_static"]
9696

9797

9898
# -- Options for HTMLHelp output ------------------------------------------
9999

100100
# Output file base name for HTML help builder.
101-
htmlhelp_basename = 'PythonPerformanceBenchmarkSuitedoc'
101+
htmlhelp_basename = "PythonPerformanceBenchmarkSuitedoc"
102102

103103

104104
# -- Options for LaTeX output ---------------------------------------------
@@ -107,15 +107,12 @@
107107
# The paper size ('letterpaper' or 'a4paper').
108108
#
109109
# 'papersize': 'letterpaper',
110-
111110
# The font size ('10pt', '11pt' or '12pt').
112111
#
113112
# 'pointsize': '10pt',
114-
115113
# Additional stuff for the LaTeX preamble.
116114
#
117115
# 'preamble': '',
118-
119116
# Latex figure (float) alignment
120117
#
121118
# 'figure_align': 'htbp',
@@ -125,8 +122,13 @@
125122
# (source start file, target name, title,
126123
# author, documentclass [howto, manual, or own class]).
127124
latex_documents = [
128-
(master_doc, 'PythonPerformanceBenchmarkSuite.tex', 'Python Performance Benchmark Suite Documentation',
129-
'Victor Stinner', 'manual'),
125+
(
126+
master_doc,
127+
"PythonPerformanceBenchmarkSuite.tex",
128+
"Python Performance Benchmark Suite Documentation",
129+
"Victor Stinner",
130+
"manual",
131+
),
130132
]
131133

132134

@@ -135,8 +137,13 @@
135137
# One entry per manual page. List of tuples
136138
# (source start file, name, description, authors, manual section).
137139
man_pages = [
138-
(master_doc, 'pythonperformancebenchmarksuite', 'Python Performance Benchmark Suite Documentation',
139-
[author], 1)
140+
(
141+
master_doc,
142+
"pythonperformancebenchmarksuite",
143+
"Python Performance Benchmark Suite Documentation",
144+
[author],
145+
1,
146+
)
140147
]
141148

142149

@@ -146,10 +153,13 @@
146153
# (source start file, target name, title, author,
147154
# dir menu entry, description, category)
148155
texinfo_documents = [
149-
(master_doc, 'PythonPerformanceBenchmarkSuite', 'Python Performance Benchmark Suite Documentation',
150-
author, 'PythonPerformanceBenchmarkSuite', 'One line description of project.',
151-
'Miscellaneous'),
156+
(
157+
master_doc,
158+
"PythonPerformanceBenchmarkSuite",
159+
"Python Performance Benchmark Suite Documentation",
160+
author,
161+
"PythonPerformanceBenchmarkSuite",
162+
"One line description of project.",
163+
"Miscellaneous",
164+
),
152165
]
153-
154-
155-

pyperformance/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66

77
VERSION = (1, 11, 0)
8-
__version__ = '.'.join(map(str, VERSION))
8+
__version__ = ".".join(map(str, VERSION))
99

1010

1111
PKG_ROOT = os.path.dirname(__file__)
12-
DATA_DIR = os.path.join(PKG_ROOT, 'data-files')
12+
DATA_DIR = os.path.join(PKG_ROOT, "data-files")
1313

1414

1515
def is_installed():
@@ -22,7 +22,7 @@ def is_installed():
2222

2323
def is_dev():
2424
parent = os.path.dirname(PKG_ROOT)
25-
return os.path.exists(os.path.join(parent, 'pyproject.toml'))
25+
return os.path.exists(os.path.join(parent, "pyproject.toml"))
2626

2727

2828
def _is_venv():

pyperformance/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import pyperformance.cli
2+
23
pyperformance.cli.main()

0 commit comments

Comments
 (0)