Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit ffde6cb

Browse files
committed
Run black on the codebase
1 parent 8c82c14 commit ffde6cb

25 files changed

+8730
-7609
lines changed

build.py

Lines changed: 311 additions & 267 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,49 @@
55

66
base_dir = os.path.dirname(os.path.abspath(__file__))
77
about = {}
8-
with open(os.path.join(base_dir, 'virtualbox', '__about__.py')) as f:
8+
with open(os.path.join(base_dir, "virtualbox", "__about__.py")) as f:
99
exec(f.read(), about)
1010

1111

1212
setup(
13-
name=about['__title__'],
14-
version=about['__version__'],
15-
packages=["virtualbox",
16-
"virtualbox.library_ext"],
17-
author=about['__author__'],
18-
author_email=about['__author_email__'],
19-
maintainer=about['__maintainer__'],
20-
maintainer_email=about['__maintainer_email__'],
21-
url=about['__url__'],
13+
name=about["__title__"],
14+
version=about["__version__"],
15+
packages=["virtualbox", "virtualbox.library_ext"],
16+
author=about["__author__"],
17+
author_email=about["__author_email__"],
18+
maintainer=about["__maintainer__"],
19+
maintainer_email=about["__maintainer_email__"],
20+
url=about["__url__"],
2221
description="Complete implementation of VirtualBox's COM API with a Pythoninc interface",
23-
long_description=open('README.rst').read(),
24-
license=about['__license__'],
22+
long_description=open("README.rst").read(),
23+
license=about["__license__"],
2524
zip_safe=False,
2625
install_requires=[],
27-
platforms=['cygwin', 'win', 'linux'],
26+
platforms=["cygwin", "win", "linux"],
2827
classifiers=[
29-
'Development Status :: 5 - Production/Stable',
30-
'Intended Audience :: Developers',
31-
'Intended Audience :: Information Technology',
32-
'Intended Audience :: System Administrators',
33-
'Natural Language :: English',
34-
'License :: OSI Approved :: Apache Software License',
35-
'Operating System :: Microsoft',
36-
'Operating System :: POSIX',
37-
'Operating System :: MacOS',
38-
'Programming Language :: Python',
39-
'Programming Language :: Python :: 2.7',
40-
'Programming Language :: Python :: 3',
41-
'Programming Language :: Python :: 3.4',
42-
'Programming Language :: Python :: 3.5',
43-
'Programming Language :: Python :: 3.6',
44-
'Programming Language :: Python :: 3.7',
45-
'Programming Language :: Python :: Implementation :: CPython',
46-
'Topic :: Security',
47-
'Topic :: Scientific/Engineering :: Visualization',
48-
'Topic :: System :: Clustering',
49-
'Topic :: System :: Distributed Computing',
50-
'Topic :: System :: Emulators',
51-
'Topic :: Software Development :: Testing'
28+
"Development Status :: 5 - Production/Stable",
29+
"Intended Audience :: Developers",
30+
"Intended Audience :: Information Technology",
31+
"Intended Audience :: System Administrators",
32+
"Natural Language :: English",
33+
"License :: OSI Approved :: Apache Software License",
34+
"Operating System :: Microsoft",
35+
"Operating System :: POSIX",
36+
"Operating System :: MacOS",
37+
"Programming Language :: Python",
38+
"Programming Language :: Python :: 2.7",
39+
"Programming Language :: Python :: 3",
40+
"Programming Language :: Python :: 3.4",
41+
"Programming Language :: Python :: 3.5",
42+
"Programming Language :: Python :: 3.6",
43+
"Programming Language :: Python :: 3.7",
44+
"Programming Language :: Python :: Implementation :: CPython",
45+
"Topic :: Security",
46+
"Topic :: Scientific/Engineering :: Visualization",
47+
"Topic :: System :: Clustering",
48+
"Topic :: System :: Distributed Computing",
49+
"Topic :: System :: Emulators",
50+
"Topic :: Software Development :: Testing",
5251
],
5352
test_suite="tests",
5453
)

tests/test_appliance.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
import unittest
33

44
import virtualbox
5+
56
"""
67
ATENTION: This test case interacts with the local VirtualBox and
78
may harm your setup.
89
"""
9-
FIXTURES = os.path.join(os.path.dirname(__file__), 'fixtures')
10+
FIXTURES = os.path.join(os.path.dirname(__file__), "fixtures")
1011

11-
APPLIANCE_FILE = 'appliance_test_1.ova'
12+
APPLIANCE_FILE = "appliance_test_1.ova"
1213

13-
APPLIANCE_NAME = 'appliance_test_1'
14+
APPLIANCE_NAME = "appliance_test_1"
1415
APPLIANCE_CPU = 1
1516
APPLIANCE_MEM = 5
1617
APPLIANCE_AUDIO = virtualbox.library.AudioControllerType(0) # AC97
1718

18-
MACHINE_NEW_NAME = 'appliance_test_1_RENAMED'
19+
MACHINE_NEW_NAME = "appliance_test_1_RENAMED"
1920
MACHINE_CPU = 2
2021
MACHINE_MEM = 64
2122
MACHINE_AUDIO = virtualbox.library.AudioControllerType(1) # SB16
@@ -28,9 +29,12 @@ def is_dangerous():
2829
return any(name in current_machines for name in test_names)
2930

3031

31-
@unittest.skipIf(is_dangerous(),
32-
"Please delete boxes: {} manually.".format(
33-
(', '.join((APPLIANCE_NAME, MACHINE_NEW_NAME)))))
32+
@unittest.skipIf(
33+
is_dangerous(),
34+
"Please delete boxes: {} manually.".format(
35+
(", ".join((APPLIANCE_NAME, MACHINE_NEW_NAME)))
36+
),
37+
)
3438
class TestAppliance(unittest.TestCase):
3539
def setUp(self):
3640
self.vbox = virtualbox.VirtualBox()

tests/test_enum.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
from virtualbox import library
44

5-
class TestEnumeration(unittest.TestCase):
65

6+
class TestEnumeration(unittest.TestCase):
77
def test_machine_state_paused(self):
88
self.assertEqual(int(library.MachineState.paused), 6)
99
self.assertEqual(str(library.MachineState.paused), "Paused")
10-
self.assertEqual(repr(library.MachineState.paused),
11-
"MachineState(6)")
12-
13-
14-
10+
self.assertEqual(repr(library.MachineState.paused), "MachineState(6)")

tests/test_errors.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
import virtualbox
44
from virtualbox.library import VBoxError
55

6-
class TestErrors(unittest.TestCase):
76

7+
class TestErrors(unittest.TestCase):
88
def test_raises(self):
99
vbox = virtualbox.VirtualBox()
1010
try:
11-
vbox.find_machine('blah blah X')
11+
vbox.find_machine("blah blah X")
1212
except VBoxError as exc:
1313
pass
1414
else:
1515
self.fail("VBoxError not raised")
16-
17-
18-

tests/test_events.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import unittest
1+
import unittest
22
import time
33

44
import virtualbox
55

6+
67
class TestEvents(unittest.TestCase):
7-
88
def extra_data_callback(self, event):
99
self.called = True
10-
print("Event key=%s value=%s machineid %s" % (event.key,
11-
event.value,
12-
event.machine_id))
10+
print(
11+
"Event key=%s value=%s machineid %s"
12+
% (event.key, event.value, event.machine_id)
13+
)
1314

1415
def test_extra_data_changed(self):
1516
vbox = virtualbox.VirtualBox()
1617
vbox.register_on_extra_data_changed(self.extra_data_callback)
1718
# Cause a change event
18-
vbox.set_extra_data('test', 'data')
19-
vbox.set_extra_data('test', 'dataa')
19+
vbox.set_extra_data("test", "data")
20+
vbox.set_extra_data("test", "dataa")
2021

2122
time.sleep(1)
2223
self.assertTrue(self.called)
23-

tests/test_manual.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
from virtualbox import pool
1111

1212

13-
config = funconf.Config(['tests/test_vm.conf', 'test_vm.conf'])
13+
config = funconf.Config(["tests/test_vm.conf", "test_vm.conf"])
1414

1515

1616
def on_machine_state_changed(event):
1717
vbox = pool.VirtualBox()
1818
machine = vbox.find_machine(event.machine_id)
19-
print("Machine '%s' state has changed to %s" % (machine.name,
20-
event.state))
19+
print("Machine '%s' state has changed to %s" % (machine.name, event.state))
2120

22-
# TODO : BUG found in vboxapi ...
23-
# If a call to vboxapi.VirtualBoxManager is made in the main process
24-
# followed by another call in a forked multiprocess Process, the call
21+
22+
# TODO : BUG found in vboxapi ...
23+
# If a call to vboxapi.VirtualBoxManager is made in the main process
24+
# followed by another call in a forked multiprocess Process, the call
2525
# in the subprocess freezes and will not return... Bug in one of the
2626
# lower level APIs
27-
#if __name__ == '__main__':
27+
# if __name__ == '__main__':
2828
# vbox = pool.VirtualBox()
2929
# vbox.register_on_machine_state_changed(on_machine_state_changed)
3030

@@ -35,7 +35,7 @@ def on_machine_state_changed(event):
3535
@config
3636
def seed(machine_name, machine_username, machine_password, seed_count):
3737
"Test seeding vms"
38-
# register here - can't do it in scope of module due to bug in
38+
# register here - can't do it in scope of module due to bug in
3939
# low level API.
4040
vbox = pool.VirtualBox()
4141
vbox.register_on_machine_state_changed(on_machine_state_changed)
@@ -49,40 +49,35 @@ def seed(machine_name, machine_username, machine_password, seed_count):
4949
for s in sessions:
5050
machine = mp.release(s)
5151

52+
5253
@begin.subcommand
5354
@config
54-
def seed_multiproc(machine_name,
55-
machine_username,
56-
machine_password,
57-
seed_count):
55+
def seed_multiproc(machine_name, machine_username, machine_password, seed_count):
5856
"Test seeding vms from multiple processes"
5957
procs = []
60-
args=(machine_name, machine_username, machine_password, 1)
58+
args = (machine_name, machine_username, machine_password, 1)
6159
for i in range(seed_count):
6260
p = Process(target=seed, args=args)
6361
p.start()
6462
procs.append(p)
6563
for p in procs:
6664
p.join()
6765

66+
6867
@begin.subcommand
6968
@config
70-
def seed_multithread(machine_name,
71-
machine_username,
72-
machine_password,
73-
seed_count):
69+
def seed_multithread(machine_name, machine_username, machine_password, seed_count):
7470
"Test seeding vms from multiple threads"
7571
threads = []
76-
args=(machine_name, machine_username, machine_password, 1)
72+
args = (machine_name, machine_username, machine_password, 1)
7773
for i in range(seed_count):
7874
t = Thread(target=seed, args=args)
7975
t.start()
8076
threads.append(t)
8177
for t in threads:
8278
t.join()
8379

80+
8481
@begin.start
8582
def main():
8683
pass
87-
88-

0 commit comments

Comments
 (0)