Did I find the right examples for you? yes no

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)
Get __init__ file path for module directory

Parameters
----------
dirname : str
    Find the __init__ file in directory `dirname`

Returns
-------
init_path : str(more...)

        def get_init(dirname):
    """Get __init__ file path for module directory
    
    Parameters
    ----------
    dirname : str
        Find the __init__ file in directory `dirname`

    Returns
    -------
    init_path : str
        Path to __init__ file
    """
    fbase =  os.path.join(dirname, "__init__")
    for ext in [".py", ".pyw"]:
        fname = fbase + ext
        if os.path.isfile(fname):
            return fname
        


src/a/n/antisocial-HEAD/ve/lib/python2.7/site-packages/IPython/utils/tests/test_module_paths.py   antisocial(Download)
def test_get_init_1():
    """See if get_init can find __init__.py in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.py")):
        assert mp.get_init(TMP_TEST_DIR)
 
def test_get_init_2():
    """See if get_init can find __init__.pyw in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.pyw")):
        assert mp.get_init(TMP_TEST_DIR)
def test_get_init_3():
    """get_init can't find __init__.pyc in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.pyc")):
        assert mp.get_init(TMP_TEST_DIR) is None
 
def test_get_init_3():
    """get_init can't find __init__ in empty testdir"""
    assert mp.get_init(TMP_TEST_DIR) is None

src/i/p/ipython-2.0.0/IPython/utils/tests/test_module_paths.py   ipython(Download)
def test_get_init_1():
    """See if get_init can find __init__.py in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.py")):
        assert mp.get_init(TMP_TEST_DIR)
 
def test_get_init_2():
    """See if get_init can find __init__.pyw in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.pyw")):
        assert mp.get_init(TMP_TEST_DIR)
def test_get_init_3():
    """get_init can't find __init__.pyc in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.pyc")):
        assert mp.get_init(TMP_TEST_DIR) is None
 
def test_get_init_4():
    """get_init can't find __init__ in empty testdir"""
    assert mp.get_init(TMP_TEST_DIR) is None

src/i/p/ipython-HEAD/IPython/utils/tests/test_module_paths.py   ipython(Download)
def test_get_init_1():
    """See if get_init can find __init__.py in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.py")):
        assert mp.get_init(TMP_TEST_DIR)
 
def test_get_init_2():
    """See if get_init can find __init__.pyw in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.pyw")):
        assert mp.get_init(TMP_TEST_DIR)
def test_get_init_3():
    """get_init can't find __init__.pyc in this testdir"""
    with make_tempfile(join(TMP_TEST_DIR, "__init__.pyc")):
        assert mp.get_init(TMP_TEST_DIR) is None
 
def test_get_init_4():
    """get_init can't find __init__ in empty testdir"""
    assert mp.get_init(TMP_TEST_DIR) is None