Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
rdm-software
SaQC
Commits
e4d58b8f
Commit
e4d58b8f
authored
5 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
a few simplifications
parent
554cf654
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
saqc/dsl/evaluator.py
+1
-10
1 addition, 10 deletions
saqc/dsl/evaluator.py
test/flagger/test_baseflagger.py
+1
-3
1 addition, 3 deletions
test/flagger/test_baseflagger.py
with
2 additions
and
13 deletions
saqc/dsl/evaluator.py
+
1
−
10
View file @
e4d58b8f
...
...
@@ -46,12 +46,6 @@ def initFunctionNamespace(nodata, flagger):
}
def
setKey
(
d
,
key
,
value
):
out
=
copy
.
copy
(
d
)
out
[
key
]
=
value
return
out
def
_raiseNameError
(
name
,
expr
):
raise
NameError
(
"
name
'
{:}
'
is not definied (failing expression:
'
{:}
'
)
"
...
...
@@ -63,8 +57,6 @@ def evalExpression(expr: str, flagger: BaseFlagger,
field
:
str
,
nodata
:
Number
=
np
.
nan
,
**
namespace
:
dict
)
->
np
.
ndarray
:
# type: (...) -> np.ndarray[bool]
def
_eval
(
node
,
namespace
):
# type: (ast.Node, dict) -> None
# the namespace dictionary should provide the data frame for the device
...
...
@@ -97,8 +89,7 @@ def evalExpression(expr: str, flagger: BaseFlagger,
except
KeyError
:
_raiseNameError
(
node
.
func
.
id
,
expr
)
namespace
=
setKey
(
namespace
,
"
target
"
,
target
)
args
=
[
_eval
(
n
,
namespace
)
for
n
in
node
.
args
]
args
=
[
_eval
(
n
,
{
**
namespace
,
**
{
"
target
"
:
target
}})
for
n
in
node
.
args
]
return
func
(
*
args
)
elif
isinstance
(
node
,
ast
.
Name
):
# <variable>
...
...
This diff is collapsed.
Click to expand it.
test/flagger/test_baseflagger.py
+
1
−
3
View file @
e4d58b8f
...
...
@@ -29,9 +29,7 @@ def test_accesors():
def
test_isFlagged
():
flagger
=
BaseFlagger
([
-
1
,
0
,
1
])
data
=
initData
(
cols
=
1
).
iloc
[:
50
]
flags
=
pd
.
DataFrame
(
index
=
data
.
index
,
columns
=
data
.
columns
,
data
=
flagger
.
UNFLAGGED
)
flags
=
flagger
.
initFlags
(
data
)
flags
.
iloc
[:
10
]
=
flagger
.
BAD
flags
.
iloc
[
10
:
20
]
=
flagger
.
GOOD
...
...
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