Python os.path 模块,lower() 实例源码

我们从Python开源项目中,提取了以下30个代码示例,用于说明如何使用os.path.lower()

项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def createRequest(self, op, request, device = None ):
        global lst
        try:
            path = str(request.url().path())
        except UnicodeEncodeError:
            pass
        lower_case = path.lower()
        #lst = tuple(open("easylist.txt", 'r'))
        lst = ["doubleclick.net" ,"ads",'.jpg','redirector','itag=','.png','.gif','.css','google','facebook','.aspx',r"http[^'].mp4",r"http[^'].flv", r"||youtube-nocookie.com/gen_204?", r"youtube.com###watch-branded-actions", "imagemapurl","b.scorecardresearch.com","rightstuff.com","scarywater.net","popup.js","banner.htm","_tribalfusion","||n4403ad.doubleclick.net^$third-party",".googlesyndication.com","graphics.js","fonts.googleapis.com/css","s0.2mdn.net","server.cpmstar.com","||banzai/banner.$subdocument","@@||anime-source.com^$document","google","/pagead2.","frugal.gif","jriver_banner.png","show_ads.js",'##a[href^="http://billing.frugalusenet.com/"]',"http://jriver.com/video.html","||animenewsnetwork.com^*.aframe?","||contextweb.com^$third-party",".gutter",".iab",'http://www.animenewsnetwork.com/assets/[^"]*.jpg']
        block = False
        for l in lst:
            if lower_case.find(l) != -1:
                block = True
                break
        if block:
            print ("Skipping")
            print (request.url().path())
            return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QtNetwork.QNetworkRequest(QtCore.QUrl()))
        else:
            return QNetworkAccessManager.createRequest(self, op, request, device)
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def createRequest(self, op, request, device = None ):
        global lst
        try:
            path = str(request.url().path())
        except UnicodeEncodeError:
            pass
        lower_case = path.lower()
        #lst = tuple(open("easylist.txt", 'r'))
        lst = ["doubleclick.net" ,"ads",'.jpg','redirector','itag=','.png','.gif','.css','google','facebook','.aspx',r"http[^'].mp4",r"http[^'].flv", r"||youtube-nocookie.com/gen_204?", r"youtube.com###watch-branded-actions", "imagemapurl","b.scorecardresearch.com","rightstuff.com","scarywater.net","popup.js","banner.htm","_tribalfusion","||n4403ad.doubleclick.net^$third-party",".googlesyndication.com","graphics.js","fonts.googleapis.com/css","s0.2mdn.net","server.cpmstar.com","||banzai/banner.$subdocument","@@||anime-source.com^$document","google","/pagead2.","frugal.gif","jriver_banner.png","show_ads.js",'##a[href^="http://billing.frugalusenet.com/"]',"http://jriver.com/video.html","||animenewsnetwork.com^*.aframe?","||contextweb.com^$third-party",".gutter",".iab",'http://www.animenewsnetwork.com/assets/[^"]*.jpg']
        block = False
        for l in lst:
            if lower_case.find(l) != -1:
                block = True
                break
        if block:
            print ("Skipping")
            print (request.url().path())
            return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QtNetwork.QNetworkRequest(QtCore.QUrl()))
        else:
            return QNetworkAccessManager.createRequest(self, op, request, device)
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def _CopyOrLink(self, source_dir, stage_dir, static_dir, inside_web_inf):
    source_dir = os.path.abspath(source_dir)
    stage_dir = os.path.abspath(stage_dir)
    static_dir = os.path.abspath(static_dir)
    for file_name in os.listdir(source_dir):
      file_path = os.path.join(source_dir, file_name)

      if file_name.startswith('.') or file_name == 'appengine-generated':
        continue

      if os.path.isdir(file_path):
        self._CopyOrLink(
            file_path,
            os.path.join(stage_dir, file_name),
            os.path.join(static_dir, file_name),
            inside_web_inf or file_name == 'WEB-INF')
      else:
        if (inside_web_inf
            or self.app_engine_web_xml.IncludesResource(file_path)
            or (self.options.compile_jsps
                and file_path.lower().endswith('.jsp'))):
          self._CopyOrLinkFile(file_path, os.path.join(stage_dir, file_name))
        if (not inside_web_inf
            and self.app_engine_web_xml.IncludesStatic(file_path)):
          self._CopyOrLinkFile(file_path, os.path.join(static_dir, file_name))
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def _CopyOrLink(self, source_dir, stage_dir, static_dir, inside_web_inf):
    source_dir = os.path.abspath(source_dir)
    stage_dir = os.path.abspath(stage_dir)
    static_dir = os.path.abspath(static_dir)
    for file_name in os.listdir(source_dir):
      file_path = os.path.join(source_dir, file_name)

      if file_name.startswith('.') or file_name == 'appengine-generated':
        continue

      if os.path.isdir(file_path):
        self._CopyOrLink(
            file_path,
            os.path.join(stage_dir, file_name),
            os.path.join(static_dir, file_name),
            inside_web_inf or file_name == 'WEB-INF')
      else:
        if (inside_web_inf
            or self.app_engine_web_xml.IncludesResource(file_path)
            or (self.options.compile_jsps
                and file_path.lower().endswith('.jsp'))):
          self._CopyOrLinkFile(file_path, os.path.join(stage_dir, file_name))
        if (not inside_web_inf
            and self.app_engine_web_xml.IncludesStatic(file_path)):
          self._CopyOrLinkFile(file_path, os.path.join(static_dir, file_name))
项目:pandas-100    作者:deeplook    | 项目源码 | 文件源码
def _main():
    desc = "Generate quiz cards from dedicated file in MarkDown format."
    parser = argparse.ArgumentParser(description=desc)
    paa = parser.add_argument
    paa("-V", "--verbose",
        action="store_true",
        help="Set verbose output.", 
        dest="verbose")
    paa("paths",
        metavar='PATH',
        help="Path of a MardDown file.",
        nargs='+')

    options = parser.parse_args()
    for path in options.paths:
        if path.lower().endswith(".md"):
            cover, items = markdown_to_platypus(path)
            make_cards_file(path, cover, items, verbose=options.verbose)
项目:xxNet    作者:drzorm    | 项目源码 | 文件源码
def _CopyOrLink(self, source_dir, stage_dir, static_dir, inside_web_inf):
    source_dir = os.path.abspath(source_dir)
    stage_dir = os.path.abspath(stage_dir)
    static_dir = os.path.abspath(static_dir)
    for file_name in os.listdir(source_dir):
      file_path = os.path.join(source_dir, file_name)

      if file_name.startswith('.') or file_name == 'appengine-generated':
        continue

      if os.path.isdir(file_path):
        self._CopyOrLink(
            file_path,
            os.path.join(stage_dir, file_name),
            os.path.join(static_dir, file_name),
            inside_web_inf or file_name == 'WEB-INF')
      else:
        if (inside_web_inf
            or self.app_engine_web_xml.IncludesResource(file_path)
            or (self.options.compile_jsps
                and file_path.lower().endswith('.jsp'))):
          self._CopyOrLinkFile(file_path, os.path.join(stage_dir, file_name))
        if (not inside_web_inf
            and self.app_engine_web_xml.IncludesStatic(file_path)):
          self._CopyOrLinkFile(file_path, os.path.join(static_dir, file_name))
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def _CopyOrLink(self, source_dir, stage_dir, static_dir, inside_web_inf):
    source_dir = os.path.abspath(source_dir)
    stage_dir = os.path.abspath(stage_dir)
    static_dir = os.path.abspath(static_dir)
    for file_name in os.listdir(source_dir):
      file_path = os.path.join(source_dir, file_name)

      if file_name.startswith('.') or file_name == 'appengine-generated':
        continue

      if os.path.isdir(file_path):
        self._CopyOrLink(
            file_path,
            os.path.join(stage_dir, file_name),
            os.path.join(static_dir, file_name),
            inside_web_inf or file_name == 'WEB-INF')
      else:
        if (inside_web_inf
            or self.app_engine_web_xml.IncludesResource(file_path)
            or (self.options.compile_jsps
                and file_path.lower().endswith('.jsp'))):
          self._CopyOrLinkFile(file_path, os.path.join(stage_dir, file_name))
        if (not inside_web_inf
            and self.app_engine_web_xml.IncludesStatic(file_path)):
          self._CopyOrLinkFile(file_path, os.path.join(static_dir, file_name))
项目:Docker-XX-Net    作者:kuanghy    | 项目源码 | 文件源码
def _CopyOrLink(self, source_dir, stage_dir, static_dir, inside_web_inf):
    source_dir = os.path.abspath(source_dir)
    stage_dir = os.path.abspath(stage_dir)
    static_dir = os.path.abspath(static_dir)
    for file_name in os.listdir(source_dir):
      file_path = os.path.join(source_dir, file_name)

      if file_name.startswith('.') or file_name == 'appengine-generated':
        continue

      if os.path.isdir(file_path):
        self._CopyOrLink(
            file_path,
            os.path.join(stage_dir, file_name),
            os.path.join(static_dir, file_name),
            inside_web_inf or file_name == 'WEB-INF')
      else:
        if (inside_web_inf
            or self.app_engine_web_xml.IncludesResource(file_path)
            or (self.options.compile_jsps
                and file_path.lower().endswith('.jsp'))):
          self._CopyOrLinkFile(file_path, os.path.join(stage_dir, file_name))
        if (not inside_web_inf
            and self.app_engine_web_xml.IncludesStatic(file_path)):
          self._CopyOrLinkFile(file_path, os.path.join(static_dir, file_name))
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def __init__(self,url,quality,c,end_point=None,get_cookie=None,domain_name=None,captcha=None,get_epn=None,get_link=None):
        super(BrowserPage, self).__init__()
        self.hdr = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0'
        #self.loadFinished.connect(self._loadFinished)
        self.loadProgress.connect(self._loadProgress)
        self.url = url
        self.cnt = 0
        self.quality = quality
        self.cookie_file = c
        self.tmp_dir,self.new_c = os.path.split(self.cookie_file)
        if not end_point:
            self.end_point = 'cf_clearance'
        else:
            self.end_point = end_point
        if get_link:
            self.get_link = True
        else:
            self.get_link = None
        self.domain_name = domain_name
        if self.domain_name:
            if self.domain_name.lower() == 'none':
                self.domain_name = None
        self.get_cookie = get_cookie
        self.captcha = captcha
        self.get_epn = get_epn
项目:oc-pyang    作者:openconfig    | 项目源码 | 文件源码
def path_to_id(nodepath):
  """Given a path, return a string suitable as an HTML id attribute"""

  path = yangpath.strip_namespace(nodepath)
  # remove leading slash
  path = path.lstrip('/')
  path = re.sub (r'\/', r'-', path)
  return path.lower()
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def _ShouldSplitJar(self, path):
    return (path.lower().endswith('.jar') and self.options.do_jar_splitting and
            os.path.getsize(path) >= self._MAX_SIZE)
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def _ShouldSplitJar(self, path):
    return (path.lower().endswith('.jar') and self.options.do_jar_splitting and
            os.path.getsize(path) >= self._MAX_SIZE)
项目:xxNet    作者:drzorm    | 项目源码 | 文件源码
def _ShouldSplitJar(self, path):
    return (path.lower().endswith('.jar') and self.options.do_jar_splitting and
            os.path.getsize(path) >= self._MAX_SIZE)
项目:autosub-bootstrapbill    作者:BenjV    | 项目源码 | 文件源码
def index(self):
        return TEMPLATE_FRAMESET % self.root.lower()
项目:autosub-bootstrapbill    作者:BenjV    | 项目源码 | 文件源码
def menu(self, base='/', pct='50', showpct='',
             exclude=r'python\d\.\d|test|tut\d|tutorial'):

        # The coverage module uses all-lower-case names.
        base = base.lower().rstrip(os.sep)

        yield TEMPLATE_MENU
        yield TEMPLATE_FORM % locals()

        # Start by showing links for parent paths
        yield "<div id='crumbs'>"
        path = ''
        atoms = base.split(os.sep)
        atoms.pop()
        for atom in atoms:
            path += atom + os.sep
            yield ("<a href='menu?base=%s&exclude=%s'>%s</a> %s"
                   % (path, quote_plus(exclude), atom, os.sep))
        yield '</div>'

        yield "<div id='tree'>"

        # Then display the tree
        tree = get_tree(base, exclude, self.coverage)
        if not tree:
            yield '<p>No modules covered.</p>'
        else:
            for chunk in _show_branch(tree, base, '/', pct,
                                      showpct == 'checked', exclude,
                                      coverage=self.coverage):
                yield chunk

        yield '</div>'
        yield '</body></html>'
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def _ShouldSplitJar(self, path):
    return (path.lower().endswith('.jar') and self.options.do_jar_splitting and
            os.path.getsize(path) >= self._MAX_SIZE)
项目:Docker-XX-Net    作者:kuanghy    | 项目源码 | 文件源码
def _ShouldSplitJar(self, path):
    return (path.lower().endswith('.jar') and self.options.do_jar_splitting and
            os.path.getsize(path) >= self._MAX_SIZE)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def createRequest(self, op, request, device = None ):
        global block_list,TMP_DIR
        try:
            urlLnk = (request.url()).toString()
            path = (request.url().toString())
        except UnicodeEncodeError:
            path = (request.url().path())

        if '9anime.to' in path and 'episode/info?' in path:
            f = open(os.path.join(TMP_DIR,'lnk.txt'),'w')
            f.write(path)
            f.close()
        lower_path = path.lower()
        #block_list = []
        block_list = ["doubleclick.net" ,"ads",'.gif','.css','facebook','.aspx', r"||youtube-nocookie.com/gen_204?", r"youtube.com###watch-branded-actions", "imagemapurl","b.scorecardresearch.com","rightstuff.com","scarywater.net","popup.js","banner.htm","_tribalfusion","||n4403ad.doubleclick.net^$third-party",".googlesyndication.com","graphics.js","fonts.googleapis.com/css","s0.2mdn.net","server.cpmstar.com","||banzai/banner.$subdocument","@@||anime-source.com^$document","/pagead2.","frugal.gif","jriver_banner.png","show_ads.js",'##a[href^="http://billing.frugalusenet.com/"]',"http://jriver.com/video.html","||animenewsnetwork.com^*.aframe?","||contextweb.com^$third-party",".gutter",".iab",'http://www.animenewsnetwork.com/assets/[^"]*.jpg','revcontent']
        block = False
        for l in block_list:
            if l in lower_path:
                block = True
                break
        if block:
            return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QtNetwork.QNetworkRequest(QtCore.QUrl()))
        else:
            if 'itag=' in urlLnk and 'redirector' not in urlLnk:
                print('*********')
                #f = open(os.path.join(TMP_DIR,'lnk.txt'),'w')
                #f.write(urlLnk)
                #f.close()
                return QNetworkAccessManager.createRequest(self, op, request, device)

            else:
                return QNetworkAccessManager.createRequest(self, op, request, device)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def createRequest(self, op, request, device = None ):
        global lst,pg
        try:
            #print(str(request.url()))
            urlLnk = (request.url()).toString()
            #print(urlLnk)
            path = str(request.url().path())
        except UnicodeEncodeError:
            pass
        #print(path)
        lower_case = path.lower()
        #lst = tuple(open("easylist.txt", 'r'))
        lst = ["doubleclick.net" ,"ads",'.jpg','.png','.gif','.css','facebook','.aspx', r"||youtube-nocookie.com/gen_204?", r"youtube.com###watch-branded-actions", "imagemapurl","b.scorecardresearch.com","rightstuff.com","scarywater.net","popup.js","banner.htm","_tribalfusion","||n4403ad.doubleclick.net^$third-party",".googlesyndication.com","graphics.js","fonts.googleapis.com/css","s0.2mdn.net","server.cpmstar.com","||banzai/banner.$subdocument","@@||anime-source.com^$document","/pagead2.","frugal.gif","jriver_banner.png","show_ads.js",'##a[href^="http://billing.frugalusenet.com/"]',"http://jriver.com/video.html","||animenewsnetwork.com^*.aframe?","||contextweb.com^$third-party",".gutter",".iab",'http://www.animenewsnetwork.com/assets/[^"]*.jpg']
        block = False
        for l in lst:
            if lower_case.find(l) != -1:
                block = True
                break
        if block:
            #print ("Skipping")
            #print (request.url().path())

            return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QtNetwork.QNetworkRequest(QtCore.QUrl()))
        else:
            if 'itag=' in urlLnk and 'redirector' not in urlLnk:
                print('*********')
                #print()
                #print(path)
                #print(urlLnk)
                #pg.web.setHtml('<html>got the link</html>')
                #self.lnkUrl.emit(path)
                f = open('/tmp/AnimeWatch/lnk.txt','w')
                f.write(urlLnk)
                f.close()
                return QNetworkAccessManager.createRequest(self, op, request, device)
                #return QNetworkAccessManager.createRequest(self, op, request, device)
                #return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QtNetwork.QNetworkRequest(QtCore.QUrl()))

            else:
                return QNetworkAccessManager.createRequest(self, op, request, device)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def naturallysorted(l): 
    convert = lambda text: int(text) if text.isdigit() else text.lower() 
    alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] 
    return sorted(l, key = alphanum_key)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def filter_label_list(self):
        global opt,pgn,site,list1_items,base_url,filter_on,base_url,embed,hist_arr
        print ("filter label")
        filter_on = 1
        row_history = []
        key = str(self.label_search.text()).lower()
        if not key:
            filter_on = 0
        found_item = []
        found_item_index = []
        print (opt)
        print (site)
        found_item_index[:]=[]
        if not self.scrollArea.isHidden():
            if key:
                for i in range(self.list1.count()):
                    srch = str(self.list1.item(i).text()).lower()
                    if key in srch:
                        found_item.append(i)
                        found_item_index.append(1)
                    else:
                        found_item_index.append(0)
            else:
                for i in range(self.list1.count()):             
                        found_item_index.append(1)
        else:
            if key:
                for i in range(self.list2.count()):
                    srch = str(self.list2.item(i).text()).lower()
                    if key in srch:
                        found_item.append(i)
                        found_item_index.append(1)
                    else:
                        found_item_index.append(0)
            else:
                for i in range(self.list2.count()):             
                        found_item_index.append(1)


        self.label_filter_list_update(found_item_index)
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def filter_epn_list_txt(self):
        global opt,pgn,site,list1_items,base_url,filter_on,base_url,embed,hist_arr,epnArrList
        print ("filter epn list")
        filter_on = 1
        row_history = []
        key = str(self.goto_epn_filter_txt.text()).lower()
        if not key:
            filter_on = 0
        found_item = []
        found_item_index = []
        print (opt)
        print (site)
        found_item_index[:]=[]

        if key:
            #self.list1.hide()
            self.list5.show()
            for i in range(len(epnArrList)):
                srch = epnArrList[i]

                srch1 = srch.lower()
                srch2 = str(self.list2.item(i).text())
                if key in srch1:
                    found_item.append(str(i)+':'+srch2)

            length = len(found_item_index)
            self.list5.clear()
            for i in found_item:
                self.list5.addItem(i)


        else:
            self.list5.clear()
            self.list5.hide()
            self.list2.show()
项目:AnimeWatch    作者:kanishka-linux    | 项目源码 | 文件源码
def createRequest(self, op, request, device = None ):
        global block_list,TMP_DIR
        try:
            urlLnk = (request.url()).toString()
            path = (request.url().toString())
        except UnicodeEncodeError:
            path = (request.url().path())

        lower_path = path.lower()
        block_list = ["doubleclick.net" ,"ads",'.jpg','.png','.gif','.css','facebook','.aspx', r"||youtube-nocookie.com/gen_204?", r"youtube.com###watch-branded-actions", "imagemapurl","b.scorecardresearch.com","rightstuff.com","scarywater.net","popup.js","banner.htm","_tribalfusion","||n4403ad.doubleclick.net^$third-party",".googlesyndication.com","graphics.js","fonts.googleapis.com/css","s0.2mdn.net","server.cpmstar.com","||banzai/banner.$subdocument","@@||anime-source.com^$document","/pagead2.","frugal.gif","jriver_banner.png","show_ads.js",'##a[href^="http://billing.frugalusenet.com/"]',"http://jriver.com/video.html","||animenewsnetwork.com^*.aframe?","||contextweb.com^$third-party",".gutter",".iab",'http://www.animenewsnetwork.com/assets/[^"]*.jpg']
        block = False
        for l in block_list:
            if l in lower_path:
                block = True
                break
        if block:
            #print ("Skipping")
            #print (request.url().path())

            return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QtNetwork.QNetworkRequest(QtCore.QUrl()))
        else:
            if 'itag=' in urlLnk and 'redirector' not in urlLnk:
                print('*********')
                f = open(os.path.join(TMP_DIR,'lnk.txt'),'w')
                f.write(urlLnk)
                f.close()
                return QNetworkAccessManager.createRequest(self, op, request, device)

            else:
                return QNetworkAccessManager.createRequest(self, op, request, device)
项目:watcher    作者:nosmokingbandit    | 项目源码 | 文件源码
def index(self):
        return TEMPLATE_FRAMESET % self.root.lower()
项目:watcher    作者:nosmokingbandit    | 项目源码 | 文件源码
def menu(self, base="/", pct="50", showpct="",
             exclude=r'python\d\.\d|test|tut\d|tutorial'):

        # The coverage module uses all-lower-case names.
        base = base.lower().rstrip(os.sep)

        yield TEMPLATE_MENU
        yield TEMPLATE_FORM % locals()

        # Start by showing links for parent paths
        yield "<div id='crumbs'>"
        path = ""
        atoms = base.split(os.sep)
        atoms.pop()
        for atom in atoms:
            path += atom + os.sep
            yield ("<a href='menu?base=%s&exclude=%s'>%s</a> %s"
                   % (path, quote_plus(exclude), atom, os.sep))
        yield "</div>"

        yield "<div id='tree'>"

        # Then display the tree
        tree = get_tree(base, exclude, self.coverage)
        if not tree:
            yield "<p>No modules covered.</p>"
        else:
            for chunk in _show_branch(tree, base, "/", pct,
                                      showpct == 'checked', exclude,
                                      coverage=self.coverage):
                yield chunk

        yield "</div>"
        yield "</body></html>"
项目:maas    作者:maas    | 项目源码 | 文件源码
def clean_path(self, path):
        """Converts Windows path into a unix path and strips the
        boot subdirectory from the paths.
        """
        path = path.lower().replace('\\', '/')
        if path[0:6] == "/boot/":
            path = path[6:]
        return path
项目:maas    作者:maas    | 项目源码 | 文件源码
def match_path(self, backend, path):
        """Checks path to see if the boot method should handle
        the requested file.

        :param backend: requesting backend
        :param path: requested path
        :return: dict of match params from path, None if no match
        """
        # If the node is requesting the initial bootloader, then we
        # need to see if this node is set to boot Windows first.
        local_host, local_port = tftp.get_local_address()
        if path == 'pxelinux.0':
            data = yield self.get_node_info()
            if data is None:
                returnValue(None)

            # Only provide the Windows bootloader when installing
            # PXELINUX chainloading will work for the rest of the time.
            purpose = data.get('purpose')
            if purpose != 'install':
                returnValue(None)

            osystem = data.get('osystem')
            if osystem == 'windows':
                # python-hivex is needed to continue.
                if get_hivex_module() is None:
                    raise BootMethodError('python-hivex package is missing.')

                returnValue({
                    'mac': data.get('mac'),
                    'path': self.bootloader_path,
                    'local_host': local_host,
                    })
        # Fix the paths for the other static files, Windows requests.
        elif path.lower() in STATIC_FILES:
            returnValue({
                'mac': get_remote_mac(),
                'path': self.clean_path(path),
                'local_host': local_host,
                })
        returnValue(None)
项目:xpybuild    作者:xpybuild    | 项目源码 | 文件源码
def __openArchive(self, path):
        if path.lower().endswith('.zip') or path.lower().endswith('.jar') or path.lower().endswith('.war'):
            return zipfile.ZipFile(path, 'r')
        if path.lower().endswith('.tar.gz') or path.lower().endswith('.tar.bz2') or path.lower().endswith('.tar'):
            return tarfile.open(path, 'r')
        raise BuildException('Unsupported archive type: %s'%path)
项目:autosub-bootstrapbill    作者:BenjV    | 项目源码 | 文件源码
def _show_branch(root, base, path, pct=0, showpct=False, exclude='',
                 coverage=the_coverage):

    # Show the directory name and any of our children
    dirs = [k for k, v in root.items() if v]
    dirs.sort()
    for name in dirs:
        newpath = os.path.join(path, name)

        if newpath.lower().startswith(base):
            relpath = newpath[len(base):]
            yield '| ' * relpath.count(os.sep)
            yield (
                "<a class='directory' "
                "href='menu?base=%s&exclude=%s'>%s</a>\n" %
                (newpath, quote_plus(exclude), name)
            )

        for chunk in _show_branch(
            root[name], base, newpath, pct, showpct,
            exclude, coverage=coverage
        ):
            yield chunk

    # Now list the files
    if path.lower().startswith(base):
        relpath = path[len(base):]
        files = [k for k, v in root.items() if not v]
        files.sort()
        for name in files:
            newpath = os.path.join(path, name)

            pc_str = ''
            if showpct:
                try:
                    _, statements, _, missing, _ = coverage.analysis2(newpath)
                except:
                    # Yes, we really want to pass on all errors.
                    pass
                else:
                    pc = _percent(statements, missing)
                    pc_str = ('%3d%% ' % pc).replace(' ', '&nbsp;')
                    if pc < float(pct) or pc == -1:
                        pc_str = "<span class='fail'>%s</span>" % pc_str
                    else:
                        pc_str = "<span class='pass'>%s</span>" % pc_str

            yield TEMPLATE_ITEM % ('| ' * (relpath.count(os.sep) + 1),
                                   pc_str, newpath, name)
项目:watcher    作者:nosmokingbandit    | 项目源码 | 文件源码
def _show_branch(root, base, path, pct=0, showpct=False, exclude="",
                 coverage=the_coverage):

    # Show the directory name and any of our children
    dirs = [k for k, v in root.items() if v]
    dirs.sort()
    for name in dirs:
        newpath = os.path.join(path, name)

        if newpath.lower().startswith(base):
            relpath = newpath[len(base):]
            yield "| " * relpath.count(os.sep)
            yield (
                "<a class='directory' "
                "href='menu?base=%s&exclude=%s'>%s</a>\n" %
                (newpath, quote_plus(exclude), name)
            )

        for chunk in _show_branch(
            root[name], base, newpath, pct, showpct,
            exclude, coverage=coverage
        ):
            yield chunk

    # Now list the files
    if path.lower().startswith(base):
        relpath = path[len(base):]
        files = [k for k, v in root.items() if not v]
        files.sort()
        for name in files:
            newpath = os.path.join(path, name)

            pc_str = ""
            if showpct:
                try:
                    _, statements, _, missing, _ = coverage.analysis2(newpath)
                except:
                    # Yes, we really want to pass on all errors.
                    pass
                else:
                    pc = _percent(statements, missing)
                    pc_str = ("%3d%% " % pc).replace(' ', '&nbsp;')
                    if pc < float(pct) or pc == -1:
                        pc_str = "<span class='fail'>%s</span>" % pc_str
                    else:
                        pc_str = "<span class='pass'>%s</span>" % pc_str

            yield TEMPLATE_ITEM % ("| " * (relpath.count(os.sep) + 1),
                                   pc_str, newpath, name)