Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Merged 'tseaver-no_globals_imports' branch:
Browse files Browse the repository at this point in the history
o Replaced  imports from the 'Globals' module throughout the tree with
  imports from the actual modules;  the 'Globals' module was always intended
  to be an area for shared data, rather than a "facade" for imports.

o Added 'zope.deferredimport.deprecation' entries to 'Globals/__init__.py'
  for all previously imported symbols / modules.

o Moved 'ApplicationdefaultPermissions' from 'App/class_init.py' to
  'AccessCoontrol/Permission.py', to avoid possible import cycle in
  third-party code.

o Moved canonical location of UNIQUE / REPLACEABLE / NOT_REPLACEABLE
  constants from 'Globals' to 'OFS.ObjectManager'.

o Removed 'stuffGlobals' hack in favor of the deferred / deprecation
  imports.
  • Loading branch information
tseaver committed Jan 2, 2009
1 parent 78cc04d commit 900f40b
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 42 deletions.
16 changes: 9 additions & 7 deletions BaseIndex.py
Expand Up @@ -18,18 +18,20 @@
import math

from BTrees.IOBTree import IOBTree
from BTrees.IIBTree import IIBTree, IIBucket, IITreeSet
from BTrees.IIBTree import intersection, difference
from BTrees.IIBTree import IIBTree
from BTrees.IIBTree import IIBucket
from BTrees.IIBTree import IITreeSet
from BTrees.IIBTree import difference
from BTrees.IIBTree import intersection
from BTrees.Length import Length
from Persistence import Persistent
from zope.interface import implements

from Products.ZCTextIndex.IIndex import IIndex
from Products.ZCTextIndex import WidCode
from Products.ZCTextIndex.SetOps import mass_weightedIntersection, \
mass_weightedUnion
from Products.ZCTextIndex.SetOps import mass_weightedIntersection
from Products.ZCTextIndex.SetOps import mass_weightedUnion

import ZODB
from Persistence import Persistent
from zope.interface import implements

# Instead of storing floats, we generally store scaled ints. Binary pickles
# can store those more efficiently. The default SCALE_FACTOR of 1024
Expand Down
7 changes: 4 additions & 3 deletions CosineIndex.py
Expand Up @@ -20,9 +20,10 @@
from zope.interface import implements

from Products.ZCTextIndex.IIndex import IIndex
from Products.ZCTextIndex.BaseIndex import BaseIndex, \
inverse_doc_frequency, \
scaled_int, SCALE_FACTOR
from Products.ZCTextIndex.BaseIndex import BaseIndex
from Products.ZCTextIndex.BaseIndex import inverse_doc_frequency
from Products.ZCTextIndex.BaseIndex import scaled_int
from Products.ZCTextIndex.BaseIndex import SCALE_FACTOR

class CosineIndex(BaseIndex):

Expand Down
6 changes: 3 additions & 3 deletions HTMLSplitter.py
Expand Up @@ -11,12 +11,12 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import re

from Products.ZCTextIndex.ISplitter import ISplitter
from Products.ZCTextIndex.PipelineFactory import element_factory
from zope.interface import implements

import re
from Products.ZCTextIndex.ISplitter import ISplitter
from Products.ZCTextIndex.PipelineFactory import element_factory

class HTMLWordSplitter:

Expand Down
4 changes: 1 addition & 3 deletions Lexicon.py
Expand Up @@ -21,15 +21,13 @@
from BTrees.IOBTree import IOBTree
from BTrees.OIBTree import OIBTree
from BTrees.Length import Length

import ZODB
from Persistence import Persistent
from zope.interface import implements

from Products.ZCTextIndex.StopDict import get_stopdict
from Products.ZCTextIndex.ParseTree import QueryError
from Products.ZCTextIndex.PipelineFactory import element_factory
from interfaces import ILexicon
from Products.ZCTextIndex.interfaces import ILexicon


class Lexicon(Persistent):
Expand Down
6 changes: 3 additions & 3 deletions OkapiIndex.py
Expand Up @@ -22,9 +22,9 @@
from zope.interface import implements

from Products.ZCTextIndex.IIndex import IIndex
from Products.ZCTextIndex.BaseIndex import BaseIndex, \
inverse_doc_frequency, \
scaled_int
from Products.ZCTextIndex.BaseIndex import BaseIndex
from Products.ZCTextIndex.BaseIndex import inverse_doc_frequency
from Products.ZCTextIndex.BaseIndex import scaled_int
from Products.ZCTextIndex.okascore import score

class OkapiIndex(BaseIndex):
Expand Down
7 changes: 3 additions & 4 deletions ParseTree.py
Expand Up @@ -13,13 +13,12 @@
##############################################################################

"""Generic parser support: exception and parse tree nodes."""
from zope.interface import implements

from BTrees.IIBTree import difference
from zope.interface import implements

from Products.ZCTextIndex.IQueryParseTree import IQueryParseTree
from Products.ZCTextIndex.SetOps import mass_weightedIntersection, \
mass_weightedUnion
from Products.ZCTextIndex.SetOps import mass_weightedIntersection
from Products.ZCTextIndex.SetOps import mass_weightedUnion

class QueryError(Exception):
pass
Expand Down
2 changes: 1 addition & 1 deletion QueryParser.py
Expand Up @@ -54,8 +54,8 @@
- these can be combined, e.g. ``foo -"foo bar"'' or ``foo -foo-bar''
- * and ? are used for globbing (i.e. prefix search), e.g. ``foo*''
"""

import re

from zope.interface import implements

from Products.ZCTextIndex.IQueryParser import IQueryParser
Expand Down
4 changes: 3 additions & 1 deletion SetOps.py
Expand Up @@ -14,7 +14,9 @@

"""SetOps -- Weighted intersections and unions applied to many inputs."""

from BTrees.IIBTree import IIBucket, weightedIntersection, weightedUnion
from BTrees.IIBTree import IIBucket
from BTrees.IIBTree import weightedIntersection
from BTrees.IIBTree import weightedUnion

from Products.ZCTextIndex.NBest import NBest

Expand Down
39 changes: 22 additions & 17 deletions ZCTextIndex.py
Expand Up @@ -18,36 +18,41 @@

from cgi import escape

from Persistence import Persistent
import Acquisition
from Acquisition import aq_base, aq_inner, aq_parent
from OFS.SimpleItem import SimpleItem
from Globals import DTMLFile, InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.Permissions import manage_zcatalog_indexes, search_zcatalog
from AccessControl.Permissions import manage_zcatalog_indexes
from AccessControl.Permissions import search_zcatalog
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Acquisition import Implicit
from App.class_init import InitializeClass
from App.special_dtml import DTMLFile
from OFS.SimpleItem import SimpleItem
from Persistence import Persistent
from zope.interface import implements

from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.common import safe_callable
from Products.PluginIndexes.interfaces import IPluggableIndex

from Products.ZCTextIndex.Lexicon import \
Lexicon, Splitter, CaseNormalizer, StopWordRemover
from Products.ZCTextIndex.Lexicon import CaseNormalizer
from Products.ZCTextIndex.Lexicon import Lexicon
from Products.ZCTextIndex.Lexicon import Splitter
from Products.ZCTextIndex.Lexicon import StopWordRemover
from Products.ZCTextIndex.NBest import NBest
from Products.ZCTextIndex.QueryParser import QueryParser
from CosineIndex import CosineIndex
from interfaces import ILexicon
from interfaces import IZCLexicon
from interfaces import IZCTextIndex
from OkapiIndex import OkapiIndex
from PipelineFactory import element_factory

from Products.ZCTextIndex.CosineIndex import CosineIndex
from Products.ZCTextIndex.interfaces import ILexicon
from Products.ZCTextIndex.interfaces import IZCLexicon
from Products.ZCTextIndex.interfaces import IZCTextIndex
from Products.ZCTextIndex.OkapiIndex import OkapiIndex
from Products.ZCTextIndex.PipelineFactory import element_factory

index_types = {'Okapi BM25 Rank':OkapiIndex,
'Cosine Measure':CosineIndex}


class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
class ZCTextIndex(Persistent, Implicit, SimpleItem):

"""Persistent text index.
"""
Expand Down Expand Up @@ -315,7 +320,7 @@ def manage_addLexicon(self, id, title='', elements=[], REQUEST=None):
LexiconMgmtPerm = 'Manage Vocabulary'


class PLexicon(Lexicon, Acquisition.Implicit, SimpleItem):
class PLexicon(Lexicon, Implicit, SimpleItem):

"""Lexicon for ZCTextIndex.
"""
Expand Down

0 comments on commit 900f40b

Please sign in to comment.