team4alfanous team mailing list archive
-
team4alfanous team
-
Mailing list archive
-
Message #00270
[Branch ~team4alfanous/alfanous/alfanous-git] Rev 456: Readability counts: Imports, fixes 65
------------------------------------------------------------
revno: 456
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sat 2012-12-22 00:25:02 +0100
message:
Readability counts: Imports, fixes 65
- Imports should usually be on separate lines
modified:
src/alfanous-cgi/alfanous_json2.py
src/alfanous-desktop/Gui.py
src/alfanous-django/wui/views.py
src/alfanous-import/Downloader.py
src/alfanous-import/Importer.py
src/alfanous-import/Transformer.py
src/alfanous-import/Updater.py
src/alfanous-labs/PyArabic/Araby_Statistics.py
src/alfanous-labs/Qrawler/QuranicCrawler.py
src/alfanous/Data.py
src/alfanous/Misc.py
src/alfanous/Outputs.py
src/alfanous/Suggestions.py
src/alfanous/TextProcessing.py
src/alfanous/console.py
--
lp:alfanous
https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git
Your team Alfanous team is subscribed to branch lp:alfanous.
To unsubscribe from this branch go to https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git/+edit-subscription
=== modified file 'src/alfanous-cgi/alfanous_json2.py'
--- src/alfanous-cgi/alfanous_json2.py 2012-11-22 23:12:08 +0000
+++ src/alfanous-cgi/alfanous_json2.py 2012-12-21 23:25:02 +0000
@@ -27,18 +27,17 @@
TODO send error messages (no results, parsing exception)
"""
+from sys import path
-import cgi, cgitb
+import cgi
+import cgitb
cgitb.enable()
-form = cgi.FormContentDict()
-
-
-from sys import path
path.append( "alfanous.egg/alfanous" )
-
from alfanous.Outputs import Json
+
+
JSONoutput = Json() #use default paths
JSON_HEADER = """Content-Type: application/json; charset=utf-8
@@ -50,8 +49,8 @@
"""
-
# Get form arguments and build the flags dict
+form = cgi.FormContentDict()
flags = {}
for key, value in form.items():
flags[key] = value[0]
=== modified file 'src/alfanous-desktop/Gui.py'
--- src/alfanous-desktop/Gui.py 2012-11-05 00:11:52 +0000
+++ src/alfanous-desktop/Gui.py 2012-12-21 23:25:02 +0000
@@ -30,22 +30,17 @@
"""
## Importing modules
-import sys, os, gettext
+import sys
+import os
+import gettext
+from re import compile
+
+from pyparsing import ParseException
from configobj import ConfigObj
from PyQt4 import QtGui, QtCore, uic
from PyQt4.QtCore import QRect
-from pyparsing import ParseException
+
from alfanous.Outputs import Raw
-from re import compile
-
-
-## Localization using gettext
-_ = gettext.gettext
-n_ = gettext.ngettext
-gettext.bindtextdomain( "alfanousQT" );
-gettext.textdomain( "alfanousQT" );
-
-
## Specification of resources paths
from alfanous.Data import Paths
@@ -54,6 +49,14 @@
from preferencesDlg_ui import Ui_preferencesDlg
from aboutDlg_ui import Ui_Dialog as Ui_aboutDlg
+
+## Localization using gettext
+_ = gettext.gettext
+n_ = gettext.ngettext
+gettext.bindtextdomain( "alfanousQT" );
+gettext.textdomain( "alfanousQT" );
+
+
## Initialize search engines
RAWoutput = Raw() # default paths
@@ -67,8 +70,6 @@
SURA_TYPE = {u"مدنية":_( u"medina" ), u"مكية":_( u"mekka" )}
-
-
CSS = """
<style type="text/css">
#TODO : new simple&clean style
=== modified file 'src/alfanous-django/wui/views.py'
--- src/alfanous-django/wui/views.py 2012-11-23 13:19:36 +0000
+++ src/alfanous-django/wui/views.py 2012-12-21 23:25:02 +0000
@@ -5,11 +5,13 @@
TODO make a fields English-Arabic mapping based on the "bidi" value to be used in localization
"""
+import json
+import datetime
+from sys import path
from django.http import HttpResponse
from django.shortcuts import render_to_response
-import datetime
from django.utils import translation
from django.utils.translation import ugettext as _
@@ -17,14 +19,12 @@
from django.utils.translation import pgettext_lazy # for ambiguities
from django.utils.translation import get_language_info
-
-import json
-from sys import path
path.append( "alfanous.egg/alfanous" )
-
from alfanous.Outputs import Raw
-RAWoutput = Raw() #use default paths
+
+# load the search engine, use default paths
+RAWoutput = Raw()
def jos2(request):
""" JSON Output System II """
=== modified file 'src/alfanous-import/Downloader.py'
--- src/alfanous-import/Downloader.py 2012-09-29 11:33:26 +0000
+++ src/alfanous-import/Downloader.py 2012-12-21 23:25:02 +0000
@@ -24,7 +24,6 @@
@note: read the licences of those ressources before download them
-@to do : download Tanzil,Translations
'''
#import twill ## disabled tempararily because a bug in twill with python2.6
=== modified file 'src/alfanous-import/Importer.py'
--- src/alfanous-import/Importer.py 2012-06-01 02:54:15 +0000
+++ src/alfanous-import/Importer.py 2012-12-21 23:25:02 +0000
@@ -22,18 +22,17 @@
@contact: assem.ch [at] gmail.com
@license: AGPL
-@to do : Antonymes / Synonymes
-@to do : Prefixes / Suffixes
+TODO Antonyms / Synonyms
+TODO Prefixes / Suffixes
'''
+import os.path
+
+from PyZekrModels.Models import TranslationModel
from alfanous.Support.whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT, NUMERIC
from alfanous.Support.whoosh.filedb.filestore import FileStorage
from alfanous.Support.whoosh import index
-
-import os.path
-from PyZekrModels.Models import TranslationModel
-
from alfanous.TextProcessing import QArabicSymbolsFilter
class GenericImporter:
=== modified file 'src/alfanous-import/Transformer.py'
--- src/alfanous-import/Transformer.py 2012-09-29 18:06:14 +0000
+++ src/alfanous-import/Transformer.py 2012-12-21 23:25:02 +0000
@@ -25,6 +25,10 @@
TODO reorganize the importer module ,keep it free of un-needed resources
'''
+import os.path
+import re
+import sqlite3 as lite
+
## attention : these libraries will be pickled in the indexes
from alfanous.Support.whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT, NUMERIC
@@ -35,12 +39,6 @@
from alfanous.Support.whoosh import index
-
-import os.path
-import re
-import sqlite3 as lite
-
-
from alfanous.main import QuranicSearchEngine
from alfanous.Indexing import QseDocIndex
from alfanous.TextProcessing import QStandardAnalyzer, QDiacAnalyzer, QArabicSymbolsFilter, QUthmaniDiacAnalyzer, QUthmaniAnalyzer, APermissibleAnalyzer
=== modified file 'src/alfanous-import/Updater.py'
--- src/alfanous-import/Updater.py 2012-06-01 02:54:15 +0000
+++ src/alfanous-import/Updater.py 2012-12-21 23:25:02 +0000
@@ -1,8 +1,10 @@
#!/bin/python
# config : utf-8
+import json
+
from alfanous.main import TraductionSearchEngine
-import json
+
LANGS = {'el': 'Greek', 'eo': 'Esperanto', 'en': 'English', 'vi': 'Vietnamese', 'ca': 'Catalan', 'it': 'Italian', 'lb': 'Luxembourgish', 'eu': 'Basque', 'ar': 'Arabic', 'bg': 'Bulgarian', 'cs': 'Czech', 'et': 'Estonian', 'gl': 'Galician', 'id': 'Indonesian', 'ru': 'Russian', 'nl': 'Dutch', 'pt': 'Portuguese', 'no': 'Norwegian', 'tr': 'Turkish', 'lv': 'Latvian', 'lt': 'Lithuanian', 'th': 'Thai', 'es_ES': 'Spanish', 'ro': 'Romanian', 'en_GB': 'British English', 'fr': 'French', 'hy': 'Armenian', 'uk': 'Ukrainian', 'pt_BR': 'Brazilian', 'hr': 'Croatian', 'de': 'German', 'da': 'Danish', 'fa': 'Persian', 'bs': 'Bosnian', 'fi': 'Finnish', 'hu': 'Hungarian', 'ja': 'Japanese', 'he': 'Hebrew', 'ka': 'Georgian', 'zh_CN': 'Chinese', 'kk': 'Kazakh', 'sr': 'Serbian', 'sq': 'Albanian', 'ko': 'Korean', 'sv': 'Swedish', 'mk': 'Macedonian', 'sk': 'Slovak', 'pl': 'Polish', 'ms': 'Malay', 'sl': 'Slovenian'} #languages
=== modified file 'src/alfanous-labs/PyArabic/Araby_Statistics.py'
--- src/alfanous-labs/PyArabic/Araby_Statistics.py 2012-06-01 02:54:15 +0000
+++ src/alfanous-labs/PyArabic/Araby_Statistics.py 2012-12-21 23:25:02 +0000
@@ -6,8 +6,10 @@
@author: assem
'''
+import re
+
from araby import araby
-import re
+
araby = araby()
def letters( text ):
=== modified file 'src/alfanous-labs/Qrawler/QuranicCrawler.py'
--- src/alfanous-labs/Qrawler/QuranicCrawler.py 2012-04-15 16:55:40 +0000
+++ src/alfanous-labs/Qrawler/QuranicCrawler.py 2012-12-21 23:25:02 +0000
@@ -14,13 +14,16 @@
'''
-
+import sys
+import os
import re
+from os import makedirs, path
+from types import StringTypes
+
from whoosh.index import create_in
from whoosh.fields import *
from whoosh import index
from whoosh.index import open_dir
-from os import makedirs, path
from harvestman.apps.spider import HarvestMan
from harvestman.lib.common.common import objects
@@ -31,8 +34,8 @@
spanreg = re.compile('"class=\"aya\"""')
-import sys, os
-from types import StringTypes
+
+
# You can write a variety of custom crawlers by combining
# different events and writing handlers for them...
=== modified file 'src/alfanous/Data.py'
--- src/alfanous/Data.py 2012-06-24 00:42:15 +0000
+++ src/alfanous/Data.py 2012-12-21 23:25:02 +0000
@@ -3,9 +3,13 @@
TODO build paths based on running platform
'''
-from alfanous.main import QuranicSearchEngine, FuzzyQuranicSearchEngine, \
- TraductionSearchEngine, WordSearchEngine
-import os, json
+import os
+import json
+
+
+from alfanous.main import QuranicSearchEngine, FuzzyQuranicSearchEngine
+from alfanous.main import TraductionSearchEngine, WordSearchEngine
+
# default paths
=== modified file 'src/alfanous/Misc.py'
--- src/alfanous/Misc.py 2012-06-01 02:54:15 +0000
+++ src/alfanous/Misc.py 2012-12-21 23:25:02 +0000
@@ -3,8 +3,9 @@
""" a space for tests and misc functions """
+import sys
import locale
-import sys
+
from alfanous.Constantes import BUCKWALTER2UNICODE
=== modified file 'src/alfanous/Outputs.py'
--- src/alfanous/Outputs.py 2012-11-24 00:27:04 +0000
+++ src/alfanous/Outputs.py 2012-12-21 23:25:02 +0000
@@ -29,14 +29,15 @@
"""
+import json
+import re
+
from alfanous.main import QuranicSearchEngine, FuzzyQuranicSearchEngine, TraductionSearchEngine, WordSearchEngine
from alfanous.dynamic_resources.arabicnames_dyn import ara2eng_names as Fields
from alfanous.dynamic_resources.std2uth_dyn import std2uth_words
from alfanous.dynamic_resources.vocalizations_dyn import vocalization_dict
from alfanous.TextProcessing import QArabicSymbolsFilter
-import json, re
-
from alfanous.Data import *
=== modified file 'src/alfanous/Suggestions.py'
--- src/alfanous/Suggestions.py 2012-06-01 02:54:15 +0000
+++ src/alfanous/Suggestions.py 2012-12-21 23:25:02 +0000
@@ -26,9 +26,8 @@
@license: AGPL
-
-
'''
+
from alfanous.Support.whoosh.spelling import SpellChecker
class QSuggester( SpellChecker ):
=== modified file 'src/alfanous/TextProcessing.py'
--- src/alfanous/TextProcessing.py 2012-10-15 15:29:32 +0000
+++ src/alfanous/TextProcessing.py 2012-12-21 23:25:02 +0000
@@ -26,17 +26,16 @@
'''
-#from alfanous.dynamic_resources import stopwords_dyn ##should test existance before importing
+import re
+
+#from pyarabic.araby import araby
from alfanous.Support.whoosh.analysis import StopFilter, RegexTokenizer #LowercaseFilter, StandardAnalyzer,
-#from pyarabic.araby import araby
-
from alfanous.Support.ar_ctype import strip_tashkeel, strip_tatweel, normalize_spellerrors, normalize_hamza, normalize_lamalef #, HARAKAT_pat,
from alfanous.Support.arabic_const import FATHATAN, DAMMATAN, KASRATAN, FATHA, DAMMA, KASRA, SUKUN, SHADDA # *
+
from alfanous.Constantes import INVERTEDSHAPING
-
-
-import re
+#from alfanous.dynamic_resources import stopwords_dyn ##should test existence before importing
class QSpaceTokenizer( RegexTokenizer ):
=== modified file 'src/alfanous/console.py'
--- src/alfanous/console.py 2012-11-22 23:12:08 +0000
+++ src/alfanous/console.py 2012-12-21 23:25:02 +0000
@@ -25,10 +25,10 @@
TODO __file__ to use resources and indexes integrated with Alfanous Module
'''
-import sys, json
-
-
+import sys
+import json
from argparse import ArgumentParser
+
from alfanous.Outputs import Raw
RAWoutput = Raw() #use default paths