Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
35
Issue boards
Milestones
Wiki
Code
Merge requests
7
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
61dd6de3
Commit
61dd6de3
authored
3 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
typing toSequence is hard...
parent
127cf0ba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
10 merge requests
!685
Release 2.4
,
!684
Release 2.4
,
!567
Release 2.2.1
,
!566
Release 2.2
,
!501
Release 2.1
,
!372
fix doctest snippets
,
!369
Current documentation
,
!345
Rework the generic functions
,
!343
Fix Processing Functions. Introduce custom target Parameter.
,
!340
Multivariate functions
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
saqc/core/core.py
+8
-10
8 additions, 10 deletions
saqc/core/core.py
saqc/lib/tools.py
+8
-6
8 additions, 6 deletions
saqc/lib/tools.py
with
16 additions
and
16 deletions
saqc/core/core.py
+
8
−
10
View file @
61dd6de3
...
...
@@ -218,7 +218,7 @@ class SaQC(FunctionsMixin):
"""
def
inner
(
field
:
str
,
field
:
str
|
Sequence
[
str
]
,
*
args
,
regex
:
bool
=
False
,
flag
:
ExternalFlag
=
None
,
...
...
@@ -233,25 +233,23 @@ class SaQC(FunctionsMixin):
# expand regular expressions
if
regex
:
f
ields
=
self
.
_data
.
columns
.
str
.
match
(
field
)
fields
=
self
.
_data
.
columns
[
f
ields
]
f
mask
=
self
.
_data
.
columns
.
str
.
match
(
field
)
fields
:
list
=
self
.
_data
.
columns
[
f
mask
].
tolist
()
else
:
fields
=
toSequence
(
field
)
if
func
.
__multivariate__
:
# we wrap field again to make the downstream loop work as expected
fields
=
[
fields
,
]
# we wrap field again to generalize the down stream loop work as expected
fields
=
[
fields
]
out
=
self
for
f
ield
in
fields
:
for
f
in
fields
:
out
=
out
.
_callFunction
(
func
,
data
=
out
.
_data
,
flags
=
out
.
_flags
,
field
=
f
ield
,
field
=
f
,
*
args
,
**
kwargs
,
)
...
...
@@ -264,7 +262,7 @@ class SaQC(FunctionsMixin):
function
:
Callable
,
data
:
DictOfSeries
,
flags
:
Flags
,
field
:
str
,
field
:
str
|
Sequence
[
str
]
,
*
args
:
Any
,
**
kwargs
:
Any
,
)
->
SaQC
:
...
...
This diff is collapsed.
Click to expand it.
saqc/lib/tools.py
+
8
−
6
View file @
61dd6de3
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from
__future__
import
annotations
import
re
import
datetime
import
itertools
import
warnings
from
typing
import
List
,
Sequence
,
Union
,
Any
,
Iterator
,
Callable
from
typing
import
List
,
Sequence
,
TypeVar
,
Union
,
Any
,
Iterator
,
Callable
import
numpy
as
np
import
numba
as
nb
...
...
@@ -16,13 +17,14 @@ import dios
import
collections
from
scipy.cluster.hierarchy
import
linkage
,
fcluster
from
saqc.lib.types
import
T
# keep this for external imports
# TODO: fix the external imports
from
saqc.lib.rolling
import
customRoller
T
=
TypeVar
(
"
T
"
,
str
,
float
,
int
)
def
assertScalar
(
name
,
value
,
optional
=
False
):
if
(
not
np
.
isscalar
(
value
))
and
(
value
is
not
None
)
and
(
optional
is
True
):
raise
ValueError
(
f
"'
{
name
}
'
needs to be a scalar or
'
None
'"
)
...
...
@@ -30,9 +32,9 @@ def assertScalar(name, value, optional=False):
raise
ValueError
(
f
"'
{
name
}
'
needs to be a scalar
"
)
def
toSequence
(
value
:
Union
[
Any
,
Sequence
[
Any
]
])
->
List
[
Any
]:
if
np
.
isscalar
(
value
):
value
=
[
value
]
def
toSequence
(
value
:
T
|
Sequence
[
T
])
->
List
[
T
]:
if
isinstance
(
value
,
(
str
,
int
,
float
)
):
return
[
value
]
return
list
(
value
)
...
...
This diff is collapsed.
Click to expand it.
David Schäfer
@schaefed
mentioned in commit
63b55c6d
·
2 years ago
mentioned in commit
63b55c6d
mentioned in commit 63b55c6d7dadb0e612b23a897f292d5ffc14cb52
Toggle commit list
David Schäfer
@schaefed
mentioned in commit
684dc8a0
·
2 years ago
mentioned in commit
684dc8a0
mentioned in commit 684dc8a0515470d644fc85fee95d07661c8dd572
Toggle commit list
David Schäfer
@schaefed
mentioned in commit
8f7a90e4
·
1 year ago
mentioned in commit
8f7a90e4
mentioned in commit 8f7a90e4aed61c79a9dc8d67541a46beba0907e8
Toggle commit list
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