当前位置: 首页>>代码示例>>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;未经允许,请勿转载。