Python db.close() Examples

The following are 30 code examples of db.close(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module db , or try the search function .
Example #1
Source File: dbshelve.py    From PokemonGo-DesktopMap with MIT License 6 votes vote down vote up
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
Example #2
Source File: dbshelve.py    From oss-ftp with MIT License 6 votes vote down vote up
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
Example #3
Source File: dbshelve.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
Example #4
Source File: dbshelve.py    From Computable with MIT License 6 votes vote down vote up
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
Example #5
Source File: geocode.py    From verejne.digital with Apache License 2.0 6 votes vote down vote up
def __init__(self):
        #load table to memory
        logging.info("Loading ids")
        cur = getCursor()
        executeAndLog(cur,
                "SELECT id, entity_name, address, original_address, lat, lng FROM entities")
        for row in cur:
            norm_name = self.normalize(row["entity_name"]) 
            logging.info(norm_name)
            norm_address = self.normalize(row["address"])
            norm_orig_address = self.normalize(row["original_address"])
            t_address = (hash(norm_name), hash(norm_address))
            t_orig_address = (hash(norm_name), hash(norm_orig_address))
            t_lat_lng = (hash(norm_name), hash((str(row["lat"]), str(row["lng"]))))
            self.name_address[t_address] = row["id"]
            self.name_address[t_orig_address] = row["id"]
            self.name_lat_lng[t_lat_lng] = row["id"]
            self.address_data[hash(norm_orig_address)] = row["id"]
        cur.close()
        logging.info("Loading done")

    # normalize string be removing spaces, dots, commas and turning everything into lower cases
    # TODO: normalize upper case letters with diacritics 
Example #6
Source File: dbshelve.py    From Splunking-Crime with GNU Affero General Public License v3.0 6 votes vote down vote up
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
Example #7
Source File: dbshelve.py    From BinderFilter with MIT License 6 votes vote down vote up
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
Example #8
Source File: dbshelve.py    From oss-ftp with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #9
Source File: dbshelve.py    From oss-ftp with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #10
Source File: dbshelve.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #11
Source File: dbshelve.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def close(self, *args, **kwargs):
        self.db.close(*args, **kwargs)
        self._closed = True 
Example #12
Source File: dbshelve.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#--------------------------------------------------------------------------- 
Example #13
Source File: dbshelve.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #14
Source File: dbshelve.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #15
Source File: dbshelve.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def close(self, *args, **kwargs):
        self.db.close(*args, **kwargs)
        self._closed = True 
Example #16
Source File: dbshelve.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#--------------------------------------------------------------------------- 
Example #17
Source File: dbshelve.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #18
Source File: dbshelve.py    From oss-ftp with MIT License 5 votes vote down vote up
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#--------------------------------------------------------------------------- 
Example #19
Source File: dbshelve.py    From oss-ftp with MIT License 5 votes vote down vote up
def close(self, *args, **kwargs):
        self.db.close(*args, **kwargs)
        self._closed = True 
Example #20
Source File: dbshelve.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #21
Source File: dbshelve.py    From Computable with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #22
Source File: dbshelve.py    From Computable with MIT License 5 votes vote down vote up
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#--------------------------------------------------------------------------- 
Example #23
Source File: dbshelve.py    From Computable with MIT License 5 votes vote down vote up
def close(self, *args, **kwargs):
        self.db.close(*args, **kwargs)
        self._closed = True 
Example #24
Source File: dbshelve.py    From Computable with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #25
Source File: dbshelve.py    From BinderFilter with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #26
Source File: dbshelve.py    From BinderFilter with MIT License 5 votes vote down vote up
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#--------------------------------------------------------------------------- 
Example #27
Source File: dbshelve.py    From BinderFilter with MIT License 5 votes vote down vote up
def close(self, *args, **kwargs):
        self.db.close(*args, **kwargs)
        self._closed = True 
Example #28
Source File: dbshelve.py    From BinderFilter with MIT License 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #29
Source File: dbshelve.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def __del__(self):
        self.close() 
Example #30
Source File: dbshelve.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#---------------------------------------------------------------------------