Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leipzig Machine Learning Group
conML
python
Commits
4c120bb8
"...cwa-app-android.git" did not exist on "d598a6cf0c72f51ffb4a1819ce4c67c0545bd4a9"
Commit
4c120bb8
authored
5 years ago
by
dmt
Browse files
Options
Downloads
Patches
Plain Diff
Instead class attributes use descriptors.
parent
e8e99190
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cml/shared/settings.py
+46
-2
46 additions, 2 deletions
cml/shared/settings.py
with
46 additions
and
2 deletions
cml/shared/settings.py
+
46
−
2
View file @
4c120bb8
"""
Settings module.
"""
from
itertools
import
starmap
from
dataclasses
import
dataclass
from
configparser
import
ConfigParser
# TODO (dmt): Set default values
class
Settings
:
class
SetFeatures
:
def
__init__
(
self
):
self
.
set_features
=
None
def
__get__
(
self
,
instance
,
owner
):
return
self
.
set_features
def
__set__
(
self
,
instance
,
value
):
# TODO (dmt): Validate user input!
self
.
set_features
=
[
int
(
i
)
for
i
in
value
.
split
(
"
,
"
)]
class
CutTimeStamp
:
def
__init__
(
self
):
self
.
cut_time_stamp
=
False
def
__get__
(
self
,
instance
,
owner
):
return
self
.
cut_time_stamp
def
__set__
(
self
,
instance
,
value
):
# TODO (dmt): Validate user input!
self
.
cut_time_stamp
=
bool
(
value
)
class
BlockSize
:
def
__init__
(
self
):
self
.
block_size
=
None
def
__get__
(
self
,
instance
,
owner
):
return
self
.
block_size
def
__set__
(
self
,
instance
,
value
):
# TODO (dmt): Validate user input!
self
.
block_size
=
int
(
value
)
class
MetaSettings
(
type
):
SET_FEATURES
:
SetFeatures
=
SetFeatures
()
CUT_TIME_STAMP
:
CutTimeStamp
=
CutTimeStamp
()
BLOCK_SIZE
:
BlockSize
=
BlockSize
()
# TODO (dmt): Set default values.
class
Settings
(
metaclass
=
MetaSettings
):
INPUT_FILE
:
str
=
""
LEARN_DIR
:
str
=
""
MAX_LEARN_DIR
:
int
=
0
...
...
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