Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pyDTN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
space-public
pyDTN
Commits
16a2cc00
Commit
16a2cc00
authored
Sep 17, 2019
by
Juraj Sloboda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Python3 everywhere (
#38
)
parent
48eb3b0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
24 deletions
+7
-24
pydtn/pydtn/util/hexdump.py
pydtn/pydtn/util/hexdump.py
+7
-24
No files found.
pydtn/pydtn/util/hexdump.py
View file @
16a2cc00
...
...
@@ -16,15 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Hexdump implementation in Python
2.7 and
3.
Hexdump implementation in Python 3.
"""
from
__future__
import
unicode_literals
import
sys
__python3__
=
sys
.
version_info
>
(
3
,)
def
ordp
(
c
):
"""
...
...
@@ -32,19 +26,11 @@ def ordp(c):
"""
output
=
[]
if
__python3__
:
for
i
in
c
:
if
(
i
<
32
)
or
(
i
>=
127
):
output
.
append
(
"."
)
else
:
output
.
append
(
chr
(
i
))
else
:
for
i
in
c
:
j
=
ord
(
i
)
if
(
j
<
32
)
or
(
j
>=
127
):
output
.
append
(
"."
)
else
:
output
.
append
(
i
)
for
i
in
c
:
if
(
i
<
32
)
or
(
i
>=
127
):
output
.
append
(
"."
)
else
:
output
.
append
(
chr
(
i
))
return
""
.
join
(
output
)
...
...
@@ -66,10 +52,7 @@ def hexdump(p):
output
.
append
(
"{:04d} "
.
format
(
i
))
for
j
in
range
(
16
):
if
(
i
+
j
)
<
length
:
if
__python3__
:
byte
=
p
[
i
+
j
]
else
:
byte
=
ord
(
p
[
i
+
j
])
byte
=
p
[
i
+
j
]
output
.
append
(
"{:02X} "
.
format
(
byte
))
else
:
output
.
append
(
" "
)
...
...
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