Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
declearn2
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
Terraform modules
Monitor
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Magnet
DecLearn
declearn2
Commits
0c13373b
Verified
Commit
0c13373b
authored
1 year ago
by
ANDREY Paul
Browse files
Options
Downloads
Patches
Plain Diff
Deprecate 'InMemoryDataset' JSON-dump (private) type-key use.
parent
87eada19
No related branches found
No related tags found
1 merge request
!57
Improve tests coverage and fix test-digged bugs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
declearn/dataset/_inmemory.py
+4
-11
4 additions, 11 deletions
declearn/dataset/_inmemory.py
with
4 additions
and
11 deletions
declearn/dataset/_inmemory.py
+
4
−
11
View file @
0c13373b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
import
os
import
os
import
warnings
import
warnings
from
typing
import
Any
,
ClassVar
,
Dict
,
Iterator
,
List
,
Optional
,
Set
,
Union
from
typing
import
Any
,
Dict
,
Iterator
,
List
,
Optional
,
Set
,
Union
import
numpy
as
np
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
...
@@ -72,8 +72,6 @@ class InMemoryDataset(Dataset):
...
@@ -72,8 +72,6 @@ class InMemoryDataset(Dataset):
# attributes serve clarity; pylint: disable=too-many-instance-attributes
# attributes serve clarity; pylint: disable=too-many-instance-attributes
# arguments serve modularity; pylint: disable=too-many-arguments
# arguments serve modularity; pylint: disable=too-many-arguments
_type_key
:
ClassVar
[
str
]
=
"
InMemoryDataset
"
def
__init__
(
def
__init__
(
self
,
self
,
data
:
Union
[
DataArray
,
str
],
data
:
Union
[
DataArray
,
str
],
...
@@ -313,7 +311,7 @@ class InMemoryDataset(Dataset):
...
@@ -313,7 +311,7 @@ class InMemoryDataset(Dataset):
path
=
os
.
path
.
abspath
(
path
)
path
=
os
.
path
.
abspath
(
path
)
folder
=
os
.
path
.
dirname
(
path
)
folder
=
os
.
path
.
dirname
(
path
)
info
=
{}
# type: Dict[str, Any]
info
=
{}
# type: Dict[str, Any]
info
[
"
type
"
]
=
self
.
_type_ke
y
info
[
"
type
"
]
=
"
InMemoryDataset
"
# NOTE: for backward compatibilit
y
# Optionally create data dumps. Record data dumps' paths.
# Optionally create data dumps. Record data dumps' paths.
# fmt: off
# fmt: off
info
[
"
data
"
]
=
(
info
[
"
data
"
]
=
(
...
@@ -354,16 +352,11 @@ class InMemoryDataset(Dataset):
...
@@ -354,16 +352,11 @@ class InMemoryDataset(Dataset):
if
"
config
"
not
in
dump
:
if
"
config
"
not
in
dump
:
raise
KeyError
(
"
Missing key in the JSON file:
'
config
'
.
"
)
raise
KeyError
(
"
Missing key in the JSON file:
'
config
'
.
"
)
info
=
dump
[
"
config
"
]
info
=
dump
[
"
config
"
]
for
key
in
(
"
type
"
,
"
data
"
,
"
target
"
,
"
s_wght
"
,
"
f_cols
"
):
for
key
in
(
"
data
"
,
"
target
"
,
"
s_wght
"
,
"
f_cols
"
):
if
key
not
in
info
:
if
key
not
in
info
:
error
=
f
"
Missing key in the JSON file:
'
config/
{
key
}
'
.
"
error
=
f
"
Missing key in the JSON file:
'
config/
{
key
}
'
.
"
raise
KeyError
(
error
)
raise
KeyError
(
error
)
key
=
info
.
pop
(
"
type
"
)
info
.
pop
(
"
type
"
,
None
)
if
key
!=
cls
.
_type_key
:
raise
TypeError
(
f
"
Incorrect
'
type
'
field: got
'
{
key
}
'
,
"
f
"
expected
'
{
cls
.
_type_key
}
'
.
"
)
# Instantiate the object and return it.
# Instantiate the object and return it.
return
cls
(
**
info
)
return
cls
(
**
info
)
...
...
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