From 9e625c4821f4c63421b3d3747c0c4f358fef6c5f Mon Sep 17 00:00:00 2001 From: Douglas Anderson <danderson@ntia.doc.gov> Date: Sun, 12 Feb 2017 15:52:19 -0800 Subject: python3: update non-GRC components to use python2 or python3 --- gr-digital/python/digital/utils/gray_code.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gr-digital/python/digital/utils/gray_code.py') diff --git a/gr-digital/python/digital/utils/gray_code.py b/gr-digital/python/digital/utils/gray_code.py index 926a1ded10..ad88274087 100644 --- a/gr-digital/python/digital/utils/gray_code.py +++ b/gr-digital/python/digital/utils/gray_code.py @@ -1,25 +1,27 @@ #!/usr/bin/env python # # Copyright 2011 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# +from __future__ import division +from __future__ import unicode_literals class GrayCodeGenerator(object): """ Generates and caches gray codes. @@ -41,7 +43,7 @@ class GrayCodeGenerator(object): if len(self.gcs) < length: self.generate_new_gray_code(length) return self.gcs[:length] - + def generate_new_gray_code(self, length): """ Generates new gray code and places into cache. @@ -49,7 +51,7 @@ class GrayCodeGenerator(object): while len(self.gcs) < length: if self.i == self.lp2: # if i is a power of two then gray number is of form 1100000... - result = self.i + self.i/2 + result = self.i + self.i // 2 else: # if not we take advantage of the symmetry of all but the last bit # around a power of two. -- cgit v1.2.3