Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Boeckenhoff
tfields
Commits
183fdd53
Commit
183fdd53
authored
Sep 18, 2018
by
Daniel Boeckenhoff
Browse files
keys() to list(dict)
parent
4b7ecefe
Changes
2
Hide whitespace changes
Inline
Side-by-side
tfields/bounding_box.py
View file @
183fdd53
...
...
@@ -173,7 +173,7 @@ class Node(object):
return
self
if
len
(
self
.
cut_expr
)
>
1
:
raise
ValueError
(
"cut_expr is too long"
)
key
=
self
.
cut_expr
.
keys
(
)[
0
]
key
=
list
(
self
.
cut_expr
)[
0
]
value
=
locals
()[
key
]
if
value
<=
self
.
cut_expr
[
key
]:
return
self
.
left
.
find_leaf
(
point
,
_in_recursion
=
True
)
...
...
tfields/core.py
View file @
183fdd53
...
...
@@ -329,7 +329,7 @@ class AbstractNdarray(np.ndarray):
'''
De-Flatten the first layer of lists
'''
for
key
in
sorted
(
d
.
keys
(
)):
for
key
in
sorted
(
list
(
d
)):
if
'::'
in
key
:
splits
=
key
.
split
(
'::'
)
attr
,
_
,
end
=
key
.
partition
(
'::'
)
...
...
@@ -349,10 +349,10 @@ class AbstractNdarray(np.ndarray):
'''
Build the lists (recursively)
'''
for
key
in
list_dict
.
keys
(
):
for
key
in
list
(
list
_dict
):
sub_dict
=
list_dict
[
key
]
list_dict
[
key
]
=
[]
for
index
in
sorted
(
sub_dict
.
keys
(
)):
for
index
in
sorted
(
list
(
sub_dict
)):
bulk_type
=
sub_dict
[
index
].
get
(
'bulk_type'
).
tolist
()
if
isinstance
(
bulk_type
,
bytes
):
# asthonishingly, this is not necessary under linux. Found under nt. ???
...
...
@@ -690,7 +690,7 @@ class Tensors(AbstractNdarray):
>>> assert np.array_equal(lins3[:, 1], [4, 9])
"""
cls_kwargs
=
{
attr
:
kwargs
.
pop
(
attr
)
for
attr
in
list
(
kwargs
.
keys
()
)
if
attr
in
cls
.
__slots__
}
cls_kwargs
=
{
attr
:
kwargs
.
pop
(
attr
)
for
attr
in
list
(
kwargs
)
if
attr
in
cls
.
__slots__
}
inst
=
cls
.
__new__
(
cls
,
tfields
.
lib
.
grid
.
igrid
(
*
base_vectors
,
**
kwargs
),
**
cls_kwargs
)
...
...
@@ -1563,7 +1563,7 @@ class TensorMaps(TensorFields):
item
.
maps
=
[
mp
.
copy
()
for
mp
in
item
.
maps
]
indices
=
np
.
array
(
range
(
len
(
self
)))
keep_indices
=
indices
[
index
]
if
isinstance
(
keep_indices
,
(
int
,
np
.
int64
)):
if
isinstance
(
keep_indices
,
(
int
,
np
.
int64
,
np
.
int32
)):
keep_indices
=
[
keep_indices
]
delete_indices
=
set
(
indices
).
difference
(
set
(
keep_indices
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment