Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
apex
Commits
cd6e46c2
Unverified
Commit
cd6e46c2
authored
Jun 18, 2019
by
mcarilli
Committed by
GitHub
Jun 18, 2019
Browse files
Give custom to method a higher priority (#364)
parent
d5e2bb4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
apex/amp/_initialize.py
apex/amp/_initialize.py
+2
-2
No files found.
apex/amp/_initialize.py
View file @
cd6e46c2
...
...
@@ -40,12 +40,12 @@ def applier(value, fn):
return
value
elif
isinstance
(
value
,
np
.
ndarray
):
return
value
elif
hasattr
(
value
,
"to"
):
# Allow handling of custom batch classes
return
fn
(
value
)
elif
isinstance
(
value
,
container_abcs
.
Mapping
):
return
{
applier
(
k
,
fn
)
:
applier
(
v
,
fn
)
for
k
,
v
in
value
.
items
()}
elif
isinstance
(
value
,
container_abcs
.
Iterable
):
return
type
(
value
)(
applier
(
v
,
fn
)
for
v
in
value
)
elif
hasattr
(
value
,
"to"
):
# Allow handling of custom batch classes
return
fn
(
value
)
else
:
# Do I want this to fire off even if someone chooses to pass something ordinary like
# an int or float? May be more annoying than it's worth.
...
...
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