Skip to content

Commit

Permalink
Add final decorator for type checker
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Apr 30, 2024
1 parent 3c8e1b2 commit b37756e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion grizzly/adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from abc import ABCMeta, abstractmethod
from pathlib import Path
from typing import Any, Dict, Generator, Optional, Tuple
from typing import Any, Dict, Generator, Optional, Tuple, final

from grizzly.common.storage import TestCase
from grizzly.common.utils import DEFAULT_TIME_LIMIT, HARNESS_FILE
Expand Down Expand Up @@ -65,6 +65,7 @@ def __enter__(self) -> "Adapter":
def __exit__(self, *exc: Any) -> None:
self.cleanup()

@final
def cleanup(self) -> None:
"""Automatically called once at shutdown. Used internally by Grizzly.
*** DO NOT OVERRIDE! ***
Expand All @@ -77,6 +78,7 @@ def cleanup(self) -> None:
"""
self.shutdown()

@final
def enable_harness(self, path: Path = HARNESS_FILE) -> None:
"""Enable use of a harness during fuzzing. By default no harness is used.
*** DO NOT OVERRIDE! ***
Expand All @@ -90,6 +92,7 @@ def enable_harness(self, path: Path = HARNESS_FILE) -> None:
self._harness = path.read_bytes()
assert self._harness, f"empty harness file '{path.resolve()}'"

@final
def get_harness(self) -> Optional[bytes]:
"""Get the harness. Used internally by Grizzly.
*** DO NOT OVERRIDE! ***
Expand Down
3 changes: 2 additions & 1 deletion grizzly/target/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from os import environ
from pathlib import Path
from threading import Lock
from typing import Any, Dict, Optional, Set, Tuple
from typing import Any, Dict, Optional, Set, Tuple, final

from ..common.report import Report
from ..common.utils import CertificateBundle, grz_tmp
Expand Down Expand Up @@ -141,6 +141,7 @@ def check_result(self, ignored: Set[str]) -> Result:
Result code.
"""

@final
def cleanup(self) -> None:
"""Perform necessary cleanup. DO NOT OVERRIDE.
Expand Down

0 comments on commit b37756e

Please sign in to comment.