Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fml40-reference-implementation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KWH40
fml40-reference-implementation
Commits
45f10f9e
Commit
45f10f9e
authored
4 years ago
by
GromeTT
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Added documentation for role.py
parent
09cd2354
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!8
Feature documentation
,
!6
Feature documentation alb
,
!5
Feature documentation alb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ml/role.py
+46
-2
46 additions, 2 deletions
ml/role.py
with
46 additions
and
2 deletions
ml/role.py
+
46
−
2
View file @
45f10f9e
from
ml.identifier
import
ID
from
abc
import
ABC
"""
This module implements the role class.
"""
import
sys
from
abc
import
ABC
from
ml.identifier
import
ID
class
Role
(
ABC
):
"""
Each Role class manages a role which can be assigned to things.
"""
def
__init__
(
self
,
name
=
""
,
identifier
=
""
):
"""
Constructs a new Role class object with the given name and
identifier.
:param name: Name of the feature
:param identifier: Identifier of the feature
"""
self
.
__identifier
=
ID
(
identifier
).
identifier
self
.
__name
=
name
# TODO: Remove code duplication (feature.py).
if
'
ml
\\
fml40
'
in
sys
.
modules
[
self
.
__class__
.
__module__
].
__file__
:
self
.
__class_name
=
"
fml40::{}
"
.
format
(
self
.
__class__
.
__name__
)
else
:
...
...
@@ -14,22 +27,53 @@ def __init__(self, name="", identifier=""):
@property
def
class_name
(
self
):
"""
Sets __class_name to value.
:param value: New class name
"""
return
self
.
__class_name
@property
def
name
(
self
):
"""
Returns the object
'
s name.
:returns: Name of the object
:rtype: str
"""
return
self
.
__name
@name.setter
def
name
(
self
,
value
):
"""
Sets __name to value.
:param value: New name
"""
self
.
__name
=
value
@property
def
identifier
(
self
):
"""
Returns the object
'
s indentifier.
:returns: Identifier
:rtype: str
"""
return
self
.
__identifier
@identifier.setter
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
def
to_json
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment