[pybliographer] format: pyflakes
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer] format: pyflakes
- Date: Wed, 28 Mar 2018 23:07:12 +0000 (UTC)
commit 21df46165104a9d112b3eb6d16ea77d82eb7f2d8
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Wed Mar 28 11:50:35 2018 -0300
format: pyflakes
Pyblio/Format/BibTeX.py | 9 +++--
Pyblio/Format/Medline.py | 16 +++++-----
Pyblio/Format/Ovid.py | 27 ++++++++--------
Pyblio/Format/OvidLike.py | 35 ++++++++++------------
Pyblio/Format/isifile.py | 25 +++++++--------
Pyblio/Format/ut_Isi.py | 68 +++++++++++++++++++-----------------------
Pyblio/Format/ut_Ovidlike.py | 65 ++++++++++++++++++++++++++--------------
7 files changed, 126 insertions(+), 119 deletions(-)
---
diff --git a/Pyblio/Format/BibTeX.py b/Pyblio/Format/BibTeX.py
index 91a8aaf..505240d 100644
--- a/Pyblio/Format/BibTeX.py
+++ b/Pyblio/Format/BibTeX.py
@@ -23,10 +23,12 @@
# Extension module for BibTeX files
import _bibtex
-import os, sys, tempfile, pwd, time, traceback, re, string, copy
+import re
+import string
+import copy
-from types import *
-from Pyblio.Fields import *
+from Pyblio.Fields import Author, AuthorGroup, Date, LongText
+from Pyblio.Fields import Reference, Text, URL
from Pyblio import Base, Config, Autoload, Types
from Pyblio import Open, Key, Utils, Iterator, Exceptions
@@ -326,7 +328,6 @@ class DataBase(Base.DataBase):
_bibtex.reverse(_base_fieldtype[Text],
Config.get('bibtex+/braces').data,
user [k][0]))
- finished = 0
errors = []
# Creer la base de cles
diff --git a/Pyblio/Format/Medline.py b/Pyblio/Format/Medline.py
index 198f82f..1ccb73e 100644
--- a/Pyblio/Format/Medline.py
+++ b/Pyblio/Format/Medline.py
@@ -1,8 +1,7 @@
# -*- coding: iso-8859-1 -*-
# This file is part of pybliographer
#
-# Copyright (C) 1998-2004 Frederic GOBRY
-# Email : gobry pybliographer org
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -22,9 +21,10 @@
# Extension module for Medline files
-from Pyblio import Base, Fields, Types, Autoload, Open, Iterator, Utils, Config
+import re
+import string
-import re, string,sys
+from Pyblio import Base, Fields, Types, Autoload, Open, Iterator, Utils, Config
header = re.compile ('^(\w\w[\w ][\w ])- (.*)$')
contin = re.compile ('^ (.*)$')
@@ -167,7 +167,7 @@ class MedlineIterator (Iterator.Iterator):
# AU auteurs *
# TI titre
# LA langue *
-# MH mots cl�s *
+# MH mots clés *
# PT * type : JOURNAL ARTICLE, REVIEW, REVIEW, TUTORIAL,CLINICAL TRIAL,
# RANDOMIZED CONTROLLED TRIAL, LETTER, EDITORIAL, MULTICENTER STUDY,
# NEWS, HISTORICAL ARTICLE
@@ -177,16 +177,16 @@ class MedlineIterator (Iterator.Iterator):
# TA titre de la revue
# PG
# SB
-# CY pays d'�dition ?
+# CY pays d'édition ?
# IP
# VI
# JC
-# AA semble �tre toujours Author ou AUTHOR
+# AA semble être toujours Author ou AUTHOR
# EM date de?? en yyyymm
# AB
# AD
# PMID
-# SO r�f�rence compl�te
+# SO référence complète
# RN semble indexer des substances chimiques
# TT titre dans la langue d'origine
# 4099 URL vers l'article
diff --git a/Pyblio/Format/Ovid.py b/Pyblio/Format/Ovid.py
index 8315fa6..8cbeae7 100644
--- a/Pyblio/Format/Ovid.py
+++ b/Pyblio/Format/Ovid.py
@@ -1,35 +1,34 @@
+# -*- coding: utf-8 -*-
# This file is part of pybliographer
-#
-# Original author of Ovid reader: Travis Oliphant <Oliphant Travis mayo edu>
#
-# Copyright (C) 1998-2004 Frederic GOBRY
-# Email : gobry pybliographer org
-#
+# Original author of Ovid reader:
+# Travis Oliphant <Oliphant Travis mayo edu>
+#
+# Copyright (C) 2018 Germán Poo-Caamaño <gpoo gnome org>
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
+#
# This program 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 2
+# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program 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.
-#
+# GNU General Public License for more details.
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#
+#
""" Extension module for Ovid files """
from Pyblio.Format import OvidLike
-from Pyblio import Base, Open, Config, Types, Autoload
+from Pyblio import Base, Open, Config, Autoload
-import string
class Ovid (Base.DataBase):
-
id = 'Ovid'
properties = {
diff --git a/Pyblio/Format/OvidLike.py b/Pyblio/Format/OvidLike.py
index 98375b4..534d391 100644
--- a/Pyblio/Format/OvidLike.py
+++ b/Pyblio/Format/OvidLike.py
@@ -1,31 +1,33 @@
+# -*- coding: utf-8 -*-
# This file is part of pybliographer
-#
-# Original author of Ovid reader: Travis Oliphant <Oliphant Travis mayo edu>
#
-# Copyright (C) 1998-2004 Frederic GOBRY
-# Email : gobry pybliographer org
-#
+# Original author of Ovid reader:
+# Travis Oliphant <Oliphant Travis mayo edu>
+#
+# Copyright (C) 2018 Germán Poo-Caamaño <gpoo gnome org>
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
+#
# This program 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 2
+# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program 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.
-#
+# GNU General Public License for more details.
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#
+
""" Parser for files having an Ovid-like structure """
-import sys, re, string
+import re
+import string
-from Pyblio import Base, Exceptions, Fields, Iterator, Types, Utils
+from Pyblio import Base, Fields, Iterator, Types
SimpleField = 0
AuthorField = 1
@@ -391,12 +393,7 @@ def write_source_field (output, entry, keys):
output.write ('\n')
-
-
-
-
### Local Variables:
### Mode: python
### py-master-file : "ut_Ovidlike.py"
-### End:
-
+### End:
\ No newline at end of file
diff --git a/Pyblio/Format/isifile.py b/Pyblio/Format/isifile.py
index 4bbf463..2a9c6ae 100644
--- a/Pyblio/Format/isifile.py
+++ b/Pyblio/Format/isifile.py
@@ -1,23 +1,23 @@
-#This file is part of Pybliographer
-#
-# Copyright (C) 1998-2004 Peter Schulte-Stracke
-# Email : mail schulte-stracke de
-#
+# -*- coding: utf-8 -*
+# This file is part of Pybliographer
+#
+# Copyright (C) 2018 Germán Poo-Caamaño <gpoo gnome org>
+# Copyright (C) 1998-2004 Peter Schulte-Stracke <mail schulte-stracke de>
+#
# This program 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 2
+# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#
+#
try: _
except NameError:
@@ -160,7 +160,6 @@ class IsifileIterator(Iterator.Iterator):
for key in ( 'AU', 'ED'):
if lines.has_key(key):
- field = Types.get_field('author')
group = Fields.AuthorGroup()
for item in lines[key]:
if string.strip(item) =='[Anon]' :
@@ -271,7 +270,6 @@ def writer (iter, output_stream, preamble=None, postamble = None):
optional pre- and postamble, onto an output stream.'''
remaining = {}
- text = []
global field_map, output
output = output_stream
field_map = field_map or reverse_mapping(key_map)
@@ -388,5 +386,4 @@ Autoload.register ('format', 'Isifile', {'open': opener,
### Local Variables:
### Mode: python
### py-master-file : "ut_Isi.py"
-### End:
-
+### End:
\ No newline at end of file
diff --git a/Pyblio/Format/ut_Isi.py b/Pyblio/Format/ut_Isi.py
index ab24d3a..b8bde4a 100644
--- a/Pyblio/Format/ut_Isi.py
+++ b/Pyblio/Format/ut_Isi.py
@@ -1,18 +1,40 @@
-# -*- coding: iso8859-1 -*-
-
-
-import cStringIO, os, sys, unittest
+# -*- coding: utf-8 -*-
+# This file is part of pybliographer
+#
+# Original author of Ovid reader:
+# Travis Oliphant <Oliphant Travis mayo edu>
+#
+# Copyright (C) 2018 Germán Poo-Caamaño <gpoo gnome org>
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
+#
+# This program 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 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+
+import cStringIO
+import os
+import sys
+import unittest
sys.path.append (os.path.abspath('../..'))
print os.path.abspath('../..')
-
-
from Pyblio.Format import isifile
from Pyblio import Base, Config, Fields
-
example_1 = """AU Bogin, B
TI Evolutionary hypotheses for human childhood
SO YEARBOOK OF PHYSICAL ANTHROPOLOGY, VOL 40 - 1997
@@ -45,7 +67,6 @@ ER
"""
class ReaderCase (unittest.TestCase):
-
def setUp (self):
Config.parse_directory (os.path.abspath('../ConfDir'))
@@ -114,27 +135,7 @@ class ReaderCase (unittest.TestCase):
auth.first, comparison [auth.last])
e = rdr.next ()
-
- def test03 (self):
- """Test that Editors are accepted."""
-
- comparison = {'X': 'A. B. C.',
- 'Y': 'D.',
- 'Z': 'E. F. G. H.'}
-
- inpt = cStringIO.StringIO (example_3)
- rdr = isifile.IsifileIterator (inpt)
- e = rdr.first ()
- while e:
- print e
- for auth in e['editor']:
- print auth
- self.assertEqual (
- auth.first, comparison [auth.last])
- e = rdr.next ()
-
-
- def test03 (self):
+ def test04 (self):
"""Test that Editors are accepted."""
comparison = {'X': 'A. B. C.',
@@ -166,22 +167,15 @@ def main ():
if __name__ == '__main__':
-
main()
-
### Local Variables:
### Mode: python
-### encoding: iso-8859-1
+### encoding: utf-8
### End:
-
-
-
-
-
diff --git a/Pyblio/Format/ut_Ovidlike.py b/Pyblio/Format/ut_Ovidlike.py
index db5de22..56ad8f3 100644
--- a/Pyblio/Format/ut_Ovidlike.py
+++ b/Pyblio/Format/ut_Ovidlike.py
@@ -1,4 +1,41 @@
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
+# This file is part of pybliographer
+#
+# Copyright (C) 2018 Germán Poo-Caamaño <gpoo gnome org>
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
+#
+# This program 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 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import cStringIO
+import os
+import os.path
+import re
+import sys
+import unittest
+
+sys.path.append (os.path.abspath('../..'))
+
+from Pyblio.Base import DataBase, Entry
+from Pyblio import Config
+from Pyblio.Key import Key
+from Pyblio.Types import get_entry
+from Pyblio.Format.OvidLike import OvidLike, writer, write_source_field
+from Pyblio.Fields import Date
+
+
data = ["""Authors
Muller S. Garda P. Muller JD. Cansi Y.
Title
@@ -112,17 +149,6 @@ Abstract
All rights reserved. [References: 31] """]
-import cStringIO, os, os.path, re, sys,unittest
-
-sys.path.append (os.path.abspath('../..'))
-
-from Pyblio.Base import DataBase, Entry
-from Pyblio import Config
-from Pyblio.Key import Key
-from Pyblio.Types import get_entry
-from Pyblio.Format.OvidLike import OvidLike, writer, write_source_field
-from Pyblio.Fields import Author, AuthorGroup, Date
-
class WriterCase (unittest.TestCase):
def setUp (self):
@@ -164,8 +190,8 @@ class WriterCase (unittest.TestCase):
'date': Date ((1998, 6, None)),
'other-note': 'discussion 1054-5'},
{'result': 'Chemotherapy. 42(3):215-219, 1996 May.',
- ## date in �cites.ovid�: '1996 May-Jun' ##
- ## pages in �cites.ovid�: '215-19' ##
+ ## date in »cites.ovid«: '1996 May-Jun' ##
+ ## pages in »cites.ovid«: '215-19' ##
'journal': 'Chemotherapy',
'volume': 42, 'number': 3, 'pages': '215-219',
'date': Date ((1996, 5, None))},
@@ -376,17 +402,10 @@ def main ():
if __name__ == '__main__':
-
main()
-
### Local Variables:
### Mode: python
-### encoding: iso-8859-1
-### End:
-
-
-
-
-
+### encoding: utf-8
+### End:
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]