From aeac72e1e36b5e5d1ac816aae5cd858621a587c0 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 2 Aug 2022 08:33:21 +0200 Subject: Style fixes --- lib/spack/llnl/util/lang.py | 2 +- lib/spack/spack/parse.py | 6 +++--- lib/spack/spack/spec.py | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py index 8ec7113782..5b56990a6f 100644 --- a/lib/spack/llnl/util/lang.py +++ b/lib/spack/llnl/util/lang.py @@ -486,7 +486,7 @@ class HashableMap(MutableMapping): """This is a hashable, comparable dictionary. Hash is performed on a tuple of the values in the dictionary.""" - __slots__ = 'dict', + __slots__ = ("dict",) def __init__(self): self.dict = {} diff --git a/lib/spack/spack/parse.py b/lib/spack/spack/parse.py index 91cebe9063..10f460e776 100644 --- a/lib/spack/spack/parse.py +++ b/lib/spack/spack/parse.py @@ -17,7 +17,7 @@ import spack.util.path as sp class Token(object): """Represents tokens; generated from input by lexer and fed to parse().""" - __slots__ = 'type', 'value', 'start', 'end' + __slots__ = "type", "value", "start", "end" def __init__(self, type, value="", start=0, end=0): self.type = type @@ -41,7 +41,7 @@ class Token(object): class Lexer(object): """Base class for Lexers that keep track of line numbers.""" - __slots__ = 'scanner0', 'scanner1', 'mode', 'mode_switches_01', 'mode_switches_10' + __slots__ = "scanner0", "scanner1", "mode", "mode_switches_01", "mode_switches_10" def __init__(self, lexicon0, mode_switches_01=[], lexicon1=[], mode_switches_10=[]): self.scanner0 = re.Scanner(lexicon0) @@ -93,7 +93,7 @@ class Lexer(object): class Parser(object): """Base class for simple recursive descent parsers.""" - __slots__ = 'tokens', 'token', 'next', 'lexer', 'text' + __slots__ = "tokens", "token", "next", "lexer", "text" def __init__(self, lexer): self.tokens = iter([]) # iterators over tokens, handled in order. diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 4f15b5b839..8263c25876 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -243,7 +243,7 @@ class ArchSpec(object): """Return the frontend architecture""" return ArchSpec._return_arch("frontend", "frontend") - __slots__ = '_platform', '_os', '_target' + __slots__ = "_platform", "_os", "_target" def __init__(self, spec_or_platform_tuple=(None, None, None)): """Architecture specification a package should be built with. @@ -555,7 +555,7 @@ class CompilerSpec(object): versions that a package should be built with. CompilerSpecs have a name and a version list.""" - __slots__ = 'name', 'versions' + __slots__ = "name", "versions" def __init__(self, *args): nargs = len(args) @@ -681,7 +681,7 @@ class DependencySpec(object): - deptypes: list of strings, representing dependency relationships. """ - __slots__ = 'parent', 'spec', 'deptypes' + __slots__ = "parent", "spec", "deptypes" def __init__(self, parent, spec, deptypes): self.parent = parent @@ -724,7 +724,7 @@ _valid_compiler_flags = ["cflags", "cxxflags", "fflags", "ldflags", "ldlibs", "c class FlagMap(lang.HashableMap): - __slots__ = 'spec', + __slots__ = ("spec",) def __init__(self, spec): super(FlagMap, self).__init__() @@ -810,7 +810,8 @@ class _EdgeMap(Mapping): Edges are stored in a dictionary and keyed by package name. """ - __slots__ = 'edges', 'store_by_child' + + __slots__ = "edges", "store_by_child" def __init__(self, store_by=EdgeDirection.child): # Sanitize input arguments @@ -4992,7 +4993,7 @@ _lexer = SpecLexer() class SpecParser(spack.parse.Parser): """Parses specs.""" - __slots__ = 'previous', '_initial' + __slots__ = "previous", "_initial" def __init__(self, initial_spec=None): """Construct a new SpecParser. -- cgit v1.2.3-70-g09d2