Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary_c-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Izzard, Robert Dr (Maths & Physics)
binary_c-python
Commits
b2a54baa
Commit
b2a54baa
authored
4 years ago
by
David Hendriks
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug. boolean has to be caught first, cause True is also seen as an int
parent
8b1f8ae7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
binarycpython/utils/functions.py
+5
-5
5 additions, 5 deletions
binarycpython/utils/functions.py
with
5 additions
and
5 deletions
binarycpython/utils/functions.py
+
5
−
5
View file @
b2a54baa
...
@@ -1136,7 +1136,11 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
...
@@ -1136,7 +1136,11 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
# dealt with by calling this function again.
# dealt with by calling this function again.
else
:
else
:
# ints
# ints
if
isinstance
(
dict_1
[
key
],
int
)
and
isinstance
(
dict_2
[
key
],
int
):
# Booleans (has to be the type Bool, not just a 0 or 1)
if
isinstance
(
dict_1
[
key
],
bool
)
and
isinstance
(
dict_2
[
key
],
bool
):
new_dict
[
key
]
=
dict_1
[
key
]
or
dict_2
[
key
]
elif
isinstance
(
dict_1
[
key
],
int
)
and
isinstance
(
dict_2
[
key
],
int
):
new_dict
[
key
]
=
dict_1
[
key
]
+
dict_2
[
key
]
new_dict
[
key
]
=
dict_1
[
key
]
+
dict_2
[
key
]
# floats
# floats
...
@@ -1151,10 +1155,6 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
...
@@ -1151,10 +1155,6 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
elif
isinstance
(
dict_1
[
key
],
dict
)
and
isinstance
(
dict_2
[
key
],
dict
):
elif
isinstance
(
dict_1
[
key
],
dict
)
and
isinstance
(
dict_2
[
key
],
dict
):
new_dict
[
key
]
=
merge_dicts
(
dict_1
[
key
],
dict_2
[
key
])
new_dict
[
key
]
=
merge_dicts
(
dict_1
[
key
],
dict_2
[
key
])
# Booleans (has to be the type Bool, not just a 0 or 1)
elif
isinstance
(
dict_1
[
key
],
bool
)
and
isinstance
(
dict_2
[
key
],
bool
):
new_dict
[
key
]
=
dict_1
[
key
]
or
dict_2
[
key
]
else
:
else
:
print
(
print
(
"
Object types {},{} not supported
"
.
format
(
"
Object types {},{} not supported
"
.
format
(
...
...
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