|
Let us walk on the 3-isogeny graph
|
Data Structures | |
| class | OptionParsingError |
| class | ParsedLine |
| class | ParsedRequirement |
| class | RequirementsFileParser |
Functions | |
| Generator[ParsedRequirement, None, None] | parse_requirements (str filename, PipSession session, Optional["PackageFinder"] finder=None, Optional[optparse.Values] options=None, bool constraint=False) |
| ReqFileLines | preprocess (str content) |
| ParsedRequirement | handle_requirement_line (ParsedLine line, Optional[optparse.Values] options=None) |
| None | handle_option_line (Values opts, str filename, int lineno, Optional["PackageFinder"] finder=None, Optional[optparse.Values] options=None, Optional[PipSession] session=None) |
| Optional[ParsedRequirement] | handle_line (ParsedLine line, Optional[optparse.Values] options=None, Optional["PackageFinder"] finder=None, Optional[PipSession] session=None) |
| LineParser | get_line_parser (Optional["PackageFinder"] finder) |
| Tuple[str, str] | break_args_options (str line) |
| optparse.OptionParser | build_parser () |
| ReqFileLines | join_lines (ReqFileLines lines_enum) |
| ReqFileLines | ignore_comments (ReqFileLines lines_enum) |
| ReqFileLines | expand_env_variables (ReqFileLines lines_enum) |
| Tuple[str, str] | get_file_content (str url, PipSession session) |
Variables | |
| ReqFileLines = Iterable[Tuple[int, str]] | |
| LineParser = Callable[[str], Tuple[str, Values]] | |
| SCHEME_RE = re.compile(r"^(http|https|file):", re.I) | |
| COMMENT_RE = re.compile(r"(^|\s+)#.*$") | |
| ENV_VAR_RE = re.compile(r"(?P<var>\$\{(?P<name>[A-Z0-9_]+)\})") | |
| list | SUPPORTED_OPTIONS |
| list | SUPPORTED_OPTIONS_REQ |
| list | SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ] |
| logger = logging.getLogger(__name__) | |
Requirements file parsing
| Tuple[str, str] break_args_options | ( | str | line | ) |
Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.
Definition at line 416 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.get_line_parser().

| optparse.OptionParser build_parser | ( | ) |
Return a parser for parsing requirement lines
Definition at line 438 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.get_line_parser().

| ReqFileLines expand_env_variables | ( | ReqFileLines | lines_enum | ) |
Replace all environment variables that can be retrieved via `os.getenv`.
The only allowed format for environment variables defined in the
requirement file is `${MY_VARIABLE_1}` to ensure two things:
1. Strings that contain a `$` aren't accidentally (partially) expanded.
2. Ensure consistency across platforms for requirement files.
These points are the result of a discussion on the `github pull
request #3514 <https://github.com/pypa/pip/pull/3514>`_.
Valid characters in variable names follow the `POSIX standard
<http://pubs.opengroup.org/onlinepubs/9699919799/>`_ and are limited
to uppercase letter, digits and the `_` (underscore).
Definition at line 503 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.preprocess().

| Tuple[str, str] get_file_content | ( | str | url, |
| PipSession | session | ||
| ) |
Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance.
Definition at line 530 of file req_file.py.
References i.
Referenced by RequirementsFileParser._parse_file().

| LineParser get_line_parser | ( | Optional["PackageFinder"] | finder | ) |
Definition at line 392 of file req_file.py.
References pip._internal.req.req_file.break_args_options(), pip._internal.req.req_file.build_parser(), and i.
Referenced by pip._internal.req.req_file.parse_requirements().


| Optional[ParsedRequirement] handle_line | ( | ParsedLine | line, |
| Optional[optparse.Values] | options = None, |
||
| Optional["PackageFinder"] | finder = None, |
||
| Optional[PipSession] | session = None |
||
| ) |
Handle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The session - updated by non-requirement lines. Returns a ParsedRequirement object if the line is a requirement line, otherwise returns None. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder.
Definition at line 278 of file req_file.py.
References pip._internal.req.req_file.handle_option_line(), pip._internal.req.req_file.handle_requirement_line(), and i.
Referenced by pip._internal.req.req_file.parse_requirements().


| None handle_option_line | ( | Values | opts, |
| str | filename, | ||
| int | lineno, | ||
| Optional["PackageFinder"] | finder = None, |
||
| Optional[optparse.Values] | options = None, |
||
| Optional[PipSession] | session = None |
||
| ) |
Definition at line 208 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.handle_line().

| ParsedRequirement handle_requirement_line | ( | ParsedLine | line, |
| Optional[optparse.Values] | options = None |
||
| ) |
Definition at line 168 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.handle_line().

| ReqFileLines ignore_comments | ( | ReqFileLines | lines_enum | ) |
Strips comments and filter empty lines.
Definition at line 492 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.preprocess().

| ReqFileLines join_lines | ( | ReqFileLines | lines_enum | ) |
Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line.
Definition at line 461 of file req_file.py.
References i.
Referenced by pip._internal.req.req_file.preprocess().

| Generator[ParsedRequirement, None, None] parse_requirements | ( | str | filename, |
| PipSession | session, | ||
| Optional["PackageFinder"] | finder = None, |
||
| Optional[optparse.Values] | options = None, |
||
| bool | constraint = False |
||
| ) |
Parse a requirements file and yield ParsedRequirement instances.
:param filename: Path or url of requirements file.
:param session: PipSession instance.
:param finder: Instance of pip.index.PackageFinder.
:param options: cli options.
:param constraint: If true, parsing a constraint file rather than
requirements file.
Definition at line 129 of file req_file.py.
References pip._internal.req.req_file.get_line_parser(), pip._internal.req.req_file.handle_line(), and i.

| ReqFileLines preprocess | ( | str | content | ) |
Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file
Definition at line 156 of file req_file.py.
References pip._internal.req.req_file.expand_env_variables(), i, pip._internal.req.req_file.ignore_comments(), and pip._internal.req.req_file.join_lines().
Referenced by RequirementsFileParser._parse_file().


Definition at line 46 of file req_file.py.
Definition at line 52 of file req_file.py.
| LineParser = Callable[[str], Tuple[str, Values]] |
Definition at line 43 of file req_file.py.
| logger = logging.getLogger(__name__) |
Definition at line 81 of file req_file.py.
| ReqFileLines = Iterable[Tuple[int, str]] |
Definition at line 41 of file req_file.py.
Definition at line 45 of file req_file.py.
| list SUPPORTED_OPTIONS |
Definition at line 54 of file req_file.py.
| list SUPPORTED_OPTIONS_REQ |
Definition at line 72 of file req_file.py.
| list SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ] |
Definition at line 79 of file req_file.py.