Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(0)  |  Derive(0)  |  Import(10)
int(x=0) -> int or long
int(x, base=10) -> int or long

Convert a number or string to an integer, or return 0 if no arguments
are given.  If x is floating point, the conversion truncates towards zero.
If x is outside the integer range, the function returns a long instead.

If x is not a number or if base is given, then x must be a string or
Unicode object representing an integer literal in the given base.  The
literal can be preceded by '+' or '-' and be surrounded by whitespace.(more...)

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/bittorrent.py   kamaelia(Download)
assert sys.version_info >= (2, 3), _("Install Python %s or greater") % '2.3'
 
from BitTorrent import BTFailure, INFO, WARNING, ERROR, CRITICAL, status_dict, app_name
 
from BitTorrent import configfile
            ipc.send_command('no-op')
        except BTFailure:
            global_log_func(ERROR, _("Failed to communicate with another %s process "
                                     "but one seems to be running.") + 
                                   _(" Closing all %s windows may fix the problem.")
            ipc.send_command('show_error', _("%s already running")%app_name)
        except BTFailure:
            global_log_func(ERROR, _("Failed to communicate with another %s process.") +
                                   _(" Closing all %s windows may fix the problem.")
                                   % app_name)
    def _error(self, severity, err_str):
        err_str = err_str.decode('utf-8', 'replace').encode('utf-8')
        err_str = err_str.strip()
        if severity >= ERROR:
            self.error_modal(err_str)

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/TorrentQueue.py   kamaelia(Download)
from BitTorrent.ConvertedMetainfo import ConvertedMetainfo
from BitTorrent.prefs import Preferences
from BitTorrent import BTFailure, BTShutdown, INFO, WARNING, ERROR, CRITICAL
from BitTorrent import configfile
from BitTorrent import FAQ_URL
                self.queue = []
                self.other_torrents = []
                self.global_error(ERROR, _("Could not load saved state: ")+str(e))
            else:
                for infohash in self.running_torrents + self.queue + \
            os.rename(filename + '.new', filename)
        except Exception, e:
            self.global_error(ERROR, _("Could not save UI state: ") + str(e))
            if f is not None:
                f.close()
                except:
                    pass
                self.global_error(ERROR,
                                  (_("Error reading file \"%s\".") % path) +
                                  " (" + str(e)+ "), " +
                t.metainfo = ConvertedMetainfo(bdecode(data))
            except Exception, e:
                self.global_error(ERROR,
                                  (_("Corrupt data in \"%s\", cannot restore torrent.") % path) +
                                  '('+str(e)+')')

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/download.py   kamaelia(Download)
from BitTorrent.ConvertedMetainfo import set_filesystem_encoding
from BitTorrent import version
from BitTorrent import BTFailure, BTShutdown, INFO, WARNING, ERROR, CRITICAL
 
from khashmir.utkhashmir import UTKhashmir
    def got_exception(self, e):
        is_external = False
        if isinstance(e, BTShutdown):
            self._error(ERROR, str(e))
            is_external = True
            self._close()
        except Exception, e:
            self._error(ERROR,
                        _("Additional error when closing down due to error: ") +
                        str(e))

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/NatTraversal.py   kamaelia(Download)
 
from BitTorrent import app_name, defer
from BitTorrent import INFO, WARNING, ERROR
from BitTorrent.platform import os_version
from BitTorrent.RawServer_magic import RawServer, Handler
def UPNPError(logfunc, s):
    logfunc(ERROR, "UPnP ERROR: " + ("(%s: %s)."  % (os_version, s)))
 
class UPnPException(Exception):
    pass
        def log_severity_filter(level, s, optional=True):
            global debug
            if level >= ERROR or debug or not optional:
                logfunc(level, s)
        self.logfunc = log_severity_filter
        except Exception, e: #HTTPError, URLError, BadStatusLine, you name it.
            error = SOAPErrorToString(e)
            self.logfunc(ERROR, error)
 
    def data_came_in(self, addr, datagram):
                break
            except (HTTPError, BadStatusLine), e:
                self.logfunc(ERROR, ("list_ports failed with: %s" % (e)))
 
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/IPC.py   kamaelia(Download)
from BitTorrent.RawServer_magic import RawServer, Handler
from BitTorrent.platform import get_home_dir, get_config_dir
from BitTorrent import INFO, WARNING, ERROR, CRITICAL, BTFailure, app_name
 
def toint(s):

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/NewVersion.py   kamaelia(Download)
DEBUG = False
 
from BitTorrent import ERROR, WARNING, BTFailure, version, app_name
from BitTorrent import GetTorrent
from BitTorrent.bencode import bdecode, bencode

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/Rerequester.py   kamaelia(Download)
from BitTorrent.btformats import check_peers
from BitTorrent.bencode import bencode, bdecode
from BitTorrent import BTFailure, INFO, WARNING, ERROR, CRITICAL
 
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/configfile.py   kamaelia(Download)
from ConfigParser import MissingSectionHeaderError, ParsingError
from BitTorrent import parseargs
from BitTorrent import app_name, version, ERROR, BTFailure
from BitTorrent.platform import get_config_dir, locale_root, is_frozen_exe
from BitTorrent.defaultargs import MYTRUE
        except:
            pass
        error_callback(ERROR, _("Could not permanently save options: ")+
                       str(e))
 
            if is_frozen_exe:
                err_str = _("You must quit %s and reinstall it. (%s)") % (app_name, err_str)
            error_callback(ERROR, err_str)
    _write_config(error_callback, filename, p)
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/ConvertedMetainfo.py   kamaelia(Download)
from BitTorrent.bencode import bencode
from BitTorrent import btformats
from BitTorrent import BTFailure, WARNING, ERROR
 
 
        'a1'.decode(encoding)
    except:
        errorfunc(ERROR,
                  _("Filesystem encoding '%s' is not supported. "
                    "Using 'ascii' instead.") % encoding)
    def show_encoding_errors(self, errorfunc):
        self.reported_errors = True
        if self.bad_torrent_unsolvable:
            errorfunc(ERROR,
                      _("This .torrent file has been created with a broken "
                        "tool and has incorrectly encoded filenames. Some or "
                        "all of the filenames may appear different from what "
                        "the creator of the .torrent file intended."))
        elif self.bad_torrent_noncharacter:
            errorfunc(ERROR,
                        "of the .torrent file intended."))
        elif self.bad_torrent_wrongfield:
            errorfunc(ERROR,
                      _("This .torrent file has been created with a broken "
                        "tool and has incorrectly encoded filenames. The "

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/StorageWrapper.py   kamaelia(Download)
 
from BitTorrent.bitfield import Bitfield
from BitTorrent import BTFailure, INFO, WARNING, ERROR, CRITICAL
 
def toint(s):