Skip to content

Commit

Permalink
Refactor import logic
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Jun 14, 2018
1 parent f0041f0 commit 1bb23a9
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions conda/common/os/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,15 @@

from logging import getLogger

from ..os.linux import linux_get_libc_version
from ..os.unix import get_free_space_on_unix, is_admin_on_unix
from ..os.windows import get_free_space_on_windows, is_admin_on_windows
from ..compat import on_win


log = getLogger(__name__)


linux_get_libc_version

if on_win:
from .windows import get_free_space_on_windows as get_free_space
from .windows import is_admin_on_windows as is_admin
else:
from .unix import get_free_space_on_unix as get_free_space # noqa
from .unix import is_admin_on_unix as is_admin # noqa

def is_admin():
func = is_admin_on_windows if on_win else is_admin_on_unix
return func()


def get_free_space(dir_name):
"""Return folder/drive free space (in bytes).
:param dir_name: the dir name need to check
:return: amount of free space
Examples:
>>> import os
>>> get_free_space(os.getcwd()) > 0
True
"""
func = get_free_space_on_windows if on_win else get_free_space_on_unix
return func(dir_name)
log = getLogger(__name__)

0 comments on commit 1bb23a9

Please sign in to comment.