当前位置: 首页>>代码示例>>Python>>正文


Python IPython.__file__方法代码示例

本文整理汇总了Python中IPython.__file__方法的典型用法代码示例。如果您正苦于以下问题:Python IPython.__file__方法的具体用法?Python IPython.__file__怎么用?Python IPython.__file__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPython的用法示例。


在下文中一共展示了IPython.__file__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: teardown_environment

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def teardown_environment():
    """Restore things that were remembered by the setup_environment function
    """
    (oldenv, os.name, sys.platform, path.get_home_dir, IPython.__file__, old_wd) = oldstuff
    os.chdir(old_wd)
    reload(path)

    for key in env.keys():
        if key not in oldenv:
            del env[key]
    env.update(oldenv)
    if hasattr(sys, 'frozen'):
        del sys.frozen
    if os.name == 'nt':
        (wreg.OpenKey, wreg.QueryValueEx,) = platformstuff

# Build decorator that uses the setup_environment/setup_environment 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:test_path.py

示例2: setup_environment

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def setup_environment():
    """Setup testenvironment for some functions that are tested
    in this module. In particular this functions stores attributes
    and other things that we need to stub in some test functions.
    This needs to be done on a function level and not module level because
    each testfunction needs a pristine environment.
    """
    global oldstuff, platformstuff
    oldstuff = (env.copy(), os.name, sys.platform, path.get_home_dir, IPython.__file__, os.getcwd())

    if os.name == 'nt':
        platformstuff = (wreg.OpenKey, wreg.QueryValueEx,) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_path.py

示例3: test_get_home_dir_1

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def test_get_home_dir_1():
    """Testcase for py2exe logic, un-compressed lib
    """
    unfrozen = path.get_home_dir()
    sys.frozen = True

    #fake filename for IPython.__init__
    IPython.__file__ = abspath(join(HOME_TEST_DIR, "Lib/IPython/__init__.py"))

    home_dir = path.get_home_dir()
    nt.assert_equal(home_dir, unfrozen) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:13,代码来源:test_path.py

示例4: test_get_home_dir_2

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def test_get_home_dir_2():
    """Testcase for py2exe logic, compressed lib
    """
    unfrozen = path.get_home_dir()
    sys.frozen = True
    #fake filename for IPython.__init__
    IPython.__file__ = abspath(join(HOME_TEST_DIR, "Library.zip/IPython/__init__.py")).lower()

    home_dir = path.get_home_dir(True)
    nt.assert_equal(home_dir, unfrozen) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:12,代码来源:test_path.py

示例5: get_ipython_package_dir

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def get_ipython_package_dir():
    """Get the base directory where IPython itself is installed."""
    ipdir = os.path.dirname(IPython.__file__)
    return py3compat.cast_unicode(ipdir, fs_encoding) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:path.py

示例6: write_index

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def write_index():
    """This is to write the docs for the index automatically."""

    here = os.path.dirname(__file__)
    filename = os.path.join(here, '_generated', 'version_text.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    text = text_version if '+' not in oggm.__version__ else text_dev

    with open(filename, 'w') as f:
        f.write(text) 
开发者ID:OGGM,项目名称:oggm,代码行数:17,代码来源:conf.py

示例7: write_gdir_doc

# 需要导入模块: import IPython [as 别名]
# 或者: from IPython import __file__ [as 别名]
def write_gdir_doc():
    """This is to write the docs for glacierdir automatically."""

    here = os.path.dirname(__file__)
    origfile = os.path.join(here, '_templates', 'basenames.txt')
    filename = os.path.join(here, '_generated', 'basenames.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    shutil.copyfile(origfile, filename)

    from oggm.cfg import BASENAMES

    cnt = ['    ']
    for k in sorted(BASENAMES.keys()):
        cnt += [BASENAMES.info_str(k)] + ['    ']
    cnt = '\n'.join(cnt)

    file = open(filename, 'a')
    try:
        file.write(cnt)
    finally:
        file.close() 
开发者ID:OGGM,项目名称:oggm,代码行数:28,代码来源:conf.py


注:本文中的IPython.__file__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。