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
                remove_shortcut(dst)
            except Exception, e:
                self.main.global_error(WARNING, _("Failed to remove shortcut: %s") % str(e))
 
    def set_start_torrent_behavior(self, state_name):
            err_str = '"%s" : %s'%(ihex,text)
            self._error(severity, err_str)
            self._error(WARNING, 'Previous error raised for invalid infohash: "%s"' % ihex)
 
    def global_error(self, severity, text):

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
                os.remove(filename)
            except Exception, e:
                self.global_error(WARNING,
                                  (_("Could not delete cached %s file:")%d) +
                                  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
                        resumefile = None
                except Exception, e:
                    self._error(WARNING,
                                _("Could not load fastresume data: %s") % str(e)
                                + ' ' + _("Will perform full hash check."))
                    os.remove(filename)
                except Exception, e:
                    self._error(WARNING,
                                _("Could not remove fastresume file after "
                                  "failure:")
            resumefile.close()
        except Exception, e:
            self._error(WARNING, _("Could not write fastresume data: ") + str(e))
            if resumefile is not None:
                resumefile.close()
            data = StringIO()
            print_exc(file=data)
            self._error(WARNING, 'Unable to shutdown:\n'+data.getvalue())
        return False
 

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):
        except:
            if (r == win32event.WAIT_ABANDONED):
                self.log(WARNING, _("A previous instance of BT was not cleaned up properly. Continuing."))
                # take over the role of master
                takeover = 1
            else:
                self.log(WARNING, (_("Another instance of BT is running, but \"%s\" does not exist.\n") % filename)+
                    self.port = CONTROL_SOCKET_PORT
                    self.send_command('no-op')
                    self.log(WARNING, _("Port found: %d") % self.port)
                    try:
                        f = open(filename, "w")
                    # There's another copy of BitTorrent running, or something locking the mutex,
                    # but I can't communicate with it.
                    self.log(WARNING, _("Could not find port."))
 
 

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 UnsupportedWarning(logfunc, s):
    logfunc(WARNING, "NAT Traversal warning " + ("(%s: %s)."  % (os_version, s)))
 
def UPNPError(logfunc, s):
    logfunc(ERROR, "UPnP ERROR: " + ("(%s: %s)."  % (os_version, s)))
    def _discovery_timedout(self):
        if self.transport:
            self.logfunc(WARNING, "Discovery timed out")
            self.rawserver.stop_listening_multicast(self.transport)
            self.transport = None

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/ConvertedMetainfo.py   kamaelia(Download)
from BitTorrent.bencode import bencode
from BitTorrent import btformats
from BitTorrent import BTFailure, WARNING, ERROR
 
 
            sys.getfilesystemencoding
        except AttributeError:
            errorfunc(WARNING,
                      _("This seems to be an old Python version which "
                        "does not support detecting the filesystem "
                        "encoding. Assuming 'ascii'."))
            return
        encoding = sys.getfilesystemencoding()
        if encoding is None:
            errorfunc(WARNING,
                        "names used may still be correct."))
        elif self.bad_conversion:
            errorfunc(WARNING,
                      _('The character set used on the local filesystem ("%s") '
                        'cannot represent all characters used in the '
                        'filename(s) of this torrent. Filenames have been '
                        'changed from the original.') % filesystem_encoding)
        elif self.bad_windows:
            errorfunc(WARNING,

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):

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/RawServer.py   kamaelia(Download)
 
from BitTorrent.platform import bttime
from BitTorrent import WARNING, CRITICAL, FAQ_URL
from BitTorrent.defer import Deferred