commit:     f048645778033bed905ca391c93234dc9c880067
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  2 21:33:38 2018 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul  7 05:22:11 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=f0486457

gkeys/actions/py: Move the py_input & _unicode import to __init__.py

This way it is done once and can be re-used anywhere in the code.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 gkeys/gkeys/__init__.py | 8 ++++++++
 gkeys/gkeys/actions.py  | 9 +--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gkeys/gkeys/__init__.py b/gkeys/gkeys/__init__.py
index 05fc730..a1e901c 100644
--- a/gkeys/gkeys/__init__.py
+++ b/gkeys/gkeys/__init__.py
@@ -2,6 +2,7 @@
 # -*- coding: utf-8 -*-
 
 
+import sys
 
 from collections import OrderedDict
 
@@ -11,6 +12,13 @@ from gkeys.action_map import Action_Map, Available_Actions
 __version__ = '0.2'
 __license__ = 'GPLv2'
 
+if sys.version_info[0] >= 3:
+    py_input = input
+    _unicode = str
+else:
+    py_input = raw_input
+    _unicode = unicode
+
 
 subdata = OrderedDict()
 for cmd in Available_Actions:

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index 71ed081..64d6123 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -15,18 +15,11 @@ from __future__ import print_function
 
 import itertools
 import os
-import sys
-
-if sys.version_info[0] >= 3:
-    py_input = input
-    _unicode = str
-else:
-    py_input = raw_input
-    _unicode = unicode
 
 
 from collections import defaultdict
 
+from gkeys import _unicode, py_input
 from gkeys.actionbase import ActionBase
 from gkeys.gkey import GKEY
 from gkeys.checks import SPECCHECK_SUMMARY, convert_pf, convert_yn

Reply via email to