misc: Run pre-commit run on all files in repo

The following command was run:

```
pre-commit run --all-files
```

This ensures all the files in the repository are formatted to pass our
checks.

Change-Id: Ia2fe3529a50ad925d1076a612d60a4280adc40de
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62572
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Bobby R. Bruce
2022-08-22 12:34:19 -07:00
committed by Bobby Bruce
parent 64add0e04d
commit 2bc5a8b71a
181 changed files with 1445 additions and 1229 deletions

View File

@@ -29,7 +29,7 @@ do
bad=`tethereal -r $trace -q -z "io,stat,100,tcp.analysis.retransmission||tcp.analysis.fast_retransmission||tcp.analysis.out_of_order||tcp.analysis.lost_segment||tcp.analysis.ack_lost_segment||tcp.analysis.window_full||tcp.analysis.duplicate_ack||tcp.analysis.duplicate_ack_num||tcp.analysis.duplicate_ack_frame" | grep 000.000 | awk '{print $2}'`
name=`dirname $trace`
if [ "$bad" != "0" ]
if [ "$bad" != "0" ]
then
echo "Run $name had problems."
fi

View File

@@ -1,10 +1,10 @@
# Rename register files to their new systematic names.
def upgrader(cpt):
is_arm = cpt.get('root', 'isa', fallback='') == 'arm'
is_arm = cpt.get("root", "isa", fallback="") == "arm"
import re
is_cpu = lambda sec: 'intRegs' in cpt[sec]
is_cpu = lambda sec: "intRegs" in cpt[sec]
cpu_sections = filter(is_cpu, cpt.sections())
for sec in cpu_sections:
@@ -19,14 +19,14 @@ def upgrader(cpt):
byte_mask = (0x1 << byte_bits) - 1
# If there's vecRegs, create regs.vector_element from it.
vec_regs = items.get('vecRegs')
vec_regs = items.get("vecRegs")
if vec_regs is not None:
reg_vals = vec_regs.split()
if is_arm:
full_bits = arm_vec_bits
else:
full_bits = regval_bits
reg_vals = ['0']
reg_vals = ["0"]
elem_bits = 32
elem_mask = (0x1 << elem_bits) - 1
@@ -41,40 +41,41 @@ def upgrader(cpt):
# Treat the element as a RegVal value, even if it's
# fewer bits in the vector registers.
for chunk in range(regval_bits // byte_bits):
bytes.append(f'{elem & byte_mask}')
bytes.append(f"{elem & byte_mask}")
elem = elem >> byte_bits
items['regs.vector_element'] = ' '.join(bytes)
items["regs.vector_element"] = " ".join(bytes)
name_map = {
'floatRegs.i': 'regs.floating_point',
'vecRegs': 'regs.vector',
'vecPredRegs': 'regs.vector_predicate',
'intRegs': 'regs.integer',
'ccRegs': 'regs.condition_code',
"floatRegs.i": "regs.floating_point",
"vecRegs": "regs.vector",
"vecPredRegs": "regs.vector_predicate",
"intRegs": "regs.integer",
"ccRegs": "regs.condition_code",
}
for old, new in name_map.items():
if old in items:
if is_arm and old in ('vecRegs', 'vecPredRegs'):
if is_arm and old in ("vecRegs", "vecPredRegs"):
reg_bits = 2048
else:
reg_bits = regval_bits
reg_vals = items[old].split()
if not is_arm and old in ('vecRegs', 'vecPredRegs'):
reg_vals = ['0']
if not is_arm and old in ("vecRegs", "vecPredRegs"):
reg_vals = ["0"]
bytes = []
for reg in reg_vals:
reg = int(reg)
for chunk in range(reg_bits // byte_bits):
bytes.append(f'{reg & byte_mask}')
bytes.append(f"{reg & byte_mask}")
reg = reg >> byte_bits
items[new] = ' '.join(bytes)
items[new] = " ".join(bytes)
del items[old]
items.setdefault('regs.condition_code', '')
items.setdefault("regs.condition_code", "")
legacy_version = 16

View File

@@ -206,8 +206,8 @@ def main():
ascii_out.write(":")
if packet.reg_dep:
num_regdeps += (
1
) # No. of packets with atleast 1 register dependency
1 # No. of packets with atleast 1 register dependency
)
for dep in packet.reg_dep:
ascii_out.write(",%s" % dep)
# New line

View File

@@ -76,4 +76,3 @@ $GEM5_DIST_SH -n $NNODES \
--script=$BOOT_SCRIPT \
--cf-args \
$CHKPT_RESTORE

View File

@@ -70,4 +70,3 @@ FROM stage1
RUN mkdir -p /riscv/
COPY --from=stage2 /riscv/_install/ /riscv/_install
ENV PATH=/riscv/_install/bin:$PATH

View File

@@ -62,4 +62,3 @@ RUN ./configure --prefix=$SST_CORE_HOME --with-python=/usr/bin/python3-config \
# Setting the environmental variables
ENV PATH=$PATH:$SST_CORE_HOME/bin
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$SST_CORE_HOME/lib/pkgconfig/

View File

@@ -1,3 +1,3 @@
[mypy]
namespace_packages = True
warn_unreachable = True
warn_unreachable = True

View File

@@ -1,4 +1,4 @@
[mypy]
namespace_packages = True
warn_unreachable = True
mypy_path = ../artifact
mypy_path = ../artifact

View File

@@ -1,4 +1,4 @@
[mypy]
namespace_packages = True
warn_unreachable = True
mypy_path = ../artifact
mypy_path = ../artifact

View File

@@ -68,4 +68,4 @@ To run the Gerrit bot every 30 minutes, add the following line to the
crontable,
```python
*/1 * * * * cd /path/to/gerrit/bot/directory && ./bot.py
```
```

View File

@@ -87,13 +87,13 @@ class GerritRestAPI:
# https://gerrit-review.googlesource.com/Documentation/
# rest-api-accounts.html#get-account
def get_account(self, account_id="self"):
""" get an account detail from an account_id """
"""get an account detail from an account_id"""
return self._get(f"/accounts/{account_id}")
# https://gerrit-review.googlesource.com/Documentation/
# rest-api-accounts.html#query-account
def query_account(self, query, limit=None):
""" get accounts based on the query """
"""get accounts based on the query"""
params = {"q": query}
if limit:
params["n"] = str(limit)
@@ -103,7 +103,7 @@ class GerritRestAPI:
# https://gerrit-review.googlesource.com/Documentation/
# rest-api-changes.html#list-changes
def query_changes(self, query, limit=None, optional_field=None):
""" query changes with maximum limit returned queries """
"""query changes with maximum limit returned queries"""
endpoint = f"/changes/"
params = {"q": query}
if limit:
@@ -116,10 +116,10 @@ class GerritRestAPI:
# https://gerrit-review.googlesource.com/Documentation/
# rest-api-changes.html#list-reviewers
def list_reviewers(self, change_id):
""" list reviewers of a change """
"""list reviewers of a change"""
return self._get(f"/changes/{change_id}/reviewers")
def add_reviewer(self, change_id, reviewer_email):
""" add a reviewer using an email address """
"""add a reviewer using an email address"""
data = {"reviewer": reviewer_email}
return self._post(f"/changes/{change_id}/reviewers/", data)

View File

@@ -39,10 +39,10 @@ from style.repo import GitRepo
def _printErrorQuit(error_message):
"""
Print an error message, followed my a help message and inform failure.
Print an error message, followed my a help message and inform failure.
@param error_message A message describing the error that caused the
failure.
@param error_message A message describing the error that caused the
failure.
"""
print(error_message)
@@ -90,10 +90,10 @@ e.g.:
def _validateTags(commit_header):
"""
Check if all tags in the commit header belong to the list of valid
gem5 tags.
Check if all tags in the commit header belong to the list of valid
gem5 tags.
@param commit_header The first line of the commit message.
@param commit_header The first line of the commit message.
"""
# List of valid tags

View File

@@ -410,5 +410,3 @@ subtley broken, when used to target a different ABI. To build these objects
correctly, we would need to use a proper cross build environment for their
corresponding languages. Something like this could likely be set up using a
tool like buildroot.

View File

@@ -327,4 +327,3 @@ Java_gem5_Ops_work_1end(JNIEnv *env, jobject obj,
{
getDispatchTable(env, obj)->m5_work_end(j_workid, j_threadid);
}

View File

@@ -211,9 +211,13 @@ def _main():
args = parser.parse_args()
incoming, outgoing, common, upstream_unknown, feature_unknown = list_changes(
args.upstream, args.feature, paths=args.paths
)
(
incoming,
outgoing,
common,
upstream_unknown,
feature_unknown,
) = list_changes(args.upstream, args.feature, paths=args.paths)
if incoming:
print("Incoming changes:")

View File

@@ -208,9 +208,13 @@ class Branch(BlobVisualData):
m = re.match("^(\w+);(\d+)\.(\d+);([0-9a-fA-Fx]+);(.*)$", string)
if m is not None:
self.reason, newStreamSeqNum, newPredictionSeqNum, newPC, id = (
m.groups()
)
(
self.reason,
newStreamSeqNum,
newPredictionSeqNum,
newPC,
id,
) = m.groups()
self.newStreamSeqNum = int(newStreamSeqNum)
self.newPredictionSeqNum = int(newPredictionSeqNum)
@@ -1151,7 +1155,7 @@ class BlobModel(object):
new_line = f.readline()
if new_line is not None and not line_is_comment(new_line):
line_wo_backslash, = extend_match.groups()
(line_wo_backslash,) = extend_match.groups()
ret = line_wo_backslash + new_line
extend_match = re.match("^(.*)\\\\$", ret)
else:

View File

@@ -67,7 +67,7 @@ def list_parser(names):
def map2(f, ls):
"""map to a depth of 2. That is, given a list of lists, apply
f to those innermost elements """
f to those innermost elements"""
return [list(map(f, l)) for l in ls]
@@ -110,5 +110,5 @@ def parse_indexed_list(string):
def parse_pairs(pairString):
"""parse a string like 'name=value name2=value2' into a
dictionary of {'name': 'value', 'name2': 'value2'} """
dictionary of {'name': 'value', 'name2': 'value2'}"""
return dict(parse_pairs_list(pairString))

View File

@@ -146,10 +146,10 @@ def decodeMessage(in_file, message):
def _EncodeVarint32(out_file, value):
"""
The encoding of the Varint32 is copied from
google.protobuf.internal.encoder and is only repeated here to
avoid depending on the internal functions in the library.
"""
The encoding of the Varint32 is copied from
google.protobuf.internal.encoder and is only repeated here to
avoid depending on the internal functions in the library.
"""
bits = value & 0x7F
value >>= 7
while value:

View File

@@ -35,4 +35,5 @@ if __name__ == "__main__":
sys.path.insert(1, join(base, "../ext/ply"))
import slicc.main
slicc.main.main()

View File

@@ -280,4 +280,3 @@ genTraceChild()
{
return new ARMTraceChild;
}

View File

@@ -117,4 +117,3 @@ class ARMTraceChild : public TraceChild
};
#endif

View File

@@ -468,4 +468,3 @@ genTraceChild()
{
return new SparcTraceChild;
}

View File

@@ -151,4 +151,3 @@ main(int argc, char * argv[], char * envp[])
}
return 0;
}

View File

@@ -54,9 +54,9 @@ from .file_types import lang_type
def safefix(fix_func):
""" Decorator for the fix functions of the Verifier class.
This function wraps the fix function and creates a backup file
just in case there is an error.
"""Decorator for the fix functions of the Verifier class.
This function wraps the fix function and creates a backup file
just in case there is an error.
"""
def safefix_wrapper(*args, **kwargs):
@@ -474,29 +474,29 @@ class BoolCompare(LineVerifier):
class StructureBraces(LineVerifier):
""" Check if the opening braces of structures are not on the same line of
the structure name. This includes classes, structs, enums and unions.
"""Check if the opening braces of structures are not on the same line of
the structure name. This includes classes, structs, enums and unions.
This verifier matches lines starting in optional indent, followed by
an optional typedef and the structure's keyword, followed by any
character until the first opening brace is seen. Any extra characters
after the opening brace are saved for a recursive check, if needed.
This verifier matches lines starting in optional indent, followed by
an optional typedef and the structure's keyword, followed by any
character until the first opening brace is seen. Any extra characters
after the opening brace are saved for a recursive check, if needed.
This fixes, for example:
1) "struct A {"
2) "enum{"
3) " class B { // This is a class"
4) "union { struct C {"
to:
1) "struct A\n{"
2) "enum\n{"
3) " class B\n {\n // This is a class"
4) "union\n{\n struct C\n {"
This fixes, for example:
1) "struct A {"
2) "enum{"
3) " class B { // This is a class"
4) "union { struct C {"
to:
1) "struct A\n{"
2) "enum\n{"
3) " class B\n {\n // This is a class"
4) "union\n{\n struct C\n {"
@todo Make this work for multi-line structure declarations. e.g.,
@todo Make this work for multi-line structure declarations. e.g.,
class MultiLineClass
: public BaseClass {
class MultiLineClass
: public BaseClass {
"""
languages = set(("C", "C++"))

View File

@@ -1,21 +1,21 @@
# Copyright (c) 2015, University of Kaiserslautern
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR

View File

@@ -98,4 +98,3 @@ struct Target: sc_module
};
#endif //__SIM_SC_TARGET_HH__

View File

@@ -1,22 +1,22 @@
#!/bin/bash
# Copyright (c) 2015, University of Kaiserslautern
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR

View File

@@ -146,6 +146,3 @@ $fullcmd = "$FindBin::Bin/rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out";
print "Executing $fullcmd\n";
system($fullcmd);