Skip to content

Commit 44fdc6d

Browse files
committed
Upgrade black
1 parent 1b749ee commit 44fdc6d

File tree

7 files changed

+24
-58
lines changed

7 files changed

+24
-58
lines changed

robotpy_installer/_pipstub.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import os
1010
import sys
1111

12-
1312
if __name__ == "__main__":
1413
# Setup environment for what the RoboRIO python would have
1514
# -> strictly speaking we only care about platform.machine as that's what

robotpy_installer/cli_init.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from .errors import Error
1111
from .utils import handle_cli_error
1212

13-
1413
logger = logging.getLogger("init")
1514

1615

robotpy_installer/cli_sync.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,13 @@ def run(
184184
os.execv(sys.executable, pip_args)
185185

186186
with tempfile.NamedTemporaryFile("w", delete=False, suffix=".py") as fp:
187-
fp.write(
188-
inspect.cleandoc(
189-
f"""
187+
fp.write(inspect.cleandoc(f"""
190188
import os, subprocess
191189
subprocess.run({pip_args!r})
192190
print()
193191
input("Install complete, press enter to continue")
194192
os.unlink(__file__)
195-
"""
196-
)
197-
)
193+
"""))
198194

199195
print("pip is launching in a new window to complete the installation")
200196
subprocess.Popen(

robotpy_installer/installer.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,20 @@ def opkg_install(
175175
# to only install a package if it's not already installed
176176
opkg_files = []
177177

178-
opkg_script = inspect.cleandoc(
179-
"""
178+
opkg_script = inspect.cleandoc("""
180179
set -e
181180
PACKAGES=()
182181
DO_INSTALL=0
183-
"""
184-
)
182+
""")
185183

186-
opkg_script_bit = inspect.cleandoc(
187-
f"""
184+
opkg_script_bit = inspect.cleandoc(f"""
188185
if ! opkg list-installed | grep -F "%(name)s - %(version)s"; then
189186
PACKAGES+=("http://localhost:{self.cache_server.port}/opkg_cache/%(fname)s")
190187
DO_INSTALL=1
191188
else
192189
echo "%(name)s already installed"
193190
fi
194-
"""
195-
)
191+
""")
196192

197193
for package in packages:
198194
pkgname, pkgversion, _ = package.name.split("_")
@@ -209,9 +205,7 @@ def opkg_install(
209205
opkg_files.append(package.name)
210206

211207
# Finish it out
212-
opkg_script += "\n" + (
213-
inspect.cleandoc(
214-
"""
208+
opkg_script += "\n" + (inspect.cleandoc("""
215209
if [ "${DO_INSTALL}" == "0" ]; then
216210
echo "No packages to install."
217211
else
@@ -221,10 +215,7 @@ def opkg_install(
221215
222216
sync
223217
ldconfig
224-
"""
225-
)
226-
% {"options": "--force-reinstall" if force_reinstall else ""}
227-
)
218+
""") % {"options": "--force-reinstall" if force_reinstall else ""})
228219

229220
with catch_ssh_error("creating opkg install script"):
230221
# write to /tmp so that it doesn't persist
@@ -356,15 +347,11 @@ def ensure_robot_pip(self):
356347

357348
with catch_ssh_error("checking for pip3"):
358349
if self.ssh.exec_cmd("[ -x /usr/local/bin/pip3 ]").returncode != 0:
359-
raise InstallerException(
360-
inspect.cleandoc(
361-
"""
350+
raise InstallerException(inspect.cleandoc("""
362351
pip3 not found on RoboRIO, did you install python?
363352
364353
Use the 'download-python' and 'install-python' commands first!
365-
"""
366-
)
367-
)
354+
"""))
368355

369356
# Use pip stub to override the wheel platform on roborio
370357
with catch_ssh_error("copying pip stub"):

robotpy_installer/pyproject.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ def write_default_gitignore(project_path: pathlib.Path):
134134
:param project_path: Path to robot project
135135
"""
136136

137-
ignore_content = inspect.cleandoc(
138-
"""
137+
ignore_content = inspect.cleandoc("""
139138
# Log file
140139
*.log
141140
@@ -362,8 +361,7 @@ def write_default_gitignore(project_path: pathlib.Path):
362361
363362
# PyPI configuration file
364363
.pypirc
365-
"""
366-
)
364+
""")
367365

368366
ignore_content += "\n"
369367

@@ -396,8 +394,7 @@ def write_default_pyproject(
396394
f'"{extra}",' for extra in sorted(provides_extra)
397395
)
398396

399-
content = inspect.cleandoc(
400-
f"""
397+
content = inspect.cleandoc(f"""
401398
402399
#
403400
# Use this configuration file to control what RobotPy packages are installed
@@ -419,8 +416,7 @@ def write_default_pyproject(
419416
# is equivalent to a line in requirements.txt)
420417
requires = []
421418
422-
"""
423-
)
419+
""")
424420

425421
content += "\n"
426422
content = content.replace("##EXTRAS##", extras)

robotpy_installer/wpilib_preferences.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pathlib
55
import typing
66

7-
87
logger = logging.getLogger("robotpy.installer")
98

109

tests/test_pyproject.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ def null_resolver(req: Requirement, env: pypackages.Env) -> typing.List[Requirem
1616

1717

1818
def test_ok():
19-
project = load_project(
20-
f"""
19+
project = load_project(f"""
2120
[tool.robotpy]
2221
robotpy_version = "{YEAR}.1.1.2"
23-
"""
24-
)
22+
""")
2523
installed = pypackages.make_packages({"robotpy": f"{YEAR}.1.1.2"})
2624
assert project.are_requirements_met(
2725
installed, pypackages.roborio_env(), null_resolver
@@ -32,12 +30,10 @@ def test_ok():
3230

3331

3432
def test_older_fail():
35-
project = load_project(
36-
f"""
33+
project = load_project(f"""
3734
[tool.robotpy]
3835
robotpy_version = "{YEAR}.1.1.2"
39-
"""
40-
)
36+
""")
4137
installed = pypackages.make_packages({"robotpy": f"{YEAR}.1.1.0"})
4238
assert project.are_requirements_met(
4339
installed, pypackages.roborio_env(), null_resolver
@@ -48,12 +44,10 @@ def test_older_fail():
4844

4945

5046
def test_older_and_newer_fail():
51-
project = load_project(
52-
f"""
47+
project = load_project(f"""
5348
[tool.robotpy]
5449
robotpy_version = "{YEAR}.1.1.2"
55-
"""
56-
)
50+
""")
5751
installed = pypackages.make_packages(
5852
{"robotpy": [f"{YEAR}.1.1.0", f"{YEAR}.1.1.4"]}
5953
)
@@ -66,15 +60,13 @@ def test_older_and_newer_fail():
6660

6761

6862
def test_beta_empty_req():
69-
project = load_project(
70-
f"""
63+
project = load_project(f"""
7164
[tool.robotpy]
7265
robotpy_version = "{YEAR}.1.1.2"
7366
requires = [
7467
"robotpy-commands-v2"
7568
]
76-
"""
77-
)
69+
""")
7870

7971
installed = pypackages.make_packages(
8072
{"robotpy": f"{YEAR}.1.1.2", "robotpy-commands-v2": f"{YEAR}.0.0b4"}
@@ -89,16 +81,14 @@ def test_beta_empty_req():
8981

9082

9183
def test_env_marker():
92-
project = load_project(
93-
f"""
84+
project = load_project(f"""
9485
[tool.robotpy]
9586
robotpy_version = "{YEAR}.1.1.2"
9687
requires = [
9788
"robotpy-opencv; platform_machine == 'roborio'",
9889
"opencv-python; platform_machine != 'roborio'"
9990
]
100-
"""
101-
)
91+
""")
10292

10393
installed = pypackages.make_packages(
10494
{"robotpy": f"{YEAR}.1.1.2", "robotpy-opencv": f"{YEAR}.0.0"}

0 commit comments

Comments
 (0)