Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Deadbeat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
713
Warden
Deadbeat
Commits
e1a208cc
Commit
e1a208cc
authored
May 30, 2018
by
Pavel Kácha
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup constant getter
parent
05d8b3cf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
deadbeat/movement.py
+3
-12
3 additions, 12 deletions
deadbeat/movement.py
labrea.py
+1
-1
1 addition, 1 deletion
labrea.py
with
4 additions
and
13 deletions
deadbeat/movement.py
+
3
−
12
View file @
e1a208cc
...
@@ -17,6 +17,7 @@ import os.path as pth
...
@@ -17,6 +17,7 @@ import os.path as pth
import
ctypes
import
ctypes
import
struct
import
struct
import
fcntl
import
fcntl
import
itertools
import
logging
import
logging
from
collections
import
namedtuple
,
deque
,
Mapping
,
defaultdict
from
collections
import
namedtuple
,
deque
,
Mapping
,
defaultdict
from
operator
import
itemgetter
from
operator
import
itemgetter
...
@@ -24,7 +25,7 @@ from operator import itemgetter
...
@@ -24,7 +25,7 @@ from operator import itemgetter
__all__
=
[
__all__
=
[
"
Object
"
,
"
Cog
"
,
"
DummyEscapement
"
,
"
Escapement
"
,
"
Train
"
,
"
INotify
"
,
"
Object
"
,
"
Cog
"
,
"
DummyEscapement
"
,
"
Escapement
"
,
"
Train
"
,
"
INotify
"
,
"
train_split
"
,
"
train_line
"
,
"
train_split
"
,
"
train_line
"
,
"
itemsetter
"
,
"
nullsetter
"
,
"
constgetter
"
,
"
uuidsetter
"
,
"
itemsetter
"
,
"
nullsetter
"
,
"
constgetter
"
,
"
uuidsetter
"
,
"
dictupdater
"
,
"
selfgetter
"
,
"
basestring
"
,
"
string_types
"
,
"
basestring
"
,
"
string_types
"
,
"
catch
"
,
"
setn
"
,
"
appendn
"
"
catch
"
,
"
setn
"
,
"
appendn
"
]
]
...
@@ -49,10 +50,6 @@ except NameError:
...
@@ -49,10 +50,6 @@ except NameError:
# Getters/setters
# Getters/setters
def
itemconst
(
attr
):
"""
Return itemgetter of constant immutable objects.
"""
return
lambda
obj
:
attr
def
itemsetter
(
attr
):
def
itemsetter
(
attr
):
"""
Return setter for specific key.
"""
"""
Return setter for specific key.
"""
...
@@ -70,13 +67,7 @@ def nullsetter(obj, attr):
...
@@ -70,13 +67,7 @@ def nullsetter(obj, attr):
def
constgetter
(
const
):
def
constgetter
(
const
):
"""
Return itemgetter of constant immutable objects.
"""
"""
Return itemgetter of constant immutable objects.
"""
return
itertools
.
repeat
(
const
).
next
tmp
=
const
def
getter
(
obj
):
return
tmp
return
getter
def
uuidsetter
(
attr
):
def
uuidsetter
(
attr
):
"""
Return setter, which generates and sets new UUID.
"""
"""
Return setter, which generates and sets new UUID.
"""
...
...
This diff is collapsed.
Click to expand it.
labrea.py
+
1
−
1
View file @
e1a208cc
...
@@ -168,7 +168,7 @@ def main():
...
@@ -168,7 +168,7 @@ def main():
serialise
=
text
.
JSONMarshall
(
default
=
idea
.
lite
.
Idea
.
json_default
,
sort_keys
=
True
,
indent
=
4
)
serialise
=
text
.
JSONMarshall
(
default
=
idea
.
lite
.
Idea
.
json_default
,
sort_keys
=
True
,
indent
=
4
)
#~ import jinja2
#~ import jinja2
#~ jinja = jinja2.Environment(loader=jinja2.FileSystemLoader("."))
#~ jinja = jinja2.Environment(loader=jinja2.FileSystemLoader("."))
#~ serialise = marshall.Jinja(jinja_env=jinja, template_get=
item
const("labrea-template.txt"))
#~ serialise = marshall.Jinja(jinja_env=jinja, template_get=const
getter
("labrea-template.txt"))
output
=
fs
.
FilerDrain
(
train
=
train
,
directory
=
cfg
.
output_dir
)
output
=
fs
.
FilerDrain
(
train
=
train
,
directory
=
cfg
.
output_dir
)
train
.
update
(
train
.
update
(
movement
.
train_line
(
watcher
,
reg_list
,
normalize
,
filter_source
,
filter_target
,
aggregate
,
const_enrich
,
convert
,
anonymise
,
serialise
,
output
)
movement
.
train_line
(
watcher
,
reg_list
,
normalize
,
filter_source
,
filter_target
,
aggregate
,
const_enrich
,
convert
,
anonymise
,
serialise
,
output
)
...
...
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