[Bf-extensions-cvs] [be4b420] master: amend last commit, use readline method
Campbell Barton
noreply at git.blender.org
Sat Jan 31 18:43:43 CET 2015
Commit: be4b420c9cfbb053bad5e0fe87be218180b7a491
Author: Campbell Barton
Date: Sun Feb 1 04:43:15 2015 +1100
Branches: master
https://developer.blender.org/rBACbe4b420c9cfbb053bad5e0fe87be218180b7a491
amend last commit, use readline method
===================================================================
M ui_splash_tips/__init__.py
===================================================================
diff --git a/ui_splash_tips/__init__.py b/ui_splash_tips/__init__.py
index 6d2b07f..d8528e0 100644
--- a/ui_splash_tips/__init__.py
+++ b/ui_splash_tips/__init__.py
@@ -53,16 +53,7 @@ def find_random_line(f):
break
f_handle.seek(i, os.SEEK_SET)
- data_chunks = []
- i_newline = -1
- while i_newline == -1:
- d = f_handle.read(chunk_size)
- i_newline = d.find(b'\n')
- if i_newline != -1:
- d = d[:i_newline]
- data_chunks.append(d)
- return b''.join(data_chunks)
-
+ data = f_handle.readline()
return data
@@ -71,7 +62,7 @@ def find_random_tip():
text = find_random_line(
os.path.join(os.path.dirname(__file__), "tips.txt"),
- )
+ ).rstrip()
url_index = text.rfind(b' ~')
if url_index != -1:
More information about the Bf-extensions-cvs
mailing list