Style fixes

This commit is contained in:
Massimiliano Culpo 2022-08-02 08:33:21 +02:00 committed by Todd Gamblin
parent 0b832b2929
commit aeac72e1e3
3 changed files with 11 additions and 10 deletions

View File

@ -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 = {}

View File

@ -17,7 +17,7 @@
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 @@ def __eq__(self, other):
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 @@ def lex(self, text):
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.

View File

@ -243,7 +243,7 @@ def frontend_arch():
"""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 @@ def canonical(self):
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 @@ def __init__(self):
class SpecParser(spack.parse.Parser):
"""Parses specs."""
__slots__ = 'previous', '_initial'
__slots__ = "previous", "_initial"
def __init__(self, initial_spec=None):
"""Construct a new SpecParser.