OpenQuizz
Une application de gestion des contenus pédagogiques
PackageFinder Class Reference

Public Member Functions

def __init__ (self, link_collector, target_python, allow_yanked, format_control=None, candidate_prefs=None, ignore_requires_python=None)
 
def create (cls, link_collector, selection_prefs, target_python=None)
 
def target_python (self)
 
def search_scope (self)
 
def search_scope (self, search_scope)
 
def find_links (self)
 
def index_urls (self)
 
def trusted_hosts (self)
 
def allow_all_prereleases (self)
 
def set_allow_all_prereleases (self)
 
def prefer_binary (self)
 
def set_prefer_binary (self)
 
def make_link_evaluator (self, project_name)
 
def get_install_candidate (self, link_evaluator, link)
 
def evaluate_links (self, link_evaluator, links)
 
def process_project_url (self, project_url, link_evaluator)
 
def find_all_candidates (self, project_name)
 
def make_candidate_evaluator (self, project_name, specifier=None, hashes=None)
 
def find_best_candidate (self, project_name, specifier=None, hashes=None)
 
def find_requirement (self, req, upgrade)
 

Data Fields

 format_control
 

Static Public Attributes

 maxsize
 

Detailed Description

This finds packages.

This is meant to match easy_install's technique for looking for
packages, by reading pages and looking for appropriate links.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  link_collector,
  target_python,
  allow_yanked,
  format_control = None,
  candidate_prefs = None,
  ignore_requires_python = None 
)
This constructor is primarily meant to be used by the create() class
method and from tests.

:param format_control: A FormatControl object, used to control
    the selection of source packages / binary packages when consulting
    the index and links.
:param candidate_prefs: Options to use when creating a
    CandidateEvaluator object.

Member Function Documentation

◆ allow_all_prereleases()

def allow_all_prereleases (   self)

◆ create()

def create (   cls,
  link_collector,
  selection_prefs,
  target_python = None 
)
Create a PackageFinder.

:param selection_prefs: The candidate selection preferences, as a
    SelectionPreferences object.
:param target_python: The target Python interpreter to use when
    checking compatibility. If None (the default), a TargetPython
    object will be constructed from the running Python.

◆ evaluate_links()

def evaluate_links (   self,
  link_evaluator,
  links 
)
Convert links that are candidates to InstallationCandidate objects.

◆ find_all_candidates()

def find_all_candidates (   self,
  project_name 
)
Find all available InstallationCandidate for project_name

This checks index_urls and find_links.
All versions found are returned as an InstallationCandidate list.

See LinkEvaluator.evaluate_link() for details on which files
are accepted.

◆ find_best_candidate()

def find_best_candidate (   self,
  project_name,
  specifier = None,
  hashes = None 
)
Find matches for the given project and specifier.

:param specifier: An optional object implementing `filter`
    (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable
    versions.

:return: A `BestCandidateResult` instance.

◆ find_links()

def find_links (   self)

◆ find_requirement()

def find_requirement (   self,
  req,
  upgrade 
)
Try to find a Link matching req

Expects req, an InstallRequirement and upgrade, a boolean
Returns a InstallationCandidate if found,
Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise

◆ get_install_candidate()

def get_install_candidate (   self,
  link_evaluator,
  link 
)
If the link is a candidate for install, convert it to an
InstallationCandidate and return it. Otherwise, return None.

◆ index_urls()

def index_urls (   self)

◆ make_candidate_evaluator()

def make_candidate_evaluator (   self,
  project_name,
  specifier = None,
  hashes = None 
)
Create a CandidateEvaluator object to use.

◆ make_link_evaluator()

def make_link_evaluator (   self,
  project_name 
)

◆ prefer_binary()

def prefer_binary (   self)

◆ process_project_url()

def process_project_url (   self,
  project_url,
  link_evaluator 
)

◆ search_scope() [1/2]

def search_scope (   self)

◆ search_scope() [2/2]

def search_scope (   self,
  search_scope 
)

◆ set_allow_all_prereleases()

def set_allow_all_prereleases (   self)

◆ set_prefer_binary()

def set_prefer_binary (   self)

◆ target_python()

def target_python (   self)

◆ trusted_hosts()

def trusted_hosts (   self)

Field Documentation

◆ format_control

format_control

◆ maxsize

maxsize
static

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