mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-07 18:07:08 -08:00
dev-python/pushbullet-py: new package, v. 0.10.0, optional dep of urlwatch.
Package-Manager: portage-2.3.2 Closes: https://github.com/gentoo/gentoo/pull/3437
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
diff --git a/pushbullet/filetype.py b/pushbullet/filetype.py
|
||||
index a2f2be0..22ffedf 100644
|
||||
--- a/pushbullet/filetype.py
|
||||
+++ b/pushbullet/filetype.py
|
||||
@@ -1,13 +1,22 @@
|
||||
def _magic_get_file_type(f, _):
|
||||
file_type = magic.from_buffer(f.read(1024), mime=True)
|
||||
f.seek(0)
|
||||
- return file_type.decode('utf-8')
|
||||
+ return maybe_decode(file_type)
|
||||
|
||||
|
||||
def _guess_file_type(_, filename):
|
||||
return mimetypes.guess_type(filename)[0]
|
||||
|
||||
|
||||
+# return str on python3. Don't want to unconditionally
|
||||
+# decode because that results in unicode on python2
|
||||
+def maybe_decode(s):
|
||||
+ if str == bytes:
|
||||
+ return s.decode('utf-8')
|
||||
+ else:
|
||||
+ return s
|
||||
+
|
||||
+
|
||||
try:
|
||||
import magic
|
||||
except ImportError:
|
||||
Reference in New Issue
Block a user