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

Public Member Functions

def __init__ (self, index_url="https://pypi.org/simple/", hosts=(' *',), ca_bundle=None, verify_ssl=True, *args, **kw)
 
def process_url (self, url, retrieve=False)
 
def process_filename (self, fn, nested=False)
 
def url_ok (self, url, fatal=False)
 
def scan_egg_links (self, search_path)
 
def scan_egg_link (self, path, entry)
 
def process_index (self, url, page)
 
def need_version_info (self, url)
 
def scan_all (self, msg=None, *args)
 
def find_packages (self, requirement)
 
def obtain (self, requirement, installer=None)
 
def check_hash (self, checker, filename, tfp)
 
def add_find_links (self, urls)
 
def prescan (self)
 
def not_found_in_index (self, requirement)
 
def download (self, spec, tmpdir)
 
def fetch_distribution (self, requirement, tmpdir, force_scan=False, source=False, develop_ok=False, local_index=None)
 
def fetch (self, requirement, tmpdir, force_scan=False, source=False)
 
def gen_setup (self, filename, fragment, tmpdir)
 
def reporthook (self, url, filename, blocknum, blksize, size)
 
def open_url (self, url, warning=None)
 
def scan_url (self, url)
 
def debug (self, msg, *args)
 
def info (self, msg, *args)
 
def warn (self, msg, *args)
 
- Public Member Functions inherited from Environment
def __init__ (self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR)
 
def can_add (self, dist)
 
def remove (self, dist)
 
def scan (self, search_path=None)
 
def __getitem__ (self, project_name)
 
def add (self, dist)
 
def best_match (self, req, working_set, installer=None, replace_conflicting=False)
 
def __iter__ (self)
 
def __iadd__ (self, other)
 
def __add__ (self, other)
 

Data Fields

 index_url
 
 scanned_urls
 
 fetched_urls
 
 package_pages
 
 allows
 
 to_scan
 
 opener
 
- Data Fields inherited from Environment
 platform
 
 python
 

Static Public Attributes

 dl_blocksize
 

Detailed Description

A distribution index that scans web pages for download URLs

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  index_url = "https://pypi.org/simple/",
  hosts = ('*',),
  ca_bundle = None,
  verify_ssl = True,
args,
**  kw 
)

Member Function Documentation

◆ add_find_links()

def add_find_links (   self,
  urls 
)
Add `urls` to the list that will be prescanned for searches

◆ check_hash()

def check_hash (   self,
  checker,
  filename,
  tfp 
)
checker is a ContentChecker

◆ debug()

def debug (   self,
  msg,
args 
)

◆ download()

def download (   self,
  spec,
  tmpdir 
)
Locate and/or download `spec` to `tmpdir`, returning a local path

`spec` may be a ``Requirement`` object, or a string containing a URL,
an existing local filename, or a project/version requirement spec
(i.e. the string form of a ``Requirement`` object).  If it is the URL
of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one
that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is
automatically created alongside the downloaded file.

If `spec` is a ``Requirement`` object or a string containing a
project/version requirement spec, this method returns the location of
a matching distribution (possibly after downloading it to `tmpdir`).
If `spec` is a locally existing file or directory name, it is simply
returned unchanged.  If `spec` is a URL, it is downloaded to a subpath
of `tmpdir`, and the local filename is returned.  Various errors may be
raised if a problem occurs during downloading.

◆ fetch()

def fetch (   self,
  requirement,
  tmpdir,
  force_scan = False,
  source = False 
)
Obtain a file suitable for fulfilling `requirement`

DEPRECATED; use the ``fetch_distribution()`` method now instead.  For
backward compatibility, this routine is identical but returns the
``location`` of the downloaded distribution instead of a distribution
object.

◆ fetch_distribution()

def fetch_distribution (   self,
  requirement,
  tmpdir,
  force_scan = False,
  source = False,
  develop_ok = False,
  local_index = None 
)
Obtain a distribution suitable for fulfilling `requirement`

`requirement` must be a ``pkg_resources.Requirement`` instance.
If necessary, or if the `force_scan` flag is set, the requirement is
searched for in the (online) package index as well as the locally
installed packages.  If a distribution matching `requirement` is found,
the returned distribution's ``location`` is the value you would have
gotten from calling the ``download()`` method with the matching
distribution's URL or filename.  If no matching distribution is found,
``None`` is returned.

If the `source` flag is set, only source distributions and source
checkout links will be considered.  Unless the `develop_ok` flag is
set, development and system eggs (i.e., those using the ``.egg-info``
format) will be ignored.

◆ find_packages()

def find_packages (   self,
  requirement 
)

◆ gen_setup()

def gen_setup (   self,
  filename,
  fragment,
  tmpdir 
)

◆ info()

def info (   self,
  msg,
args 
)

◆ need_version_info()

def need_version_info (   self,
  url 
)

◆ not_found_in_index()

def not_found_in_index (   self,
  requirement 
)

◆ obtain()

def obtain (   self,
  requirement,
  installer = None 
)
Obtain a distribution matching `requirement` (e.g. via download)

Obtain a distro that matches requirement (e.g. via download).  In the
base ``Environment`` class, this routine just returns
``installer(requirement)``, unless `installer` is None, in which case
None is returned instead.  This method is a hook that allows subclasses
to attempt other ways of obtaining a distribution before falling back
to the `installer` argument.

Reimplemented from Environment.

◆ open_url()

def open_url (   self,
  url,
  warning = None 
)

◆ prescan()

def prescan (   self)
Scan urls scheduled for prescanning (e.g. --find-links)

◆ process_filename()

def process_filename (   self,
  fn,
  nested = False 
)

◆ process_index()

def process_index (   self,
  url,
  page 
)
Process the contents of a PyPI page

◆ process_url()

def process_url (   self,
  url,
  retrieve = False 
)
Evaluate a URL as a possible download, and maybe retrieve it

◆ reporthook()

def reporthook (   self,
  url,
  filename,
  blocknum,
  blksize,
  size 
)

◆ scan_all()

def scan_all (   self,
  msg = None,
args 
)

◆ scan_egg_link()

def scan_egg_link (   self,
  path,
  entry 
)

◆ scan_egg_links()

def scan_egg_links (   self,
  search_path 
)

◆ scan_url()

def scan_url (   self,
  url 
)

◆ url_ok()

def url_ok (   self,
  url,
  fatal = False 
)

◆ warn()

def warn (   self,
  msg,
args 
)

Field Documentation

◆ allows

allows

◆ dl_blocksize

dl_blocksize
static

◆ fetched_urls

fetched_urls

◆ index_url

index_url

◆ opener

opener

◆ package_pages

package_pages

◆ scanned_urls

scanned_urls

◆ to_scan

to_scan

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