-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
495 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class LevelError(Exception): | ||
"""Raised when a requested level is not available""" | ||
|
||
def __init__(self, *args) -> None: | ||
if args: | ||
self.message = args[0] | ||
else: | ||
self.message = None | ||
|
||
def __str__(self): | ||
if self.message: | ||
return self.message | ||
else: | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from abc import abstractmethod | ||
|
||
import numpy as np | ||
|
||
from histolab.tile import Tile | ||
|
||
try: | ||
from typing import Protocol, runtime_checkable | ||
except ImportError: | ||
from typing_extensions import Protocol, runtime_checkable | ||
|
||
|
||
@runtime_checkable | ||
class Scorer(Protocol): | ||
@abstractmethod | ||
def __call__(self, tile: Tile) -> float: | ||
raise NotImplementedError | ||
|
||
|
||
class RandomScorer(Scorer): | ||
def __call__(self, tile: Tile) -> float: | ||
return np.random.random() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.