1 |
commit: f048645778033bed905ca391c93234dc9c880067 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 2 21:33:38 2018 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jul 7 05:22:11 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=f0486457 |
7 |
|
8 |
gkeys/actions/py: Move the py_input & _unicode import to __init__.py |
9 |
|
10 |
This way it is done once and can be re-used anywhere in the code. |
11 |
|
12 |
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org> |
13 |
|
14 |
gkeys/gkeys/__init__.py | 8 ++++++++ |
15 |
gkeys/gkeys/actions.py | 9 +-------- |
16 |
2 files changed, 9 insertions(+), 8 deletions(-) |
17 |
|
18 |
diff --git a/gkeys/gkeys/__init__.py b/gkeys/gkeys/__init__.py |
19 |
index 05fc730..a1e901c 100644 |
20 |
--- a/gkeys/gkeys/__init__.py |
21 |
+++ b/gkeys/gkeys/__init__.py |
22 |
@@ -2,6 +2,7 @@ |
23 |
# -*- coding: utf-8 -*- |
24 |
|
25 |
|
26 |
+import sys |
27 |
|
28 |
from collections import OrderedDict |
29 |
|
30 |
@@ -11,6 +12,13 @@ from gkeys.action_map import Action_Map, Available_Actions |
31 |
__version__ = '0.2' |
32 |
__license__ = 'GPLv2' |
33 |
|
34 |
+if sys.version_info[0] >= 3: |
35 |
+ py_input = input |
36 |
+ _unicode = str |
37 |
+else: |
38 |
+ py_input = raw_input |
39 |
+ _unicode = unicode |
40 |
+ |
41 |
|
42 |
subdata = OrderedDict() |
43 |
for cmd in Available_Actions: |
44 |
|
45 |
diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py |
46 |
index 71ed081..64d6123 100644 |
47 |
--- a/gkeys/gkeys/actions.py |
48 |
+++ b/gkeys/gkeys/actions.py |
49 |
@@ -15,18 +15,11 @@ from __future__ import print_function |
50 |
|
51 |
import itertools |
52 |
import os |
53 |
-import sys |
54 |
- |
55 |
-if sys.version_info[0] >= 3: |
56 |
- py_input = input |
57 |
- _unicode = str |
58 |
-else: |
59 |
- py_input = raw_input |
60 |
- _unicode = unicode |
61 |
|
62 |
|
63 |
from collections import defaultdict |
64 |
|
65 |
+from gkeys import _unicode, py_input |
66 |
from gkeys.actionbase import ActionBase |
67 |
from gkeys.gkey import GKEY |
68 |
from gkeys.checks import SPECCHECK_SUMMARY, convert_pf, convert_yn |