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
8af7adb2
Commit
8af7adb2
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
removed iterable support
parent
1e5d48c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!218
Flags
Pipeline
#17538
passed with stage
in 6 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/flagger/flags.py
+8
-21
8 additions, 21 deletions
saqc/flagger/flags.py
with
8 additions
and
21 deletions
saqc/flagger/flags.py
+
8
−
21
View file @
8af7adb2
...
...
@@ -6,16 +6,14 @@ import dios
from
saqc.common
import
*
from
saqc.flagger.history
import
History
import
pandas
as
pd
from
typing
import
Union
,
Dict
,
DefaultDict
,
Iterable
,
Tuple
,
Optional
,
Type
from
typing
import
Union
,
Dict
,
DefaultDict
,
Optional
,
Type
_KEY
=
str
_VAL
=
Union
[
pd
.
Series
,
History
]
_
DictLike
=
Union
[
DictLike
=
Union
[
pd
.
DataFrame
,
dios
.
DictOfSeries
,
Dict
[
_KEY
,
_VAL
],
DefaultDict
[
_KEY
,
_VAL
],
Iterable
[
Tuple
[
_KEY
,
_VAL
]]
Dict
[
str
,
_VAL
],
DefaultDict
[
str
,
_VAL
],
]
...
...
@@ -63,7 +61,7 @@ class Flags:
make a df -> flags.to_frame()
"""
def
__init__
(
self
,
raw_data
:
Optional
[
Union
[
_
DictLike
,
Flags
]]
=
None
,
copy
:
bool
=
False
):
def
__init__
(
self
,
raw_data
:
Optional
[
Union
[
DictLike
,
Flags
]]
=
None
,
copy
:
bool
=
False
):
if
raw_data
is
None
:
raw_data
=
{}
...
...
@@ -88,12 +86,7 @@ class Flags:
"""
result
=
{}
for
obj
in
data
:
if
isinstance
(
obj
,
tuple
):
k
,
item
=
obj
else
:
k
,
item
=
obj
,
data
[
obj
]
for
k
,
item
in
data
.
items
():
if
k
in
result
:
raise
ValueError
(
'
raw_data must not have duplicate keys
'
)
...
...
@@ -267,7 +260,7 @@ class Flags:
return
str
(
self
.
to_dios
()).
replace
(
'
DictOfSeries
'
,
type
(
self
).
__name__
)
def
init_flags_like
(
reference
:
Union
[
pd
.
Series
,
_
DictLike
,
Flags
],
initial_value
:
float
=
UNFLAGGED
)
->
Flags
:
def
init_flags_like
(
reference
:
Union
[
pd
.
Series
,
DictLike
,
Flags
],
initial_value
:
float
=
UNFLAGGED
)
->
Flags
:
"""
Create empty Flags, from an reference data structure.
...
...
@@ -301,13 +294,7 @@ def init_flags_like(reference: Union[pd.Series, _DictLike, Flags], initial_value
if
isinstance
(
reference
,
pd
.
Series
):
reference
=
reference
.
to_frame
(
'
f0
'
)
for
obj
in
reference
:
# unpack
if
isinstance
(
obj
,
tuple
):
k
,
item
=
obj
else
:
k
,
item
=
obj
,
reference
[
obj
]
for
k
,
item
in
reference
.
items
():
if
not
isinstance
(
k
,
str
):
raise
TypeError
(
f
"
cannot use
{
k
}
as key, currently only string keys are allowed
"
)
...
...
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