Skip to content

Commit

Permalink
Merge pull request #717 from veedubb/type_hints
Browse files Browse the repository at this point in the history
Added type hints to LayerFieldsContainer class for consistency
  • Loading branch information
KimiNewt authored Dec 4, 2024
2 parents fb2caf6 + d66c831 commit 9baf604
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pyshark/packet/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ def __new__(cls, main_field, *args, **kwargs):
def __dir__(self):
return dir(type(self)) + list(self.__dict__.keys()) + dir(self.main_field)

def add_field(self, field):
def add_field(self, field) -> None:
self.fields.append(field)

@property
def all_fields(self):
def all_fields(self) -> list:
"""Returns all fields in a list, the main field followed by the alternate fields."""
return self.fields

@property
def main_field(self):
def main_field(self) -> LayerField:
return self.fields[0]

@property
def alternate_fields(self):
def alternate_fields(self) -> list:
"""Return the alternate values of this field containers (non-main ones)."""
return self.fields[1:]

Expand Down

0 comments on commit 9baf604

Please sign in to comment.