Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
bccebcfd
authored
Oct 15, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix checksum
parent
785fede2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
disk.py
+6
-2
No files found.
disk.py
View file @
bccebcfd
...
@@ -53,8 +53,12 @@ class Disk(object):
...
@@ -53,8 +53,12 @@ class Disk(object):
self
.
base_name
=
base_name
self
.
base_name
=
base_name
@property
@property
def
checksum
(
self
):
def
checksum
(
self
,
blocksize
=
65536
):
return
md5
(
self
.
get_path
())
.
hexdigest
()
hash
=
md5
()
with
open
(
self
.
get_path
(),
"r+b"
)
as
f
:
for
block
in
iter
(
lambda
:
f
.
read
(
blocksize
),
""
):
hash
.
update
(
block
)
return
hash
.
hexdigest
()
@classmethod
@classmethod
def
deserialize
(
cls
,
desc
):
def
deserialize
(
cls
,
desc
):
...
...
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