[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH 12/12] Removes redundant polystr/polybytes defs from c
From: |
Fred Wright |
Subject: |
[gpsd-dev] [PATCH 12/12] Removes redundant polystr/polybytes defs from client.py. |
Date: |
Fri, 8 Apr 2016 10:07:53 -0700 |
TESTED:
Ran "scons check" with both Python 2 and Python 3.
---
gps/client.py | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/gps/client.py b/gps/client.py
index cdc5059..70f0b34 100644
--- a/gps/client.py
+++ b/gps/client.py
@@ -7,30 +7,9 @@ from __future__ import absolute_import, print_function,
division
import time, socket, sys, select, json
-GPSD_PORT = "2947"
-
-binary_encoding = 'latin-1'
-
-def polystr(o):
- if isinstance(o, str):
- return o
- if isinstance(o, bytes):
- return str(o, encoding=binary_encoding)
- raise ValueError
-
-def polybytes(o):
- if isinstance(o, bytes):
- return o
- if isinstance(o, str):
- return bytes(o, encoding=binary_encoding)
- raise ValueError
-
-class json_error(BaseException):
- def __init__(self, data, explanation):
- BaseException.__init__(self)
- self.data = data
- self.explanation = explanation
+from .misc import polystr, polybytes
+GPSD_PORT = "2947"
class gpscommon:
"Isolate socket handling and buffering from the protocol interpretation."
--
2.8.0
- [gpsd-dev] [PATCH 01/12] Fixes Python C extensions for Python 3 compatibility., (continued)
- [gpsd-dev] [PATCH 01/12] Fixes Python C extensions for Python 3 compatibility., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 02/12] Fixes fake.py 'packet' import for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 04/12] Fixes xgps for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 05/12] Fixes a client.py exception for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 06/12] Fixes Gtk warnings related to xgps/xgpsspeed error boxes., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 07/12] Changes type checks in misc.py:isotime to use isinstance()., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 03/12] Forces Python 3 import behavior in all gps/* modules., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 09/12] Fixes gpscat and test_maidenhead.py for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 08/12] Removes unnecessary Unicode literal from xgps., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 10/12] Fixes fake.py and gpsfake for Python 3., Fred Wright, 2016/04/08
- [gpsd-dev] [PATCH 12/12] Removes redundant polystr/polybytes defs from client.py.,
Fred Wright <=
- [gpsd-dev] [PATCH 11/12] Adds "target Python" support to SConstruct., Fred Wright, 2016/04/08
- Re: [gpsd-dev] Python 3 Updates, Gary E. Miller, 2016/04/08
- Re: [gpsd-dev] Python 3 Updates, Eric S. Raymond, 2016/04/09
- Re: [gpsd-dev] Python 3 Updates, Fred Wright, 2016/04/09