當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。