Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 9ce2cc7

Browse files
authored
[RFR] Update pre-commit hooks rev (#10029)
* Update pre-commit hooks rev * some pyupgrade changes
1 parent 5460ce6 commit 9ce2cc7

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

+78
-81
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ substitutions:
55
exclude: ^(cfme|scripts) # for now disable - we shall gradually reenable it
66
repos:
77
- repo: https://github.com/asottile/reorder_python_imports
8-
rev: v1.6.1
8+
rev: v2.1.0
99
hooks:
1010
- id: reorder-python-imports
1111
- repo: https://github.com/ambv/black
12-
rev: 19.3b0
12+
rev: 19.10b0
1313
hooks:
1414
- id: black
1515
args: [--safe, --line-length, '100']
1616
language_version: python3.7
1717
<<: *exclude
1818
- repo: https://github.com/asottile/pyupgrade
19-
rev: v1.23.0
19+
rev: v2.1.0
2020
hooks:
2121
- id: pyupgrade
2222
language_version: python3.7
@@ -28,7 +28,7 @@ repos:
2828
language_version: python3.7
2929
additional_dependencies: [polarion-docstrings, bugzilla-docstrings]
3030
- repo: https://github.com/pre-commit/pre-commit-hooks
31-
rev: v2.3.0
31+
rev: v2.5.0
3232
hooks:
3333
- id: trailing-whitespace
3434
- id: end-of-file-fixer

artifactor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def parse_config(self):
159159
if not self.artifact_dir:
160160
print("!!! Artifact dir must be specified in yaml")
161161
sys.exit(127)
162-
self.config["zmq_socket_address"] = "tcp://127.0.0.1:{}".format(random_port())
162+
self.config["zmq_socket_address"] = f"tcp://127.0.0.1:{random_port()}"
163163
self.setup_plugin_instances()
164164
self.start_server()
165165
self.global_data = {

artifactor/plugins/reporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ def process_data(self, artifacts, log_dir, version, fw_version, name_filter=None
169169
group_file_list = []
170170
for file_dict in file_dicts:
171171
if file_dict["file_type"] == "qa_contact":
172-
with open(file_dict["os_filename"], "r") as qafile:
172+
with open(file_dict["os_filename"]) as qafile:
173173
qareader = csv.reader(qafile, delimiter=",", quotechar='"')
174174
for qacontact in qareader:
175175
test_data["qa_contact"].append(qacontact)
176176
if qacontact[0] not in template_data["qa"]:
177177
template_data["qa"].append(qacontact[0])
178178
continue # Do not store, handled a different way :)
179179
elif file_dict["file_type"] == "short_tb":
180-
with open(file_dict["os_filename"], "r") as short_tb:
180+
with open(file_dict["os_filename"]) as short_tb:
181181
test_data["short_tb"] = short_tb.read()
182182
continue
183183
file_dict["filename"] = file_dict["os_filename"].replace(log_dir, "")

cfme/fixtures/candu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def candu_db_restore(temp_appliance_extended_db):
7373
# get DB backup file
7474
db_storage_hostname = conf.cfme_data.bottlenecks.hostname
7575
db_storage_ssh = SSHClient(hostname=db_storage_hostname, **conf.credentials.bottlenecks)
76-
rand_filename = "/tmp/db.backup_{}".format(fauxfactory.gen_alphanumeric())
76+
rand_filename = f"/tmp/db.backup_{fauxfactory.gen_alphanumeric()}"
7777
db_storage_ssh.get_file("{}/candu.db.backup".format(
7878
conf.cfme_data.bottlenecks.backup_path), rand_filename)
7979
app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

cfme/fixtures/depot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def depot_machine_ipv4_and_ipv6(request, appliance):
6363
data = cfme_data.log_db_operations
6464
vm = deploy_template(
6565
data.log_db_depot_template.provider,
66-
"long-test-depot-{}".format(fauxfactory.gen_alphanumeric()),
66+
f"long-test-depot-{fauxfactory.gen_alphanumeric()}",
6767
template_name=data.log_db_depot_template.template_name
6868
)
6969
vm.ensure_state(VmState.RUNNING)

cfme/fixtures/service_fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def import_dialog(appliance, file_name):
251251
import_export.import_dialog(file_path)
252252

253253
# Read yml to get the field name
254-
with open(file_path, "r") as stream:
254+
with open(file_path) as stream:
255255
dialog = yaml.load(stream, Loader=yaml.BaseLoader)
256256
# It returns list of dicts
257257
description = dialog[0].get("description")

cfme/fixtures/xunit_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=broad-except
2-
import datetime
32
import re
3+
from datetime import datetime
44

55
import pytest
66
from lxml import etree
@@ -29,7 +29,8 @@
2929
compiled_blacklist = re.compile('(' + ')|('.join(blacklist) + ')')
3030

3131

32-
timestamp = '{:%Y%m%d%H%M%S}'.format(datetime.datetime.now())
32+
now = datetime.now()
33+
timestamp = now.strftime("%Y%m%d%H%M%S")
3334

3435

3536
default_custom_fields = {

cfme/scripting/bz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_report(directory):
5858
])
5959
# read the generated yaml
6060
try:
61-
with open("bz-report.yaml", "r") as stream:
61+
with open("bz-report.yaml") as stream:
6262
info = yaml.load(stream, Loader=yaml.BaseLoader)
6363
except OSError:
6464
msg = (

cfme/scripting/ipyshell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def main(no_quickstart):
2525
from cfme.utils.path import conf_path
2626
custom_import_path = conf_path.join('miq_python_startup.py')
2727
if custom_import_path.exists():
28-
with open(custom_import_path.strpath, 'r') as custom_import_file:
28+
with open(custom_import_path.strpath) as custom_import_file:
2929
custom_import_code = custom_import_file.read()
30-
print('Importing custom code:\n{}'.format(custom_import_code.strip()))
30+
print(f'Importing custom code:\n{custom_import_code.strip()}')
3131
ipython.run_cell(custom_import_code)
3232
else:
3333
print(

cfme/scripting/polarion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def populate(
8484
polarion_url,
8585
template_format,
8686
):
87-
with open(template, 'r') as template_file:
87+
with open(template) as template_file:
8888
input_yaml, indent, block_indent = load_yaml_guess_indent(template_file)
8989

9090
# first update credentials fields

0 commit comments

Comments
 (0)