• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python posixpath.ismount函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中posixpath.ismount函数的典型用法代码示例。如果您正苦于以下问题:Python ismount函数的具体用法?Python ismount怎么用?Python ismount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_ismount_non_existent

 def test_ismount_non_existent(self):
     # Non-existent mountpoint.
     self.assertIs(posixpath.ismount(ABSTFN), False)
     try:
         os.mkdir(ABSTFN)
         self.assertIs(posixpath.ismount(ABSTFN), False)
     finally:
         safe_rmdir(ABSTFN)
开发者ID:chidea,项目名称:GoPythonDLLWrapper,代码行数:8,代码来源:test_posixpath.py


示例2: test_ismount_symlinks

 def test_ismount_symlinks(self):
     # Symlinks are never mountpoints.
     try:
         os.symlink("/", ABSTFN)
         self.assertIs(posixpath.ismount(ABSTFN), False)
     finally:
         os.unlink(ABSTFN)
开发者ID:chidea,项目名称:GoPythonDLLWrapper,代码行数:7,代码来源:test_posixpath.py


示例3: main

def main(args=None):
    '''Umount S3QL file system
    
    This function writes to stdout/stderr and calls `system.exit()` instead
    of returning.
    '''

    if args is None:
        args = sys.argv[1:]

    options = parse_args(args)
    setup_logging(options)
    mountpoint = options.mountpoint
        
    # Check if it's a mount point
    if not posixpath.ismount(mountpoint):
        print('Not a mount point.', file=sys.stderr)
        sys.exit(1)

    # Check if it's an S3QL mountpoint
    ctrlfile = os.path.join(mountpoint, CTRL_NAME)
    if not (CTRL_NAME not in llfuse.listdir(mountpoint)
            and os.path.exists(ctrlfile)):
        print('Not an S3QL file system.', file=sys.stderr)
        sys.exit(1)

    if options.lazy:
        lazy_umount(mountpoint)
    else:
        blocking_umount(mountpoint)
开发者ID:drewlu,项目名称:ossql,代码行数:30,代码来源:umount.py


示例4: assert_s3ql_mountpoint

def assert_s3ql_mountpoint(mountpoint):
    '''Raise QuietError if *mountpoint* is not an S3QL mountpoint
    
    Implicitly calls `assert_s3ql_fs` first. Returns name of the 
    S3QL control file.
    '''

    ctrlfile = assert_s3ql_fs(mountpoint)
    if not posixpath.ismount(mountpoint):
        raise QuietError('%s is not a mount point' % mountpoint)

    return ctrlfile
开发者ID:abc3267454,项目名称:s3ql,代码行数:12,代码来源:common.py


示例5: test_ismount_different_device

 def test_ismount_different_device(self):
     # Simulate the path being on a different device from its parent by
     # mocking out st_dev.
     save_lstat = os.lstat
     def fake_lstat(path):
         st_ino = 0
         st_dev = 0
         if path == ABSTFN:
             st_dev = 1
             st_ino = 1
         return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
     try:
         os.lstat = fake_lstat
         self.assertIs(posixpath.ismount(ABSTFN), True)
     finally:
         os.lstat = save_lstat
开发者ID:chidea,项目名称:GoPythonDLLWrapper,代码行数:16,代码来源:test_posixpath.py


示例6: test_ismount_different_device

 def test_ismount_different_device(self) -> None:
     # Simulate the path being on a different device from its parent by
     # mocking out st_dev.
     save_lstat = os.lstat
     def fake_lstat(path):
         st_ino = 0
         st_dev = 0
         if path == ABSTFN:
             st_dev = 1
             st_ino = 1
         return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
     try:
         setattr(os, 'lstat', fake_lstat) # mypy: can't modify os directly
         self.assertIs(posixpath.ismount(ABSTFN), True)
     finally:
         setattr(os, 'lstat', save_lstat)
开发者ID:kivipe,项目名称:mypy,代码行数:16,代码来源:test_posixpath.py


示例7: test_ismount_different_device

 def test_ismount_different_device(self):
     raise NotImplementedError() # cannot modify os.lstat currently
     # Simulate the path being on a different device from its parent by
     # mocking out st_dev.
     save_lstat = os.lstat
     def fake_lstat(path):
         st_ino = 0
         st_dev = 0
         if path == ABSTFN:
             st_dev = 1
             st_ino = 1
         return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
     try:
         #os.lstat = fake_lstat
         self.assertIs(posixpath.ismount(ABSTFN), True)
     finally:
         pass
开发者ID:Varriount,项目名称:mypy,代码行数:17,代码来源:test_posixpath.py


示例8: main

def main(args=None):
    '''Print file system statistics to sys.stdout'''

    if args is None:
        args = sys.argv[1:]

    options = parse_args(args)
    setup_logging(options)
    mountpoint = options.mountpoint

    # Check if it's a mount point
    if not posixpath.ismount(mountpoint):
        raise QuietError('%s is not a mount point' % mountpoint)

    # Check if it's an S3QL mountpoint
    ctrlfile = os.path.join(mountpoint, CTRL_NAME)
    if not (CTRL_NAME not in llfuse.listdir(mountpoint)
            and os.path.exists(ctrlfile)):
        raise QuietError('%s is not a mount point' % mountpoint)

    if os.stat(ctrlfile).st_uid != os.geteuid() and os.geteuid() != 0:
        raise QuietError('Only root and the mounting user may run s3qlstat.')

    # Use a decent sized buffer, otherwise the statistics have to be
    # calculated thee(!) times because we need to invoce getxattr
    # three times.
    buf = llfuse.getxattr(ctrlfile, b's3qlstat', size_guess=256)

    (entries, blocks, inodes, fs_size, dedup_size,
     compr_size, db_size) = struct.unpack('QQQQQQQ', buf)
    p_dedup = dedup_size * 100 / fs_size if fs_size else 0
    p_compr_1 = compr_size * 100 / fs_size if fs_size else 0
    p_compr_2 = compr_size * 100 / dedup_size if dedup_size else 0
    mb = 1024 ** 2
    print ('Directory entries:    %d' % entries,
           'Inodes:               %d' % inodes,
           'Data blocks:          %d' % blocks,
           'Total data size:      %.2f MiB' % (fs_size / mb),
           'After de-duplication: %.2f MiB (%.2f%% of total)'
             % (dedup_size / mb, p_dedup),
           'After compression:    %.2f MiB (%.2f%% of total, %.2f%% of de-duplicated)'
             % (compr_size / mb, p_compr_1, p_compr_2),
           'Database size:        %.2f MiB (uncompressed)' % (db_size / mb),
           '(some values do not take into account not-yet-uploaded dirty blocks in cache)',
           sep='\n')
开发者ID:thefirstwind,项目名称:s3qloss,代码行数:45,代码来源:statfs.py


示例9: check_mount

def check_mount(mountpoint):
    '''Check that "mountpoint" is a mountpoint and a valid s3ql fs'''
    
    try:
        os.stat(mountpoint)
    except OSError as exc:
        if exc.errno is errno.ENOTCONN:
            raise FSCrashedError(mountpoint)
        raise
        
    if not posixpath.ismount(mountpoint):
        raise NotMountPointError(mountpoint)

    ctrlfile = os.path.join(mountpoint, CTRL_NAME)
    if not (
        CTRL_NAME not in llfuse.listdir(mountpoint) and
        os.path.exists(ctrlfile)
    ):
        raise NotS3qlFsError(mountpoint)
开发者ID:thefirstwind,项目名称:s3qloss,代码行数:19,代码来源:umount.py


示例10: test_ismount_directory_not_readable

 def test_ismount_directory_not_readable(self):
     # issue #2466: Simulate ismount run on a directory that is not
     # readable, which used to return False.
     save_lstat = os.lstat
     def fake_lstat(path):
         st_ino = 0
         st_dev = 0
         if path.startswith(ABSTFN) and path != ABSTFN:
             # ismount tries to read something inside the ABSTFN directory;
             # simulate this being forbidden (no read permission).
             raise OSError("Fake [Errno 13] Permission denied")
         if path == ABSTFN:
             st_dev = 1
             st_ino = 1
         return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
     try:
         os.lstat = fake_lstat
         self.assertIs(posixpath.ismount(ABSTFN), True)
     finally:
         os.lstat = save_lstat
开发者ID:1st1,项目名称:cpython,代码行数:20,代码来源:test_posixpath.py


示例11: test_ismount

 def test_ismount(self):
     self.assertIs(posixpath.ismount("/"), True)
开发者ID:Logotrop,项目名称:trida,代码行数:2,代码来源:test_posixpath.py


示例12: test_ismount

 def test_ismount(self):
     self.assertIs(posixpath.ismount("/"), True)
     with warnings.catch_warnings():
         warnings.simplefilter("ignore", DeprecationWarning)
         self.assertIs(posixpath.ismount(b"/"), True)
开发者ID:chidea,项目名称:GoPythonDLLWrapper,代码行数:5,代码来源:test_posixpath.py


示例13: test_ismount

    def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)

        self.assertRaises(TypeError, posixpath.ismount)
开发者ID:CaoYouXin,项目名称:myfirstapicloudapp,代码行数:4,代码来源:test_posixpath.py


示例14: __len__

 def __len__(self):
     return ismount(self.local_path) and len(os.listdir(self.local_path)) != 0
开发者ID:immstudios,项目名称:firefly,代码行数:2,代码来源:common.py


示例15: test_ismount

 def test_ismount(self) -> None:
     self.assertIs(posixpath.ismount("/"), True)
     self.assertIs(posixpath.ismount(b"/"), True)
开发者ID:kivipe,项目名称:mypy,代码行数:3,代码来源:test_posixpath.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python posixpath.join函数代码示例发布时间:2022-05-25
下一篇:
Python posixpath.islink函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap