1. 07 Apr, 2021 1 commit
    • David Runge's avatar
      Change repo_management to be async · 6f8cf758
      David Runge authored
      repo_managament/*:
      Remove the obsolete
      `convert._transform_package_desc_to_output_package()` (the functionality
      is now covered by pydantic models directly).
      Change all relevant methods to be async.
      Change file open commands to make use of aiofiles.
      
      tests/*:
      Remove tests for the obsolete
      `convert._transform_package_desc_to_output_package()`.
      Change all tests for async methods to test using pytest-asyncio.
      6f8cf758
  2. 18 Mar, 2021 1 commit
    • David Runge's avatar
      Add methods for reading and streaming JSON files · 3103d0f7
      David Runge authored
      repo_management/files.py:
      Add `_json_files_in_directory()` yield a list of files with a .json
      suffix in a directory.
      Add `_read_pkgbase_json_file()` to read a JSON file representing a
      pkgbase and return an `OutputPackageBase` model.
      Add `_write_db_file()` to open a tar file for writing.
      Add `_stream_package_base_to_db()` to stream a `models.OutputPackage()`
      to a tar file (which represents a .db or a .files repository database).
      
      tests/test_files.py:
      Add tests for `_json_files_in_directory()`, `_read_pkgbase_json_file()`,
      `_write_db_file()` and `_stream_package_base_to_db()`.
      3103d0f7
  3. 08 Mar, 2021 2 commits
    • David Runge's avatar
      Change repository member iterator to yield model · dc8d4b80
      David Runge authored
      repo_management/files.py:
      Add the private method `_extract_db_member_package_name()` which can be
      used to extract the package name from the name of a member of repository
      database.
      Rename `_read_db_file_member()` to `_db_file_member_as_model()` and
      change the method to yield a `models.RepoDbMemberData` instead of a
      `tarfile.TarInfo` to provide actual data (and required context) to
      callers of the method.
      
      tests/test_file.py:
      Add parametrized test for `_extract_db_member_package_name()`.
      Change test for `_db_file_member_as_model()` to assert the correct
      return type.
      dc8d4b80
    • David Runge's avatar
      Add iterator for TarFile members · 2660ca6c
      David Runge authored
      repo_management/files.py:
      Add iterator method `_read_db_file_member()` to yield the members of a
      provided tarfile.TarFile.
      The members are filtered by name using a regular expression, which can
      be overridden.
      
      tests/test_file.py:
      Change `create_db_file()` to also create 'desc' and 'files' files below
      the created temporary directories.
      Assert, that all tested methods return a value.
      Add test for `_read_db_file_member()`.
      2660ca6c
  4. 07 Mar, 2021 1 commit
    • David Runge's avatar
      Add method to read db file · 70bdbd76
      David Runge authored
      repo_management/files.py:
      Add `_read_db_file()` to open a db file and return it as
      tarfile.Tarfile. The method assumes gzip-compressed databases by
      default, but can be used with other compression algorithms.
      
      tests/test_file.py:
      Add fixtures and tests for `_read_db_file()`.
      70bdbd76