Skip to content

Commit

Permalink
fix: class slots do not include attributes of super class
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelm committed Feb 5, 2022
1 parent 9ab0066 commit a6d4d11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 5 additions & 6 deletions broadworks_ocip/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from collections import namedtuple
from typing import Any
from typing import Dict
from typing import List
from typing import Tuple

import attr
Expand Down Expand Up @@ -50,7 +51,7 @@ class OCIType:
OCIType - Base type for all the OCI-P component classes
"""

__slots__ = ["_frozen"]
__slots__: List[str] = ["_frozen"]

def __init__(self, **kwargs):
for elem in self._elements():
Expand Down Expand Up @@ -374,7 +375,7 @@ class OCICommand(OCIType):
there to give a known value for testing.
"""

__slots__ = ["_frozen", "session_id"]
__slots__: List[str] = ["session_id"]

def __init__(
self,
Expand Down Expand Up @@ -495,7 +496,7 @@ class SuccessResponse(OCIResponse):
and does not return any data.
"""

__slots__ = ["_frozen", "session_id"]
__slots__: List[str] = []

@classmethod
def _elements(cls) -> Tuple[ElementInfo, ...]:
Expand All @@ -511,14 +512,12 @@ class ErrorResponse(OCIResponse):
`OCIErrorResponse` exception is raised in `post_xml_decode_`.
"""

__slots__ = [
__slots__: List[str] = [
"error_code",
"summary",
"summary_english",
"detail",
"type",
"_frozen",
"session_id",
]

@classmethod
Expand Down
5 changes: 1 addition & 4 deletions utilities/process_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,9 @@ def write_elements(file, elements):


def write_slots(file, elements, thing):
file.write(" __slots__ = [\n")
file.write(" __slots__: List[str] = [\n")
for element in elements.values():
file.write(f' "{element["name"]}",\n')
if thing != "OCIType":
file.write(' "session_id",\n')
file.write(' "_frozen",\n')
file.write(" ]\n\n")


Expand Down

0 comments on commit a6d4d11

Please sign in to comment.