__init__.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
def GetConfigFileContents( url ):
    fc=None
    scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
    if scheme == "file":
        try:
            f = open(path,'r')
            fc=""
            for line in f:
                fc += line
            f.close()
        except:
            fc=None
    elif scheme == "sca":
        fc=GetSCAFileContents(url)

    elif scheme == "http":
        fc=GetHTTPFileContents(url)

    elif scheme == "str":
        ## RESOLVE
        if path.startswith("/"):
          fc=path[1:]
        else:
           fc=path
        pass
    else:
        # Invalid scheme
        logging.warning("Invalid logging config URI scheme")

    return fc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号