Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added type hints to LayerFieldsContainer class for consistency #717

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading