__init__.py :  » Parser » SimpleParse » SimpleParse-2.1.1a2 » stt » TextTools » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Parser » SimpleParse 
SimpleParse » SimpleParse 2.1.1a2 » stt » TextTools » __init__.py
""" mxTextTools - A tools package for fast text processing.

    Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2003, eGenix.com Software GmbH; mailto:info@egenix.com
    Copyright (c) 2003-2006, Mike Fletcher; mailto:mcfletch@vrplumber.com
    See the documentation for further information on copyrights,
    or contact the author. All Rights Reserved.
"""
from TextTools import *
from TextTools import __version__

### Make the types pickleable:

# Shortcuts for pickle (reduces the pickle's length)
def _CS(definition):
    return CharSet(definition)
def _TT(definition):
    return TagTable(definition)
def _TS(match,translate,algorithm):
    return TextSearch(match,translate,algorithm)
# Needed for backward compatibility:
def _BMS(match,translate):
    return BMS(match,translate)
def _FS(match,translate):
    return FS(match,translate)

# Module init
class modinit:

    ### Register the types
    import copy_reg

    def pickle_CharSet(cs):
        return _CS,(cs.definition,)
    def pickle_TagTable(tt):
        return _TT,(tt.compiled(),)
    def pickle_TextSearch(ts):
        return _TS,(ts.match, ts.translate, ts.algorithm)
    copy_reg.pickle(CharSetType,
                    pickle_CharSet,
                    _CS)
    copy_reg.pickle(TagTableType,
                    pickle_TagTable,
                    _TT)
    copy_reg.pickle(TextSearchType,
                    pickle_TextSearch,
                    _TS)
    if 0:
        def pickle_BMS(so):
            return _BMS,(so.match,so.translate)
        def pickle_FS(so):
            return _FS,(so.match,so.translate)
        copy_reg.pickle(BMSType,
                        pickle_BMS,
                        _BMS)
        copy_reg.pickle(FSType,
                        pickle_FS,
                        _FS)
        

del modinit
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.