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

Public Member Functions

def __init__ (self, scheme='default')
 
def get_errors (self)
 
def clear_errors (self)
 
def clear_cache (self)
 
def get_distribution_names (self)
 
def get_project (self, name)
 
def score_url (self, url)
 
def prefer_url (self, url1, url2)
 
def split_filename (self, filename, project_name)
 
def convert_url_to_download_info (self, url, project_name)
 
def locate (self, requirement, prereleases=False)
 

Data Fields

 opener
 
 matcher
 
 errors
 

Static Public Attributes

 source_extensions
 
 binary_extensions
 
 excluded_extensions
 
 wheel_tags
 
 downloadable_extensions
 

Properties

 scheme = property(_get_scheme, _set_scheme)
 

Detailed Description

A base class for locators - things that locate distributions.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  scheme = 'default' 
)
Initialise an instance.
:param scheme: Because locators look for most recent versions, they
       need to know the version scheme to use. This specifies
       the current PEP-recommended scheme - use ``'legacy'``
       if you need to support existing distributions on PyPI.

Member Function Documentation

◆ clear_cache()

def clear_cache (   self)

Reimplemented in AggregatingLocator.

◆ clear_errors()

def clear_errors (   self)
Clear any errors which may have been logged.

◆ convert_url_to_download_info()

def convert_url_to_download_info (   self,
  url,
  project_name 
)
See if a URL is a candidate for a download URL for a project (the URL
has typically been scraped from an HTML page).

If it is, a dictionary is returned with keys "name", "version",
"filename" and "url"; otherwise, None is returned.

◆ get_distribution_names()

def get_distribution_names (   self)
Return all the distribution names known to this locator.

Reimplemented in AggregatingLocator, JSONLocator, DirectoryLocator, SimpleScrapingLocator, PyPIJSONLocator, and PyPIRPCLocator.

◆ get_errors()

def get_errors (   self)
Return any errors which have occurred.

◆ get_project()

def get_project (   self,
  name 
)
For a given project, get a dictionary mapping available versions to Distribution
instances.

This calls _get_project to do all the work, and just implements a caching layer on top.

◆ locate()

def locate (   self,
  requirement,
  prereleases = False 
)
Find the most recent distribution which matches the given
requirement.

:param requirement: A requirement of the form 'foo (1.0)' or perhaps
            'foo (>= 1.0, < 2.0, != 1.3)'
:param prereleases: If ``True``, allow pre-release versions
            to be located. Otherwise, pre-release versions
            are not returned.
:return: A :class:`Distribution` instance, or ``None`` if no such
 distribution could be located.

◆ prefer_url()

def prefer_url (   self,
  url1,
  url2 
)
Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).

The current implementation favours https:// URLs over http://, archives
from PyPI over those from other locations, wheel compatibility (if a
wheel) and then the archive name.

◆ score_url()

def score_url (   self,
  url 
)
Give an url a score which can be used to choose preferred URLs
for a given project release.

◆ split_filename()

def split_filename (   self,
  filename,
  project_name 
)
Attempt to split a filename in project name, version and Python version.

Field Documentation

◆ binary_extensions

binary_extensions
static

◆ downloadable_extensions

downloadable_extensions
static

◆ errors

errors

◆ excluded_extensions

excluded_extensions
static

◆ matcher

matcher

◆ opener

opener

◆ source_extensions

source_extensions
static

◆ wheel_tags

wheel_tags
static

Property Documentation

◆ scheme

scheme = property(_get_scheme, _set_scheme)
static

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