misc: Run pre-commit run --all-files

This ensures `isort` is applied to all files in the repo.

Change-Id: Ib7ced1c924ef1639542bf0d1a01c5737f6ba43e9
This commit is contained in:
Bobby R. Bruce
2023-11-29 22:06:41 -08:00
parent 7d67109ca2
commit d11c40dcac
681 changed files with 3729 additions and 2487 deletions

View File

@@ -38,38 +38,39 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys
from types import FunctionType, MethodType, ModuleType
from functools import wraps
import inspect
import sys
from functools import wraps
from types import (
FunctionType,
MethodType,
ModuleType,
)
import m5
from m5.util import *
from m5.util.pybind import *
from m5.citations import gem5_citations
# Use the pyfdt and not the helper class, because the fdthelper
# relies on the SimObject definition
from m5.ext.pyfdt import pyfdt
# There are a few things we need that aren't in params.__all__ since
# normal users don't need them
# Have to import params up top since Param is referenced on initial
# load (when SimObject class references Param to create a class
# variable, the 'name' param)...
from m5.params import *
# There are a few things we need that aren't in params.__all__ since
# normal users don't need them
from m5.params import (
ParamDesc,
Port,
SimObjectVector,
VectorParamDesc,
isNullPointer,
SimObjectVector,
Port,
)
from m5.proxy import *
from m5.proxy import isproxy
from m5.util import *
from m5.util.pybind import *
#####################################################################
#

View File

@@ -40,18 +40,19 @@ except ImportError:
in_gem5 = False
if in_gem5:
from . import SimObject
from . import core
from . import defines
from . import objects
from . import params
from . import stats
from . import (
SimObject,
core,
defines,
objects,
params,
stats,
)
if defines.buildEnv["USE_SYSTEMC"]:
from . import systemc
from . import tlm
from . import util
from .event import *
from .main import main
from .simulate import *

View File

@@ -26,11 +26,15 @@
from collections.abc import Mapping
import _m5.debug
from _m5.debug import SimpleFlag, CompoundFlag
from _m5.debug import schedBreak
from m5.util import printList
import _m5.debug
from _m5.debug import (
CompoundFlag,
SimpleFlag,
schedBreak,
)
def help():
sorted_flags = sorted(flags.items(), key=lambda kv: kv[0])

View File

@@ -39,11 +39,14 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import m5
import _m5.event
import _m5.event
from _m5.event import GlobalSimLoopExitEvent as SimExit
from _m5.event import PyEvent as Event
from _m5.event import getEventQueue, setEventQueue
from _m5.event import (
getEventQueue,
setEventQueue,
)
mainq = None

View File

@@ -25,13 +25,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from .abstract_stat import AbstractStat
from .serializable_stat import SerializableStat
from .group import Group
from .jsonloader import JsonLoader
from .serializable_stat import SerializableStat
from .simstat import SimStat
from .statistic import Statistic
from .storagetype import StorageType
from .timeconversion import TimeConversion
from .jsonloader import JsonLoader
__all__ = [
"AbstractStat",

View File

@@ -24,8 +24,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from .serializable_stat import SerializableStat
import re
from typing import (
Callable,
@@ -35,6 +33,8 @@ from typing import (
Union,
)
from .serializable_stat import SerializableStat
class AbstractStat(SerializableStat):
"""

View File

@@ -33,7 +33,10 @@ from typing import (
)
from .abstract_stat import AbstractStat
from .statistic import Scalar, Statistic
from .statistic import (
Scalar,
Statistic,
)
from .timeconversion import TimeConversion

View File

@@ -24,12 +24,24 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from json.decoder import JSONDecodeError
from .simstat import SimStat
from .statistic import Scalar, Distribution, Accumulator, Statistic
from .group import Group, Vector
import json
from typing import IO, Union
from json.decoder import JSONDecodeError
from typing import (
IO,
Union,
)
from .group import (
Group,
Vector,
)
from .simstat import SimStat
from .statistic import (
Accumulator,
Distribution,
Scalar,
Statistic,
)
class JsonLoader(json.JSONDecoder):

View File

@@ -24,9 +24,15 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from datetime import datetime
import json
from typing import Dict, List, Union, Any, IO
from datetime import datetime
from typing import (
IO,
Any,
Dict,
List,
Union,
)
from .storagetype import StorageType

View File

@@ -25,7 +25,12 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from datetime import datetime
from typing import Dict, List, Optional, Union
from typing import (
Dict,
List,
Optional,
Union,
)
from .abstract_stat import AbstractStat
from .group import Group

View File

@@ -25,7 +25,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from abc import ABC
from typing import Any, Iterable, Optional, Union, List
from typing import (
Any,
Iterable,
List,
Optional,
Union,
)
from .abstract_stat import AbstractStat
from .storagetype import StorageType

View File

@@ -379,18 +379,24 @@ def _check_tracing():
def main():
import m5
from m5.util.terminal_formatter import TerminalFormatter
import _m5.core
from . import core
from . import debug
from . import defines
from . import event
from . import info
from . import stats
from . import trace
from .util import inform, panic, isInteractive
from m5.util.terminal_formatter import TerminalFormatter
from . import (
core,
debug,
defines,
event,
info,
stats,
trace,
)
from .util import (
inform,
isInteractive,
panic,
)
options, arguments = parse_options()

View File

@@ -23,8 +23,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from m5.SimObject import *
# The ByteOrder enum is defined in params. Expose it here so we can declare it
# to SCons, since there's no normal SimObject file to make it a part of.
from m5.params import ByteOrder
from m5.SimObject import *

View File

@@ -26,7 +26,6 @@
import optparse
import sys
from optparse import *

View File

@@ -56,13 +56,15 @@
import copy
import datetime
import math
import re
import sys
import time
import math
from . import proxy
from . import ticks
from . import (
proxy,
ticks,
)
from .util import *
@@ -1099,10 +1101,12 @@ class HostSocket(ParamValue):
self.value = value
def getValue(self):
from _m5.socket import listenSocketEmptyConfig
from _m5.socket import listenSocketInetConfig
from _m5.socket import listenSocketUnixFileConfig
from _m5.socket import listenSocketUnixAbstractConfig
from _m5.socket import (
listenSocketEmptyConfig,
listenSocketInetConfig,
listenSocketUnixAbstractConfig,
listenSocketUnixFileConfig,
)
if isinstance(self.value, str):
if self.value[0] == "@":
@@ -1443,8 +1447,16 @@ time_formats = [
def parse_time(value):
from time import gmtime, strptime, struct_time, time
from datetime import datetime, date
from datetime import (
date,
datetime,
)
from time import (
gmtime,
strptime,
struct_time,
time,
)
if isinstance(value, struct_time):
return value
@@ -1483,9 +1495,10 @@ class Time(ParamValue):
return value
def getValue(self):
from _m5.core import tm
import calendar
from _m5.core import tm
return tm.gmtime(calendar.timegm(self.value))
def __str__(self):

View File

@@ -41,22 +41,31 @@ import atexit
import os
import sys
# import the wrapped C++ functions
import _m5.drain
import _m5.core
from _m5.stats import updateEvents as updateStatEvents
from . import stats
from . import SimObject
from . import ticks
from . import objects
from . import params
from .citations import gather_citations
from m5.util.dot_writer import do_dot, do_dvfs_dot
from m5.util.dot_writer import (
do_dot,
do_dvfs_dot,
)
from m5.util.dot_writer_ruby import do_ruby_dot
from .util import fatal, warn
from .util import attrdict
import _m5.core
# import the wrapped C++ functions
import _m5.drain
from _m5.stats import updateEvents as updateStatEvents
from . import (
SimObject,
objects,
params,
stats,
ticks,
)
from .citations import gather_citations
from .util import (
attrdict,
fatal,
warn,
)
# define a MaxTick parameter, unsigned 64 bit
MaxTick = 2**64 - 1
@@ -482,6 +491,9 @@ def fork(simout="%(parent)s.f%(fork_seq)i"):
return pid
from _m5.core import disableAllListeners, listenersDisabled
from _m5.core import listenersLoopbackOnly
from _m5.core import curTick
from _m5.core import (
curTick,
disableAllListeners,
listenersDisabled,
listenersLoopbackOnly,
)

View File

@@ -38,16 +38,20 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import m5
import _m5.stats
from m5.objects import Root
from m5.params import isNullPointer
from .gem5stats import JsonOutputVistor
from m5.util import attrdict, fatal
from m5.util import (
attrdict,
fatal,
)
import _m5.stats
# Stat exports
from _m5.stats import schedStatEvent as schedEvent
from _m5.stats import periodicStatDump
from _m5.stats import schedStatEvent as schedEvent
from .gem5stats import JsonOutputVistor
outputList = []

View File

@@ -30,14 +30,19 @@ the Python Stats model.
"""
from datetime import datetime
from typing import IO, List, Union
from typing import (
IO,
List,
Union,
)
import _m5.stats
from m5.objects import *
from m5.ext.pystats.group import *
from m5.ext.pystats.simstat import *
from m5.ext.pystats.statistic import *
from m5.ext.pystats.storagetype import *
from m5.objects import *
import _m5.stats
class JsonOutputVistor:

View File

@@ -25,8 +25,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import decimal
import sys
from m5.util import warn
@@ -39,6 +39,7 @@ def fixGlobalFrequency():
def setGlobalFrequency(ticksPerSecond):
from m5.util import convert
import _m5.core
if isinstance(ticksPerSecond, int):

View File

@@ -25,4 +25,10 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Export native methods to Python
from _m5.trace import output, activate, ignore, disable, enable
from _m5.trace import (
activate,
disable,
enable,
ignore,
output,
)

View File

@@ -40,12 +40,14 @@
import os
import re
import sys
from functools import wraps
from . import convert
from .attrdict import attrdict, multiattrdict, optiondict
from .attrdict import (
attrdict,
multiattrdict,
optiondict,
)
from .multidict import multidict

View File

@@ -53,9 +53,18 @@
#
#####################################################################
import m5, os, re
from m5.SimObject import isRoot, isSimObjectVector
from m5.params import PortRef, isNullPointer
import os
import re
import m5
from m5.params import (
PortRef,
isNullPointer,
)
from m5.SimObject import (
isRoot,
isSimObjectVector,
)
from m5.util import warn
try:

View File

@@ -36,6 +36,7 @@
# Creates a visual representation of a Ruby network topology
import os
import m5
from m5.util import warn

View File

@@ -35,9 +35,10 @@
#
# Author: Glenn Bergmans
from m5.ext.pyfdt import pyfdt
import re
import os
import re
from m5.ext.pyfdt import pyfdt
from m5.SimObject import SimObject
from m5.util import fatal

View File

@@ -34,7 +34,9 @@ class TerminalFormatter:
self.__text_width = min(max_width, self.__terminal_size()[0])
def __terminal_size(self):
import fcntl, termios, struct
import fcntl
import struct
import termios
h, w, hp, wp = struct.unpack(
"HHHH",