本文整理汇总了Python中file.File.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python File.__init__方法的具体用法?Python File.__init__怎么用?Python File.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file.File
的用法示例。
在下文中一共展示了File.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import __init__ [as 别名]
def open (self, mode = "a", buffering = None):
"""open the file
Args:
mode: file open mode for the first file to be opened. other files will be opened in "w" mode
buffering: same as in the built-in "open" command
Returns:
None
Raises:
IOError: same as in the built-in "open" command
a.infra.lock.multi_process.LockError - when lock is not taken when required (only working in multi processes mode).
"""
self._verifyLockTakenIfNeeded()
self._buffering = buffering
self._rotatingFileSizeEnforcer.prepare()
self._rotatingFileSizeEnforcer.moveCurrentToPending()
newFileName = self._rotatingFileSizeEnforcer.getCurrentFileName()
self._log("open").debug1("first file name '%s'", newFileName)
File.__init__(self, logger = self._log, fileName = newFileName, mode = mode, buffering = buffering)
self._wasOpened = True
示例2: __init__
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import __init__ [as 别名]
def __init__(self, path=""):
File.__init__(self, path)
示例3: __init__
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import __init__ [as 别名]
def __init__(self, filename, filepath):
File.__init__(self, filename, filepath)
self.width, self.height = self.dimensions()
self.entropy = self.entropy()
示例4: __init__
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import __init__ [as 别名]
def __init__(self, name, id, path, type, service=None, last_modified=None):
File.__init__(self, name, id, path, type, last_modified=last_modified)
self.get(service)
if service is not None:
self.get(service)
self.children = self._get_children(service)