-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from PinoutLTD/development
add reports. search for a ticket by description
- Loading branch information
Showing
11 changed files
with
107 additions
and
31 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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
from rrs_operator.src.robonomics import RobonomicsHelper | ||
from rrs_operator.src.odoo import Odoo | ||
|
||
|
||
class Operator: | ||
def __init__(self) -> None: | ||
self.odoo = Odoo() | ||
self.robonomics = RobonomicsHelper(self.odoo) | ||
self.robonomics.subscribe() | ||
|
||
def get_robonomics_add_user_callback(self) -> None: | ||
return self.robonomics.add_user_callback | ||
return self.robonomics.add_user_callback |
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
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 @@ | ||
from .reports_fabric import ReportsFabric |
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,15 @@ | ||
from .src import Report | ||
from .src import WarningsReport, ErrorsReport, UnrespondedDevicesReport | ||
|
||
|
||
class ReportsFabric: | ||
"""Fabric to select Report based on its type""" | ||
|
||
@staticmethod | ||
def get_report(type: str) -> Report: | ||
if type == "warnings": | ||
return WarningsReport() | ||
if type == "errors": | ||
return ErrorsReport() | ||
if type == "unresponded_devices": | ||
return UnrespondedDevicesReport() |
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,4 @@ | ||
from .report import Report | ||
from .warnings import WarningsReport | ||
from .errors import ErrorsReport | ||
from .unresponded_devices import UnrespondedDevicesReport |
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,8 @@ | ||
from .report import Report | ||
|
||
|
||
class ErrorsReport(Report): | ||
"""Class for reports with errors""" | ||
|
||
def get_descriptions(self, unparsed_description: str) -> list: | ||
return super().get_descriptions(unparsed_description) |
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,9 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
|
||
class Report(ABC): | ||
"""Base class (interface) for reports""" | ||
|
||
@abstractmethod | ||
def get_descriptions(self, unparsed_description: str) -> list: | ||
return [unparsed_description] |
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,9 @@ | ||
from .report import Report | ||
|
||
|
||
class UnrespondedDevicesReport(Report): | ||
"""Class for reports with unresponded devices""" | ||
|
||
def get_descriptions(self, unparsed_description: str) -> list: | ||
devices = unparsed_description.split("*") | ||
return devices |
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,9 @@ | ||
from .report import Report | ||
|
||
|
||
class WarningsReport(Report): | ||
"""Class for reports with warnings""" | ||
|
||
def get_descriptions(self, unparsed_description: str) -> list: | ||
warnigns = unparsed_description.split("*") | ||
return warnigns |