Skip to content

Commit

Permalink
Add __slots__ to SubgraphView class
Browse files Browse the repository at this point in the history
  • Loading branch information
InnovativeInventor committed Jan 10, 2022
1 parent 0251cab commit 9c5265e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gerrychain/partition/assignment.py
Expand Up @@ -17,10 +17,10 @@ class Assignment(Mapping):
An :class:`Assignment` has a ``parts`` property that is a dictionary of the form
``{part: <frozenset of nodes in part>}``.
"""
__slots__ = (
__slots__ = [
'parts',
'mapping',
)
'mapping'
]

def __init__(self, parts, mapping=None, validate=True):
if validate:
Expand Down
6 changes: 6 additions & 0 deletions gerrychain/partition/subgraphs.py
@@ -1,4 +1,10 @@
class SubgraphView:
__slots__ = [
"graph",
"parts",
"subgraphs_cache"
]

def __init__(self, graph, parts):
self.graph = graph
self.parts = parts
Expand Down

0 comments on commit 9c5265e

Please sign in to comment.