From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9940A138335 for ; Sat, 7 Jul 2018 05:23:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0DFC5E09F6; Sat, 7 Jul 2018 05:23:54 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C3A71E0A68 for ; Sat, 7 Jul 2018 05:23:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AB0F4335C8C for ; Sat, 7 Jul 2018 05:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 04ACA361 for ; Sat, 7 Jul 2018 05:23:50 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1530940931.f048645778033bed905ca391c93234dc9c880067.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys/gkeys/__init__.py gkeys/gkeys/actions.py X-VCS-Directories: gkeys/gkeys/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: f048645778033bed905ca391c93234dc9c880067 X-VCS-Branch: master Date: Sat, 7 Jul 2018 05:23:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5059ad1c-ed5f-4b38-b04d-ef65922a86e1 X-Archives-Hash: 3dd66ac28d34f3d06aef5bcaee1fddac commit: f048645778033bed905ca391c93234dc9c880067 Author: Brian Dolbec gentoo org> AuthorDate: Mon Jul 2 21:33:38 2018 +0000 Commit: Brian Dolbec gentoo 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 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