Custom Query (2447 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (469 - 471 of 2447)

Ticket Resolution Summary Owner Reporter
#927 Fixed [PATCH] Add support for boost 1.37 andar Plisk
Description

This simple patch adds support for boost 1.37.

#932 Fixed [PATCH] Optimize ti_name even more andar Plisk
Description

Looking through pydoc str accidentally gave a sight to optional arg to str.split(). So here are some more tests

import os

def f1(name):
    first_slash_index = name.find("/")
    if first_slash_index != -1:
        name = name[:first_slash_index]
    return name

def f2(name):
    name = os.path.split(name)[0]
    return name

def f3(name):
    name = name.split("/")[0]
    return name

def f4(name):
    name = name.split("/", 1)[0]
    return name

if __name__ == "__main__":
    import timeit
    print timeit.Timer("f1('11/22/33/44/55/66/test.txt')", "from __main__ import f1").timeit()
    print timeit.Timer("f2('11/22/33/44/55/66/test.txt')", "from __main__ import f2").timeit()
    print timeit.Timer("f3('11/22/33/44/55/66/test.txt')", "from __main__ import f3").timeit()
    print timeit.Timer("f4('11/22/33/44/55/66/test.txt')", "from __main__ import f4").timeit()

0.595607995987
2.00995993614
0.795026063919
0.599367141724

And a patch based on this

Index: deluge/core/torrent.py
===================================================================
--- deluge/core/torrent.py      (revision 5251)
+++ deluge/core/torrent.py      (working copy)
@@ -621,7 +584,7 @@

         def ti_name():
             if self.handle.has_metadata():
-                name = self.torrent_info.file_at(0).path.split("/")[0]
+                name = self.torrent_info.file_at(0).path.split("/", 1)[0]
                 try:
                     return name.decode("utf8", "ignore")
                 except UnicodeDecodeError:
#934 Fixed encoding of torrent andar bearsprite@gmail.com
Description

1. In deluge/ui/common.py, use some code to guess a encoding, and use the encoding to convert the mbcs string to utf8 string

self.__m_name = decode_string(self.__m_metadata["info"]["name"], self.encoding)

but why not:

self.__m_name = self.__m_metadata["info"]["name.utf-8"]

field "XXXX" is a mbcs, but field "XXXX.utf-8" is just a utf8!

  1. for f in self.__m_metadata["info"]["files"]:
        self.__m_files.append({
            'path': decode_string(os.path.join(prefix, *f["path"])),
            'size': f["length"],
            'download': True
        })
    

here "prefix" is already a utf8, but f[ "path" ] is a mbcs yet, so os.path.join is invalid

Batch Modify
Note: See TracBatchModify for help on using batch modify.
Note: See TracQuery for help on using queries.