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

All Samples(96)  |  Call(61)  |  Derive(0)  |  Import(35)

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
                infohash = hashtext.decode('hex')
            except:
                raise BTFailure(_("Invalid state file contents"))
            if len(infohash) != 20:
                raise BTFailure(_("Invalid state file contents"))
                return None
            if infohash in self.torrents:
                raise BTFailure(_("Invalid state file (duplicate entry)"))
            t = TorrentInfo(Preferences(self.config))
            self.torrents[infohash] = t
                    t.downtotal = t.downtotal_old = int(down)
            except ValueError:  # unpack, int(), decode()
                raise BTFailure(_("Invalid state file (bad entry)"))
            config = configfile.read_torrent_config(self.config,
                                                    self.config['data_dir'],

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):
                pass
            else:
                raise BTFailure(_("Could not create control socket: already in use"))
 
            try:
                os.unlink(filename)
            except OSError, e:
                raise BTFailure(_("Could not remove old control socket filename:")
            controlsocket = RawServer.create_unixserversocket(filename)
        except socket.error, e:
            raise BTFailure(_("Could not create control socket: ")+str(e))
 
        self.controlsocket = controlsocket
        except socket.error, e:
            s.close()
            raise BTFailure(_("Could not send command: ") + str(e))
 
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/Storage.py   kamaelia(Download)
from BitTorrent.obsoletepythonsupport import *
 
from BitTorrent import BTFailure, app_name
 
 
    def add_files(self, files, torrent):
        for filename in files:
            if filename in self.allfiles:
                raise BTFailure(_("File %s belongs to another running torrent")
                                % filename)
            if os.path.exists(filename):
                if not os.path.isfile(filename):
                    raise BTFailure(_("File %s already exists, but is not a "
                                      "regular file") % filename)
                l = os.path.getsize(filename)
        r = ''.join(r)
        if len(r) != amount:
            raise BTFailure(_("Short read - something truncated files?"))
        return r
 
            version = resumefile.readline()
            if version != 'BitTorrent resume state file, version 1\n':
                raise BTFailure(_("Unsupported fastresume file format, "
                                  "maybe from another client version?"))
            amount_done = int(resumefile.readline())

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):
            if not self._waspre(i):
                if self.rplaces[i] != UNALLOCATED:
                    raise BTFailure(_("--check_hashes 0 or fastresume info "
                                      "doesn't match file state (missing data)"))
                continue
                    continue
                if t == UNALLOCATED:
                    raise BTFailure(_("Bad fastresume info (files contain more "
                                      "data)"))
                if t == ALLOCATED:
                    continue
                if t!= FASTRESUME_PARTIAL:
                    raise BTFailure(_("Bad fastresume info (illegal value)"))
        data = data[:self._piecelen(piece)]
        if sha(data).digest() != self.hashes[piece]:
            raise BTFailure(_("data corrupted on disk - "
                              "maybe you have two copies running?"))
 

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
    # the wait may have been terminated because of an error
    if torrentqueue.initialized == -1:
        raise BTFailure(_("Could not start the TorrentQueue, see above for errors."))
 
    torrentqueue.rawserver.install_sigint_handler()

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
            s = s.strip()
        except:
            raise BTFailure(_("Could not get latest version from %s")%url)
        try:
            assert len(s) == 5
            availableversion = Version.from_str(s)
        except:
            raise BTFailure(_("Could not parse new version string from %s")%url)        

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/bittorrent-curses.py   kamaelia(Download)
from BitTorrent.obsoletepythonsupport import import_curses
from BitTorrent import configfile
from BitTorrent import BTFailure
from BitTorrent import version
from BitTorrent import GetTorrent
            if config['save_as']:
                if config['save_in']:
                    raise BTFailure(_("You cannot specify both --save_as and "
                                      "--save_in"))
                saveas = config['save_as']
            metainfo, errors = GetTorrent.get(torrentfile)
            if errors:
                raise BTFailure(_("Error reading .torrent file: ") + '\n'.join(errors))
        else:
            raise BTFailure(_("you must specify a .torrent file"))

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
 
 
                    if not btformats.allowed_path_re.match(x):
                        if l > 0:
                            raise BTFailure(_("Bad file path component: ")+x)
                        # BitComet makes bad .torrent files with empty
                        # filename part

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/parseargs.py   kamaelia(Download)
 
from BitTorrent.defaultargs import MyBool, MYTRUE
from BitTorrent import BTFailure
from BitTorrent.bencode import bdecode
from BitTorrent.platform import is_frozen_exe
def usage(str):
    raise BTFailure(str)
 
def format_key(key):
    if len(key) == 1:
                    boolval = True
                if key not in config:
                    raise BTFailure(_("unknown key ") + format_key(key))
                if type(config[key]) is MyBool: # boolean cmd line switch, no value
                    value = boolval
                    pos += 2
            else:
                raise BTFailure(_("command line parsing failed at ")+argv[pos])
 
            presets[key] = value
def parse_options(defaults, newvalues):
    for key, value in newvalues.iteritems():
        if not defaults.has_key(key):
            raise BTFailure(_("unknown key ") + format_key(key))
        try:

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrentKamaelia.py   kamaelia(Download)
from BitTorrent.prefs import Preferences
from BitTorrent import configfile
from BitTorrent import BTFailure
from BitTorrent import version
from BitTorrent import GetTorrent
            metainfo, errors = GetTorrent.get( self.torrentfilename )
            if errors:
                raise BTFailure(_("Error reading .torrent file: ") + '\n'.join(errors))
            else:
                self.dl = DLKamaelia(metainfo, config, self)
            if self.config['save_as']:
                if self.config['save_in']:
                    raise BTFailure(_("You cannot specify both --save_as and "
                                      "--save_in"))
                saveas = self.config['save_as']

  1 | 2 | 3 | 4  Next