Source code for pip_rating.req_files.package_list

from pathlib import Path
from typing import List, Union, Optional

from pip_rating.req_files import ReqFileBase


[docs]class PackageList(ReqFileBase): """Package list.""" def __init__(self, packages: List[str]): """Initialize the package list.""" list.__init__(self, packages)
[docs] def get_dependencies(self) -> List[str]: """Get the dependencies.""" return self
[docs] @classmethod def find_in_directory(cls, directory: Union[str, Path]) -> Optional["ReqFileBase"]: """Find requirement file in the given directory.""" raise NotImplementedError
[docs] @classmethod def is_valid(cls, path: Union[str, Path]) -> bool: """Check if the given path is a valid requirement file.""" raise NotImplementedError
def __str__(self) -> str: return str(list(self)) def __repr__(self) -> str: return f"<ReqFile ({len(self)})>"