-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create empty implementation of pattern_matcher package for back-compa…
…bibility with DAS Gate
- Loading branch information
Andre Senna
committed
Sep 24, 2024
1 parent
7e323e8
commit cd8e89b
Showing
2 changed files
with
121 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .pattern_matcher import * # noqa |
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,120 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Any, Dict, FrozenSet, List, Optional, Set, Union | ||
|
||
from hyperon_das_atomdb import WILDCARD, AtomDB | ||
|
||
|
||
class PatternMatchingAnswer: | ||
|
||
def __init__(self): | ||
pass | ||
|
||
class LogicalExpression(ABC): | ||
|
||
@abstractmethod | ||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
pass | ||
|
||
class Atom(LogicalExpression, ABC): | ||
|
||
def __init__(self, atom_type: str): | ||
pass | ||
|
||
@abstractmethod | ||
def get_handle(self, db: AtomDB) -> str: | ||
pass | ||
|
||
|
||
class Node(Atom): | ||
|
||
def __init__(self, node_type: str, node_name: str): | ||
pass | ||
|
||
def get_handle(self, db: AtomDB) -> str: | ||
return "" | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class Link(Atom): | ||
|
||
def __init__(self, link_type: str, targets: List[Atom], ordered: bool): | ||
pass | ||
|
||
def get_handle(self, db: AtomDB) -> str: | ||
return "" | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
class Variable(Atom): | ||
def __init__(self, variable_name: str): | ||
pass | ||
|
||
def get_handle(self, db: AtomDB) -> str: | ||
return "" | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
class Not(LogicalExpression): | ||
|
||
def __init__(self, term: LogicalExpression): | ||
pass | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class Or(LogicalExpression): | ||
|
||
def __init__(self, terms: List[LogicalExpression]): | ||
pass | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True | ||
|
||
|
||
class And(LogicalExpression): | ||
|
||
def __init__(self, terms: List[LogicalExpression]): | ||
pass | ||
|
||
def matched( | ||
self, | ||
db: AtomDB, | ||
answer: PatternMatchingAnswer, | ||
extra_parameters: Optional[Dict[str, Any]] = None, | ||
) -> bool: | ||
return True |