當前位置: 首頁>>代碼示例>>Python>>正文


Python path.lower方法代碼示例

本文整理匯總了Python中os.path.lower方法的典型用法代碼示例。如果您正苦於以下問題:Python path.lower方法的具體用法?Python path.lower怎麽用?Python path.lower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在os.path的用法示例。


在下文中一共展示了path.lower方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _CopyOrLink

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
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)) 
開發者ID:GoogleCloudPlatform,項目名稱:python-compat-runtime,代碼行數:27,代碼來源:appcfg_java.py

示例2: open_file

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def open_file(self, path):
        """
        Tries to open a MicroPython hex file with an embedded Python script.

        Returns the embedded Python script and newline convention.
        """
        text = None
        if path.lower().endswith(".hex"):
            # Try to open the hex and extract the Python script
            try:
                with open(path, newline="") as f:
                    text = uflash.extract_script(f.read())
            except Exception:
                return None, None
            return text, sniff_newline_convention(text)
        else:
            return None, None 
開發者ID:mu-editor,項目名稱:mu,代碼行數:19,代碼來源:microbit.py

示例3: index

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def index(self):
        return TEMPLATE_FRAMESET % self.root.lower() 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:4,代碼來源:covercp.py

示例4: menu

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
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, urllib.parse.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>' 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:36,代碼來源:covercp.py

示例5: openFileByType

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def openFileByType(self, mime, path, lineNo=-1):
        """Opens editor/browser suitable for the file type"""
        path = os.path.abspath(path)
        if not os.path.exists(path):
            logging.error("Cannot open %s, does not exist", path)
            return
        if os.path.islink(path):
            path = os.path.realpath(path)
            if not os.path.exists(path):
                logging.error("Cannot open %s, does not exist", path)
                return
            # The type may differ...
            mime, _, _ = getFileProperties(path)
        else:
            # The intermediate directory could be a link, so use the real path
            path = os.path.realpath(path)

        if not os.access(path, os.R_OK):
            logging.error("No read permissions to open %s", path)
            return

        if not os.path.isfile(path):
            logging.error("%s is not a file", path)
            return

        if isImageViewable(mime):
            self.openPixmapFile(path)
            return
        if mime != 'inode/x-empty' and not isFileSearchable(path):
            logging.error("Cannot open non-text file for editing")
            return

        if path.lower().endswith('readme'):
            print(path)
            print(mime)
        self.openFile(path, lineNo) 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:38,代碼來源:mainwindow.py

示例6: _onStyle

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def _onStyle(self, styleName):
        """Sets the selected style"""
        QApplication.setStyle(styleName.data())
        self.settings['style'] = styleName.data().lower() 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:6,代碼來源:mainwindow.py

示例7: menu

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
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>" 
開發者ID:naparuba,項目名稱:opsbro,代碼行數:36,代碼來源:covercp.py

示例8: match_path

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def match_path(path, patterns, abspath=0, case_sensitive=1):
    if case_sensitive:
        match_func = fnmatch.fnmatchcase
        transform = os.path.abspath if abspath else lambda s: s
    else:
        match_func = fnmatch.fnmatch
        path = path.lower()
        transform = (lambda p: os.path.abspath(p.lower())) if abspath else string.lower
    return any(match_func(path, transform(pattern)) for pattern in patterns) 
開發者ID:ebranca,項目名稱:owasp-pysec,代碼行數:11,代碼來源:path.py

示例9: _ShouldSplitJar

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def _ShouldSplitJar(self, path):
    return (path.lower().endswith('.jar') and self.options.do_jar_splitting and
            os.path.getsize(path) >= self._MAX_SIZE) 
開發者ID:GoogleCloudPlatform,項目名稱:python-compat-runtime,代碼行數:5,代碼來源:appcfg_java.py

示例10: username_to_url

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def username_to_url(username):
    return "https://likee.com/@" + username.lower() 
開發者ID:qsniyg,項目名稱:rssit,代碼行數:4,代碼來源:likee.py

示例11: normalize_video_page_url

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def normalize_video_page_url(url):
    return url.replace("/trending/@", "/@").lower() 
開發者ID:qsniyg,項目名稱:rssit,代碼行數:4,代碼來源:likee.py

示例12: on_double_click

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def on_double_click(self, event):
        path = self.get_selected_path()
        kind = self.get_selected_kind()
        parts = path.split(".")
        ext = "." + parts[-1]
        if path.endswith(ext) and kind == "file" and ext.lower() in TEXT_EXTENSIONS:
            self.open_file(path)
        elif kind == "dir":
            self.request_focus_into(path)

        return "break" 
開發者ID:thonny,項目名稱:thonny,代碼行數:13,代碼來源:base_file_browser.py

示例13: _add_to_path

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def _add_to_path(directory, path):
    # Always prepending to path may seem better, but this could mess up other things.
    # If the directory contains only one Python distribution executables, then
    # it probably won't be in path yet and therefore will be prepended.
    if (
        directory in path.split(os.pathsep)
        or platform.system() == "Windows"
        and directory.lower() in path.lower().split(os.pathsep)
    ):
        return path
    else:
        return directory + os.pathsep + path 
開發者ID:thonny,項目名稱:thonny,代碼行數:14,代碼來源:terminal.py

示例14: _get_linux_terminal_command

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def _get_linux_terminal_command():
    import shutil

    xte = shutil.which("x-terminal-emulator")
    if xte:
        if os.path.realpath(xte).endswith("/lxterminal") and shutil.which("lxterminal"):
            # need to know exact program, because it needs special treatment
            return "lxterminal"
        elif os.path.realpath(xte).endswith("/terminator") and shutil.which("terminator"):
            # https://github.com/thonny/thonny/issues/1129
            return "terminator"
        else:
            return "x-terminal-emulator"
    # Older konsole didn't pass on the environment
    elif shutil.which("konsole"):
        if (
            shutil.which("gnome-terminal")
            and "gnome" in os.environ.get("DESKTOP_SESSION", "").lower()
        ):
            return "gnome-terminal"
        else:
            return "konsole"
    elif shutil.which("gnome-terminal"):
        return "gnome-terminal"
    elif shutil.which("xfce4-terminal"):
        return "xfce4-terminal"
    elif shutil.which("lxterminal"):
        return "lxterminal"
    elif shutil.which("xterm"):
        return "xterm"
    else:
        raise RuntimeError("Don't know how to open terminal emulator") 
開發者ID:thonny,項目名稱:thonny,代碼行數:34,代碼來源:terminal.py

示例15: _is_interesting_module_file

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import lower [as 別名]
def _is_interesting_module_file(self, path):
        # interesting files are the files in the same directory as main module
        # or the ones with breakpoints
        # When command is "resume", then only modules with breakpoints are interesting
        # (used to be more flexible, but this caused problems
        # when main script was in ~/. Then user site library became interesting as well)

        result = self._file_interest_cache.get(path, None)
        if result is not None:
            return result

        _, extension = os.path.splitext(path.lower())

        result = (
            self._get_breakpoints_in_file(path)
            or self._main_module_path is not None
            and is_same_path(path, self._main_module_path)
            or extension in (".py", ".pyw")
            and (
                self._current_command.get("allow_stepping_into_libraries", False)
                or (
                    path_startswith(path, os.path.dirname(self._main_module_path))
                    # main module may be at the root of the fs
                    and not path_startswith(path, sys.prefix)
                    and not path_startswith(path, sys.base_prefix)
                    and not path_startswith(path, site.getusersitepackages() or "usersitenotexists")
                )
            )
            and not path_startswith(path, self._thonny_src_dir)
        )

        self._file_interest_cache[path] = result

        return result 
開發者ID:thonny,項目名稱:thonny,代碼行數:36,代碼來源:backend.py


注:本文中的os.path.lower方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。