OpenQuizz
Une application de gestion des contenus pédagogiques
LazyFile Class Reference
Inheritance diagram for LazyFile:
Collaboration diagram for LazyFile:

Public Member Functions

def __init__ (self, filename, mode="r", encoding=None, errors="strict", atomic=False)
 
def __getattr__ (self, name)
 
def __repr__ (self)
 
def open (self)
 
def close (self)
 
def close_intelligently (self)
 
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, tb)
 
def __iter__ (self)
 

Data Fields

 name
 
 mode
 
 encoding
 
 errors
 
 atomic
 
 should_close
 

Detailed Description

A lazy file works like a regular file but it does not fully open
the file but it does perform some basic checks early to see if the
filename parameter does make sense.  This is useful for safely opening
files for writing.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  filename,
  mode = "r",
  encoding = None,
  errors = "strict",
  atomic = False 
)

Member Function Documentation

◆ __enter__()

def __enter__ (   self)

◆ __exit__()

def __exit__ (   self,
  exc_type,
  exc_value,
  tb 
)

◆ __getattr__()

def __getattr__ (   self,
  name 
)

◆ __iter__()

def __iter__ (   self)

◆ __repr__()

def __repr__ (   self)

◆ close()

def close (   self)
Closes the underlying file, no matter what.

◆ close_intelligently()

def close_intelligently (   self)
This function only closes the file if it was opened by the lazy
file wrapper.  For instance this will never close stdin.

◆ open()

def open (   self)
Opens the file if it's not yet open.  This call might fail with
a :exc:`FileError`.  Not handling this error will produce an error
that Click shows.

Field Documentation

◆ atomic

atomic

◆ encoding

encoding

◆ errors

errors

◆ mode

mode

◆ name

name

◆ should_close

should_close

The documentation for this class was generated from the following file: