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


Python Conf.set方法代码示例

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


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

示例1: set_auth_cache_filepath

# 需要导入模块: from gdrivefs.conf import Conf [as 别名]
# 或者: from gdrivefs.conf.Conf import set [as 别名]
def set_auth_cache_filepath(auth_storage_filepath):
    Conf.set('auth_cache_filepath', auth_storage_filepath)
开发者ID:HostSuki,项目名称:GDriveFS,代码行数:4,代码来源:gdfuse.py

示例2: mount

# 需要导入模块: from gdrivefs.conf import Conf [as 别名]
# 或者: from gdrivefs.conf.Conf import set [as 别名]
def mount(auth_storage_filepath, mountpoint, debug=None, nothreads=None, 
          option_string=None):

    fuse_opts = { }
    if option_string:
        for opt_parts in [opt.split('=', 1) \
                          for opt \
                          in option_string.split(',') ]:
            k = opt_parts[0]

            # We need to present a bool type for on/off flags. Since all we
            # have are strings, we'll convert anything with a 'True' or 'False'
            # to a bool, or anything with just a key to True.
            if len(opt_parts) == 2:
                v = opt_parts[1]
                v_lower = v.lower()

                if v_lower == 'true':
                    v = True
                elif v_lower == 'false':
                    v = False
            else:
                v = True

            # We have a list of provided options. See which match against our 
            # application options.

            logging.info("Setting option [%s] to [%s]." % (k, v))

            try:
                Conf.set(k, v)
            except (KeyError) as e:
                logging.debug("Forwarding option [%s] with value [%s] to "
                              "FUSE." % (k, v))

                fuse_opts[k] = v
            except:
                logging.exception("Could not set option [%s]. It is probably "
                                  "invalid." % (k))
                raise

    logging.debug("PERMS: F=%s E=%s NE=%s" % 
                  (Conf.get('default_perm_folder'), 
                   Conf.get('default_perm_file_editable'), 
                   Conf.get('default_perm_file_noneditable')))

    # Assume that any option that wasn't an application option is a FUSE 
    # option. The Python-FUSE interface that we're using is beautiful/elegant,
    # but there's no help support. The user is just going to have to know the
    # options.

    set_auth_cache_filepath(auth_storage_filepath)

    # How we'll appear in diskfree, mtab, etc..
    name = ("gdfs(%s)" % (auth_storage_filepath))

    # Don't start any of the scheduled tasks, such as change checking, cache
    # cleaning, etc. It will minimize outside influence of the logs and state
    # to make it easier to debug.

#    atexit.register(Timers.get_instance().cancel_all)
    if debug:
        Timers.get_instance().set_autostart_default(False)

    fuse = FUSE(GDriveFS(), mountpoint, debug=debug, foreground=debug, 
                nothreads=nothreads, fsname=name, **fuse_opts)
开发者ID:HostSuki,项目名称:GDriveFS,代码行数:68,代码来源:gdfuse.py

示例3: get_phrase

# 需要导入模块: from gdrivefs.conf import Conf [as 别名]
# 或者: from gdrivefs.conf.Conf import set [as 别名]
#!/usr/bin/env python2.7

import sys
sys.path.insert(0, '..')

import datetime
import time
import dateutil.tz

from gdrivefs.conf import Conf
Conf.set('auth_cache_filepath', '/var/cache/creds/gdfs')

import gdrivefs.gdfs.gdfuse
import gdrivefs.gdtool.drive
import gdrivefs.time_support

auth = gdrivefs.gdtool.drive.GdriveAuth()
client = auth.get_client()

def get_phrase(epoch):
    dt = datetime.datetime.utcfromtimestamp(entry.modified_date_epoch)
    return datetime.datetime.strftime(dt, gdrivefs.time_support.DTF_DATETIMET)

print("Before:\n")

(entry, path, filename) = gdrivefs.gdfs.gdfuse.get_entry_or_raise(
                            '/20140426-171136')

print(entry.modified_date)
print(entry.modified_date.utctimetuple())
print(entry.modified_date_epoch)
开发者ID:GoodGuysFree,项目名称:GDriveFS,代码行数:33,代码来源:test_times.py

示例4: set_auth_cache_filepath

# 需要导入模块: from gdrivefs.conf import Conf [as 别名]
# 或者: from gdrivefs.conf.Conf import set [as 别名]
def set_auth_cache_filepath(auth_storage_filepath):
    auth_storage_filepath = os.path.abspath(auth_storage_filepath)

    Conf.set('auth_cache_filepath', auth_storage_filepath)
开发者ID:dsoprea,项目名称:GDriveFS,代码行数:6,代码来源:gdfuse.py

示例5: mount

# 需要导入模块: from gdrivefs.conf import Conf [as 别名]
# 或者: from gdrivefs.conf.Conf import set [as 别名]
def mount(auth_storage_filepath, mountpoint, debug=None, nothreads=None, 
          option_string=None):

    if os.path.exists(auth_storage_filepath) is False:
        raise ValueError("Credential path is not valid: [%s]" %
                         (auth_storage_filepath,))

    # If we don't check this here, it'll just cause a headache when things fail
    # during the communication.
    oauth2_version = tuple([int(c) for c in oauth2client.__version__.split('.')])
    if oauth2_version >= (4, 0, 0):
        raise Exception("Google does not like oauth2client >=4.0.0 .")

    fuse_opts = {}
    
    if option_string:
        for opt_parts in [opt.split('=', 1) \
                          for opt \
                          in option_string.split(',') ]:
            k = opt_parts[0]

            # We need to present a bool type for on/off flags. Since all we
            # have are strings, we'll convert anything with a 'True' or 'False'
            # to a bool, or anything with just a key to True.
            if len(opt_parts) == 2:
                v = opt_parts[1]
                v_lower = v.lower()

                if v_lower == 'true':
                    v = True
                elif v_lower == 'false':
                    v = False
            else:
                v = True

            # We have a list of provided options. See which match against our 
            # application options.

            _logger.debug("Setting option [%s] to [%s].", k, v)

            try:
                Conf.set(k, v)
            except KeyError as e:
                _logger.debug("Forwarding option [%s] with value [%s] to "
                              "FUSE.", k, v)

                fuse_opts[k] = v

    if gdrivefs.config.IS_DEBUG is True:
        _logger.debug("FUSE options:\n%s", pprint.pformat(fuse_opts))

    _logger.debug("PERMS: F=%s E=%s NE=%s",
                  Conf.get('default_perm_folder'), 
                  Conf.get('default_perm_file_editable'), 
                  Conf.get('default_perm_file_noneditable'))

    # Assume that any option that wasn't an application option is a FUSE 
    # option. The Python-FUSE interface that we're using is beautiful/elegant,
    # but there's no help support. The user is just going to have to know the
    # options.

    set_auth_cache_filepath(auth_storage_filepath)

    # How we'll appear in diskfree, mtab, etc..
    name = "gdfs(%s)".format(auth_storage_filepath)

    # Make sure we can connect.
    gdrivefs.account_info.AccountInfo().get_data()
    gdfs = GDriveFS()

    fuse = FUSE(
            gdfs,
            mountpoint, 
            debug=debug, 
            foreground=debug, 
            nothreads=nothreads, 
            fsname=name, 
            **fuse_opts)
开发者ID:dsoprea,项目名称:GDriveFS,代码行数:80,代码来源:gdfuse.py

示例6: mount

# 需要导入模块: from gdrivefs.conf import Conf [as 别名]
# 或者: from gdrivefs.conf.Conf import set [as 别名]
def mount(auth_storage_filepath, mountpoint, debug=None, nothreads=None, option_string=None):

    if os.path.exists(auth_storage_filepath) is False:
        raise ValueError("Credential path is not valid: [%s]" % (auth_storage_filepath,))

    fuse_opts = {}

    if option_string:
        for opt_parts in [opt.split("=", 1) for opt in option_string.split(",")]:
            k = opt_parts[0]

            # We need to present a bool type for on/off flags. Since all we
            # have are strings, we'll convert anything with a 'True' or 'False'
            # to a bool, or anything with just a key to True.
            if len(opt_parts) == 2:
                v = opt_parts[1]
                v_lower = v.lower()

                if v_lower == "true":
                    v = True
                elif v_lower == "false":
                    v = False
            else:
                v = True

            # We have a list of provided options. See which match against our
            # application options.

            _logger.debug("Setting option [%s] to [%s].", k, v)

            try:
                Conf.set(k, v)
            except (KeyError) as e:
                _logger.debug("Forwarding option [%s] with value [%s] to " "FUSE.", k, v)

                fuse_opts[k] = v
            except:
                _logger.exception("Could not set option [%s]. It is probably " "invalid.", k)
                raise

    if gdrivefs.config.IS_DEBUG is True:
        _logger.debug("FUSE options:\n%s", pprint.pformat(fuse_opts))

    _logger.debug(
        "PERMS: F=%s E=%s NE=%s",
        Conf.get("default_perm_folder"),
        Conf.get("default_perm_file_editable"),
        Conf.get("default_perm_file_noneditable"),
    )

    # Assume that any option that wasn't an application option is a FUSE
    # option. The Python-FUSE interface that we're using is beautiful/elegant,
    # but there's no help support. The user is just going to have to know the
    # options.

    set_auth_cache_filepath(auth_storage_filepath)

    # How we'll appear in diskfree, mtab, etc..
    name = "gdfs(%s)" % (auth_storage_filepath,)

    # Make sure we can connect.
    gdrivefs.gdtool.account_info.AccountInfo().get_data()

    fuse = FUSE(GDriveFS(), mountpoint, debug=debug, foreground=debug, nothreads=nothreads, fsname=name, **fuse_opts)
开发者ID:bsavelev,项目名称:GDriveFS,代码行数:66,代码来源:gdfuse.py


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