[pybliographer/wip/gtk3] pyblio: pyflakes
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer/wip/gtk3] pyblio: pyflakes
- Date: Tue, 10 Oct 2017 18:06:51 +0000 (UTC)
commit 992338868511624922e3066450b0120bf3f32522
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Tue Oct 10 14:37:51 2017 -0300
pyblio: pyflakes
Pyblio/Autoload.py | 5 ++++-
Pyblio/Base.py | 9 +++------
Pyblio/Config.py | 2 +-
Pyblio/Fields.py | 4 +++-
Pyblio/Formatter.py | 1 -
Pyblio/Key.py | 2 +-
Pyblio/LyX.py | 7 ++++---
Pyblio/Open.py | 5 ++---
Pyblio/Query.py | 2 +-
Pyblio/Resource.py | 5 ++++-
Pyblio/Search.py | 2 +-
Pyblio/Sort.py | 5 +++--
Pyblio/TextUI.py | 8 +++-----
Pyblio/Types.py | 2 +-
Pyblio/Utils.py | 3 ++-
Pyblio/ut_Utils.py | 16 ++++------------
16 files changed, 37 insertions(+), 41 deletions(-)
---
diff --git a/Pyblio/Autoload.py b/Pyblio/Autoload.py
index 9485c66..c0d074c 100644
--- a/Pyblio/Autoload.py
+++ b/Pyblio/Autoload.py
@@ -38,7 +38,10 @@ the module is expected to call Autoload.register to define which entry
point it provides.
"""
-import os, string, re, sys
+import string, re
+
+from gettext import gettext as _
+
class Loader:
''' An object containing the description of a loadable object '''
diff --git a/Pyblio/Base.py b/Pyblio/Base.py
index e421e00..5f3eb4a 100644
--- a/Pyblio/Base.py
+++ b/Pyblio/Base.py
@@ -22,16 +22,13 @@
''' This Module contains the base classes one might want to inherit
from in order to provide a new database format '''
+import os
-from string import *
-import re, copy, os
-import Pyblio.Help
-from types import *
+from string import lower
+from shutil import copyfile
from Pyblio import Autoload, Config, Iterator, Key, Open, Selection, Utils
-from shutil import copyfile
-
class Entry:
'''
A database entry. It behaves like a dictionnary, which
diff --git a/Pyblio/Config.py b/Pyblio/Config.py
index fab8d94..d5e6489 100644
--- a/Pyblio/Config.py
+++ b/Pyblio/Config.py
@@ -21,7 +21,7 @@
''' System for Configuration handling '''
-
+from gettext import gettext as _
import atexit, cPickle, os, string, sys, types
pickle = cPickle
diff --git a/Pyblio/Fields.py b/Pyblio/Fields.py
index 1e59e8d..7d75531 100644
--- a/Pyblio/Fields.py
+++ b/Pyblio/Fields.py
@@ -19,9 +19,11 @@
#
#
+import os, re, recode, string, types, urlparse
+
+from gettext import gettext as _
from Pyblio import Exceptions, Key
-import copy, os, re, recode, string, time, types, urlparse
year_match = re.compile ('(\d\d\d\d)')
diff --git a/Pyblio/Formatter.py b/Pyblio/Formatter.py
index 91e5046..4a2375d 100644
--- a/Pyblio/Formatter.py
+++ b/Pyblio/Formatter.py
@@ -25,7 +25,6 @@ realization in a given language '''
import sys
-from Pyblio import Autoload, Base
class Formatter:
diff --git a/Pyblio/Key.py b/Pyblio/Key.py
index 9323877..8ec9016 100644
--- a/Pyblio/Key.py
+++ b/Pyblio/Key.py
@@ -19,7 +19,7 @@
#
#
-from types import *
+from types import InstanceType
class Key:
diff --git a/Pyblio/LyX.py b/Pyblio/LyX.py
index 2de54b6..d859835 100644
--- a/Pyblio/LyX.py
+++ b/Pyblio/LyX.py
@@ -19,8 +19,9 @@
#
#
-import os, string, select, signal
+import os, string, signal
+from gettext import gettext as _
from Pyblio import Config
class LyXClient:
@@ -32,13 +33,13 @@ class LyXClient:
pin = os.path.expanduser (base + '.in')
try:
- ans = os.stat (pin)
+ os.stat (pin)
except OSError, msg:
raise IOError (_("no input pipe `%s'") % pin)
pout = os.path.expanduser (base + '.out')
try:
- ans = os.stat (pout)
+ os.stat (pout)
except os.error:
raise IOError (_("no output pipe `%s'") % pout)
diff --git a/Pyblio/Open.py b/Pyblio/Open.py
index 4995005..8b61620 100644
--- a/Pyblio/Open.py
+++ b/Pyblio/Open.py
@@ -19,12 +19,11 @@
#
#
+import os, sys, urllib, urlparse
-from types import *
-
+from gettext import gettext as _
from Pyblio import Autoload, Config, Exceptions, Fields, Help
-import os, string, sys, tempfile, traceback, urllib, urlparse
def url_to_local (url):
diff --git a/Pyblio/Query.py b/Pyblio/Query.py
index 964f68c..8b9119a 100644
--- a/Pyblio/Query.py
+++ b/Pyblio/Query.py
@@ -28,7 +28,7 @@ Updated by Z. Kota in 2011 for eutils.
"""
# The time module is added for querying date ranges of publications
-import urllib, urllib2, sys, re, string, time, tempfile, os
+import urllib, urllib2, time, tempfile, os
from xml.dom.minidom import parse
diff --git a/Pyblio/Resource.py b/Pyblio/Resource.py
index ea38344..70ad932 100644
--- a/Pyblio/Resource.py
+++ b/Pyblio/Resource.py
@@ -32,11 +32,14 @@ config_viewers = 'resource/viewers'
CHOOSER_ACTIONS = ('enter/edit', 'select', 'select-directory',
'download', 'move/copy' )
-import os, sys, urllib, urlparse
+import os, sys, urllib
+
+from gettext import gettext as _
from gi.repository import Gio
from Pyblio import Config, Fields, userexit
+
def is_interactive ():
return sys.modules.has_key ('gi.repository.Gtk')
diff --git a/Pyblio/Search.py b/Pyblio/Search.py
index 74c09c7..72ae3a7 100644
--- a/Pyblio/Search.py
+++ b/Pyblio/Search.py
@@ -22,8 +22,8 @@
''' In this module are defined the search operators that can be applied
in a Selection '''
-from string import *
import re
+from string import lower
# ----- Boolean tests -----
diff --git a/Pyblio/Sort.py b/Pyblio/Sort.py
index ee6ace6..b3fbe33 100644
--- a/Pyblio/Sort.py
+++ b/Pyblio/Sort.py
@@ -20,9 +20,10 @@
#
#
-from Pyblio import Fields, Types
+import re, string
+
+from Pyblio import Types
-import re, string, time
class Sort:
''' This class defines the methods used to sort a database '''
diff --git a/Pyblio/TextUI.py b/Pyblio/TextUI.py
index 01bb81a..09d1d70 100644
--- a/Pyblio/TextUI.py
+++ b/Pyblio/TextUI.py
@@ -21,13 +21,11 @@
''' This module provides basical high level functions '''
-from types import *
+import os, sys, string
-import os, sys, traceback, tempfile, string
-
-from Pyblio import Base, Help, Search, Types, Autoload, Fields
+from Pyblio import Help, Search, Types, Autoload, Fields
from Pyblio.Selection import Selection
-from Pyblio.Open import bibopen, bibwrite, bibnew
+from Pyblio.Open import bibwrite
from Pyblio.Style import Utils
# ----- Create elementary Test -----
diff --git a/Pyblio/Types.py b/Pyblio/Types.py
index 845ea78..dab23c8 100644
--- a/Pyblio/Types.py
+++ b/Pyblio/Types.py
@@ -19,7 +19,7 @@
#
#
-import string, copy
+import string
from Pyblio import Config, Fields
diff --git a/Pyblio/Utils.py b/Pyblio/Utils.py
index caa4023..772bac1 100644
--- a/Pyblio/Utils.py
+++ b/Pyblio/Utils.py
@@ -19,12 +19,13 @@
#
#
import re
-from string import *
+from string import join, split, rstrip
from Pyblio import Key, Autoload, recode
_flat = recode.recode ('latin1..flat')
+
def compress_page_range (pages, separator='-'):
"""Returns a page range with common prefix
elided from the second number. Resulte is string
diff --git a/Pyblio/ut_Utils.py b/Pyblio/ut_Utils.py
index 542b153..4fe36a7 100644
--- a/Pyblio/ut_Utils.py
+++ b/Pyblio/ut_Utils.py
@@ -2,31 +2,23 @@
import unittest, sys
-
sys.path.append ('..')
-from Pyblio import Utils, userformat
-
-
+from Pyblio import Utils
-class compress_page_range_test (unittest.TestCase):
+class compress_page_range_test(unittest.TestCase):
data = [("1-9", '1', '9'),
("200-201", '200', '1'),
("300-500", '300', '500'),
("3000-3049", '3000', '49'),
]
- def test01 (self):
-
+ def test01(self):
for i in self.data:
p, r = i[0], i[1:]
- self.assertEqual (Utils.compress_page_range(p,False), r)
+ self.assertEqual(Utils.compress_page_range(p, False), r)
-
if __name__ == '__main__':
unittest.main ()
-
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]