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
4df1f908
Commit
4df1f908
authored
3 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
added string shortcuts for the translation schemes
parent
de1d9647
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!370
Release 2.0
Pipeline
#52269
passed with stage
in 1 minute and 36 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/core/core.py
+32
-5
32 additions, 5 deletions
saqc/core/core.py
with
32 additions
and
5 deletions
saqc/core/core.py
+
32
−
5
View file @
4df1f908
...
...
@@ -6,7 +6,6 @@ from typing import (
Any
,
Callable
,
Sequence
,
Mapping
,
Hashable
,
)
from
copy
import
deepcopy
,
copy
as
shallowcopy
...
...
@@ -20,7 +19,13 @@ from saqc.core.flags import initFlagsLike, Flags
from
saqc.core.history
import
History
from
saqc.core.register
import
FUNC_MAP
,
FunctionWrapper
from
saqc.core.modules
import
FunctionsMixin
from
saqc.core.translator.basetranslator
import
Translator
,
FloatTranslator
from
saqc.core.translator
import
(
Translator
,
FloatTranslator
,
SimpleTranslator
,
PositionalTranslator
,
DmpTranslator
,
)
from
saqc.lib.tools
import
toSequence
from
saqc.lib.types
import
(
ExternalFlag
,
...
...
@@ -35,6 +40,14 @@ pd.set_option("mode.chained_assignment", "warn")
np
.
seterr
(
invalid
=
"
ignore
"
)
TRANSLATION_SCHEMES
=
{
"
float
"
:
FloatTranslator
,
"
simple
"
:
SimpleTranslator
,
"
dmp
"
:
DmpTranslator
,
"
positional
"
:
PositionalTranslator
,
}
class
SaQC
(
FunctionsMixin
):
_attributes
=
{
"
_data
"
,
...
...
@@ -45,11 +58,15 @@ class SaQC(FunctionsMixin):
}
def
__init__
(
self
,
data
=
None
,
flags
=
None
,
scheme
:
Translator
=
None
,
copy
:
bool
=
True
self
,
data
=
None
,
flags
=
None
,
scheme
:
str
|
Translator
=
"
float
"
,
copy
:
bool
=
True
,
):
self
.
_data
=
self
.
_initData
(
data
,
copy
)
self
.
_flags
=
self
.
_initFlags
(
flags
,
copy
)
self
.
_translator
=
scheme
or
FloatTranslator
()
self
.
_translator
=
self
.
_initTranslator
(
scheme
)
#
scheme or FloatTranslator()
self
.
_called
=
[]
self
.
_attrs
=
{}
self
.
_validate
(
reason
=
"
init
"
)
...
...
@@ -91,7 +108,7 @@ class SaQC(FunctionsMixin):
return
self
.
_attrs
@attrs.setter
def
attrs
(
self
,
value
:
Mapping
[
Hashable
,
Any
])
->
None
:
def
attrs
(
self
,
value
:
dict
[
Hashable
,
Any
])
->
None
:
self
.
_attrs
=
dict
(
value
)
@property
...
...
@@ -211,6 +228,16 @@ class SaQC(FunctionsMixin):
def
__deepcopy__
(
self
,
memodict
=
None
):
return
self
.
copy
(
deep
=
True
)
def
_initTranslator
(
self
,
scheme
:
str
|
Translator
)
->
Translator
:
if
isinstance
(
scheme
,
str
)
and
scheme
in
TRANSLATION_SCHEMES
:
return
TRANSLATION_SCHEMES
[
scheme
]()
if
isinstance
(
scheme
,
Translator
):
return
scheme
raise
TypeError
(
f
"
expected one of the following translation schemes
'
{
TRANSLATION_SCHEMES
.
keys
()
}
"
f
"
or an initialized Translator object, got
'
{
scheme
}
'"
)
def
_initData
(
self
,
data
,
copy
:
bool
)
->
DictOfSeries
:
if
data
is
None
:
data
=
DictOfSeries
()
...
...
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