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

Public Member Functions

def __init__ (self, exists=False, file_okay=True, dir_okay=True, writable=False, readable=True, resolve_path=False, allow_dash=False, path_type=None)
 
def coerce_path_result (self, rv)
 
def convert (self, value, param, ctx)
 
- Public Member Functions inherited from ParamType
def __call__ (self, value, param=None, ctx=None)
 
def get_metavar (self, param)
 
def get_missing_message (self, param)
 
def split_envvar_value (self, rv)
 
def fail (self, message, param=None, ctx=None)
 

Data Fields

 exists
 
 file_okay
 
 dir_okay
 
 writable
 
 readable
 
 resolve_path
 
 allow_dash
 
 type
 
 name
 
 path_type
 

Static Public Attributes

 envvar_list_splitter = os.path.pathsep
 
- Static Public Attributes inherited from ParamType
bool is_composite = False
 
 name = None
 
 envvar_list_splitter = None
 

Detailed Description

The path type is similar to the :class:`File` type but it performs
different checks.  First of all, instead of returning an open file
handle it returns just the filename.  Secondly, it can perform various
basic checks about what the file or directory should be.

.. versionchanged:: 6.0
   `allow_dash` was added.

:param exists: if set to true, the file or directory needs to exist for
               this value to be valid.  If this is not required and a
               file does indeed not exist, then all further checks are
               silently skipped.
:param file_okay: controls if a file is a possible value.
:param dir_okay: controls if a directory is a possible value.
:param writable: if true, a writable check is performed.
:param readable: if true, a readable check is performed.
:param resolve_path: if this is true, then the path is fully resolved
                     before the value is passed onwards.  This means
                     that it's absolute and symlinks are resolved.  It
                     will not expand a tilde-prefix, as this is
                     supposed to be done by the shell only.
:param allow_dash: If this is set to `True`, a single dash to indicate
                   standard streams is permitted.
:param path_type: optionally a string type that should be used to
                  represent the path.  The default is `None` which
                  means the return value will be either bytes or
                  unicode depending on what makes most sense given the
                  input data Click deals with.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  exists = False,
  file_okay = True,
  dir_okay = True,
  writable = False,
  readable = True,
  resolve_path = False,
  allow_dash = False,
  path_type = None 
)

Member Function Documentation

◆ coerce_path_result()

def coerce_path_result (   self,
  rv 
)

◆ convert()

def convert (   self,
  value,
  param,
  ctx 
)
Converts the value.  This is not invoked for values that are
`None` (the missing value).

Reimplemented from ParamType.

Reimplemented in SeparatedPathType.

Field Documentation

◆ allow_dash

allow_dash

◆ dir_okay

dir_okay

◆ envvar_list_splitter

envvar_list_splitter = os.path.pathsep
static

◆ exists

exists

◆ file_okay

file_okay

◆ name

name

◆ path_type

path_type

◆ readable

readable

◆ resolve_path

resolve_path

◆ type

type

◆ writable

writable

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