misc: Update black to process src/python/m5/ext/pystats
The exclusion in .pre-commit-config.yaml covered all files in src/python/m5/ext. This excludes src/python/m5/exit/pystats, which we want covered by black. This commit updates .pre-commit-config.yaml to only exclude src/python/m5/ext/pyfdt. This change also runs black on these files. Change-Id: Iecff45ea2a27a37fc0d00b867d41300aad911c7a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63711 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
committed by
Bobby Bruce
parent
5204b58e19
commit
be33be87da
@@ -44,7 +44,7 @@ exclude: |
|
|||||||
build/.*|
|
build/.*|
|
||||||
src/systemc/ext/.*|
|
src/systemc/ext/.*|
|
||||||
src/systemc/tests/.*/.*|
|
src/systemc/tests/.*/.*|
|
||||||
src/python/m5/ext/.*|
|
src/python/m5/ext/pyfdt/.*|
|
||||||
tests/.*/ref/.*
|
tests/.*/ref/.*
|
||||||
)$
|
)$
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ from .serializable_stat import SerializableStat
|
|||||||
from .statistic import Scalar, Statistic
|
from .statistic import Scalar, Statistic
|
||||||
from .timeconversion import TimeConversion
|
from .timeconversion import TimeConversion
|
||||||
|
|
||||||
|
|
||||||
class Group(SerializableStat):
|
class Group(SerializableStat):
|
||||||
"""
|
"""
|
||||||
Used to create the heirarchical stats structure. A Group object contains a
|
Used to create the heirarchical stats structure. A Group object contains a
|
||||||
@@ -70,7 +71,7 @@ class Group(SerializableStat):
|
|||||||
def children(
|
def children(
|
||||||
self, predicate: Optional[Callable[[str], bool]] = None
|
self, predicate: Optional[Callable[[str], bool]] = None
|
||||||
) -> Iterator[Union["Group", Statistic]]:
|
) -> Iterator[Union["Group", Statistic]]:
|
||||||
""" Iterate through all of the children, optionally with a predicate
|
"""Iterate through all of the children, optionally with a predicate
|
||||||
|
|
||||||
```
|
```
|
||||||
>>> system.children(lambda _name: 'cpu' in name)
|
>>> system.children(lambda _name: 'cpu' in name)
|
||||||
@@ -91,7 +92,7 @@ class Group(SerializableStat):
|
|||||||
yield obj
|
yield obj
|
||||||
|
|
||||||
def find(self, name: str) -> Iterator[Union["Group", Statistic]]:
|
def find(self, name: str) -> Iterator[Union["Group", Statistic]]:
|
||||||
""" Find all stats that match the name
|
"""Find all stats that match the name
|
||||||
|
|
||||||
This function searches all of the "children" in this group. It yields
|
This function searches all of the "children" in this group. It yields
|
||||||
the set of attributes (children) that have the `name` as a substring.
|
the set of attributes (children) that have the `name` as a substring.
|
||||||
@@ -117,7 +118,7 @@ class Group(SerializableStat):
|
|||||||
def find_re(
|
def find_re(
|
||||||
self, regex: Union[str, Pattern]
|
self, regex: Union[str, Pattern]
|
||||||
) -> Iterator[Union["Group", Statistic]]:
|
) -> Iterator[Union["Group", Statistic]]:
|
||||||
""" Find all stats that match the name
|
"""Find all stats that match the name
|
||||||
|
|
||||||
This function searches all of the "children" in this group. It yields
|
This function searches all of the "children" in this group. It yields
|
||||||
the set of attributes (children) that have the `name` mathing the
|
the set of attributes (children) that have the `name` mathing the
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ from typing import Dict, List, Union, Any, IO
|
|||||||
|
|
||||||
from .storagetype import StorageType
|
from .storagetype import StorageType
|
||||||
|
|
||||||
|
|
||||||
class SerializableStat:
|
class SerializableStat:
|
||||||
"""
|
"""
|
||||||
Classes which inherit from SerializableStat can be serialized as JSON
|
Classes which inherit from SerializableStat can be serialized as JSON
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ from .group import Group
|
|||||||
from .statistic import Statistic
|
from .statistic import Statistic
|
||||||
from .timeconversion import TimeConversion
|
from .timeconversion import TimeConversion
|
||||||
|
|
||||||
|
|
||||||
class SimStat(SerializableStat):
|
class SimStat(SerializableStat):
|
||||||
"""
|
"""
|
||||||
Contains all the statistics for a given simulation.
|
Contains all the statistics for a given simulation.
|
||||||
|
|||||||
Reference in New Issue
Block a user