Commit 45f10f9e authored by GromeTT's avatar GromeTT
Browse files

ENH: Added documentation for

parent 09cd2354
from ml.identifier import ID """This module implements the role class."""
from abc import ABC
import sys import sys
from abc import ABC
from ml.identifier import ID
class Role(ABC): class Role(ABC):
"""Each Role class manages a role which can be assigned to things."""
def __init__(self, name="", identifier=""): def __init__(self, name="", identifier=""):
"""Constructs a new Role class object with the given name and
:param name: Name of the feature
:param identifier: Identifier of the feature
self.__identifier = ID(identifier).identifier self.__identifier = ID(identifier).identifier
self.__name = name self.__name = name
# TODO: Remove code duplication (
if 'ml\\fml40' in sys.modules[self.__class__.__module__].__file__: if 'ml\\fml40' in sys.modules[self.__class__.__module__].__file__:
self.__class_name = "fml40::{}".format(self.__class__.__name__) self.__class_name = "fml40::{}".format(self.__class__.__name__)
else: else:
...@@ -14,22 +27,53 @@ def __init__(self, name="", identifier=""): ...@@ -14,22 +27,53 @@ def __init__(self, name="", identifier=""):
@property @property
def class_name(self): def class_name(self):
"""Sets __class_name to value.
:param value: New class name
return self.__class_name return self.__class_name
@property @property
def name(self): def name(self):
"""Returns the object's name.
:returns: Name of the object
:rtype: str
return self.__name return self.__name
@name.setter @name.setter
def name(self, value): def name(self, value):
"""Sets __name to value.
:param value: New name
self.__name = value self.__name = value
@property @property
def identifier(self): def identifier(self):
"""Returns the object's indentifier.
:returns: Identifier
:rtype: str
return self.__identifier return self.__identifier
@identifier.setter @identifier.setter
def identifier(self, value): def identifier(self, value):
"""Builds an ID object from value and assigns the resulting identifier
to __identifier.
:param value: Proposal of the identifier
self.__identifier = ID(value).identifier self.__identifier = ID(value).identifier
def to_json(self): def to_json(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment