summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Elstner <daniel.kitta@gmail.com>2015-09-15 11:42:05 +0200
committerDaniel Elstner <daniel.kitta@gmail.com>2015-09-15 11:42:05 +0200
commit750e122d2bcdf05e600112ffda431f97608db387 (patch)
tree6e2a542e6c6e7304c040e5684fd13bfe7bf8f518
parent544038d90e05c03f6f914c7771ee52dd85784ca8 (diff)
downloadlibsigrokdecode-750e122d2bcdf05e600112ffda431f97608db387.tar.gz
libsigrokdecode-750e122d2bcdf05e600112ffda431f97608db387.zip
jitter, pwm: Avoid Unicode string literals
It seems the Python we ship along our Windows binaries does not support u"..." strings, even though it's been a language feature since Python 2. Remove the "u" prefix to avoid a syntax error. Also, consistently use format "%.1f" at all scales. This fixes bug #569.
-rw-r--r--decoders/jitter/pd.py12
-rw-r--r--decoders/pwm/pd.py12
2 files changed, 12 insertions, 12 deletions
diff --git a/decoders/jitter/pd.py b/decoders/jitter/pd.py
index d6db8e5..d572c36 100644
--- a/decoders/jitter/pd.py
+++ b/decoders/jitter/pd.py
@@ -91,17 +91,17 @@ class Decoder(srd.Decoder):
def putx(self, delta):
# Adjust granularity.
if delta == 0 or delta >= 1:
- delta_s = u"%us" % (delta)
+ delta_s = "%.1fs" % (delta)
elif delta <= 1e-12:
- delta_s = u"%.1ffs" % (delta * 1e15)
+ delta_s = "%.1ffs" % (delta * 1e15)
elif delta <= 1e-9:
- delta_s = u"%.1fps" % (delta * 1e12)
+ delta_s = "%.1fps" % (delta * 1e12)
elif delta <= 1e-6:
- delta_s = u"%.1fns" % (delta * 1e9)
+ delta_s = "%.1fns" % (delta * 1e9)
elif delta <= 1e-3:
- delta_s = u"%.1fμs" % (delta * 1e6)
+ delta_s = "%.1fμs" % (delta * 1e6)
else:
- delta_s = u"%.1fms" % (delta * 1e3)
+ delta_s = "%.1fms" % (delta * 1e3)
self.put(self.clk_start, self.sig_start, self.out_ann, [0, [delta_s]])
diff --git a/decoders/pwm/pd.py b/decoders/pwm/pd.py
index 45e96e2..e0203a3 100644
--- a/decoders/pwm/pd.py
+++ b/decoders/pwm/pd.py
@@ -77,17 +77,17 @@ class Decoder(srd.Decoder):
def putp(self, period_t):
# Adjust granularity.
if period_t == 0 or period_t >= 1:
- period_s = u'%u s' % (period_t)
+ period_s = '%.1f s' % (period_t)
elif period_t <= 1e-12:
- period_s = u'%.1f fs' % (period_t * 1e15)
+ period_s = '%.1f fs' % (period_t * 1e15)
elif period_t <= 1e-9:
- period_s = u'%.1f ps' % (period_t * 1e12)
+ period_s = '%.1f ps' % (period_t * 1e12)
elif period_t <= 1e-6:
- period_s = u'%.1f ns' % (period_t * 1e9)
+ period_s = '%.1f ns' % (period_t * 1e9)
elif period_t <= 1e-3:
- period_s = u'%.1f μs' % (period_t * 1e6)
+ period_s = '%.1f μs' % (period_t * 1e6)
else:
- period_s = u'%.1f ms' % (period_t * 1e3)
+ period_s = '%.1f ms' % (period_t * 1e3)
self.put(self.ss, self.es, self.out_ann, [1, [period_s]])