Combine

ocdskit.combine.package_records(records, uri='', publisher=None, published_date='', version='1.1', extensions=None)[source]

Wraps records in a record package.

Parameters:
  • records (list) – a list of records
  • uri (str) – the record package’s uri
  • publisher (dict) – the record package’s publisher
  • published_date (str) – the record package’s publishedDate
  • version (str) – the record package’s version
  • extensions (list) – the record package’s extensions
ocdskit.combine.package_releases(releases, uri='', publisher=None, published_date='', version='1.1', extensions=None)[source]

Wraps releases in a release package.

Parameters:
  • releases (list) – a list of releases
  • uri (str) – the release package’s uri
  • publisher (dict) – the release package’s publisher
  • published_date (str) – the release package’s publishedDate
  • version (str) – the release package’s version
  • extensions (list) – the release package’s extensions
ocdskit.combine.combine_record_packages(packages, uri='', publisher=None, published_date='', version='1.1')[source]

Collects the packages and records from the record packages into one record package.

Warns ~ocdskit.exceptions.MissingRecordsWarning if the “records” field is missing from a record package.

Parameters:
  • packages – an iterable of record packages
  • uri (str) – the record package’s uri
  • publisher (dict) – the record package’s publisher
  • published_date (str) – the record package’s publishedDate
  • version (str) – the record package’s version
ocdskit.combine.combine_release_packages(packages, uri='', publisher=None, published_date='', version='1.1')[source]

Collects the releases from the release packages into one release package.

Warns ~ocdskit.exceptions.MissingReleasesWarning if the “releases” field is missing from a release package.

Parameters:
  • packages – an iterable of release packages
  • uri (str) – the release package’s uri
  • publisher (dict) – the release package’s publisher
  • published_date (str) – the release package’s publishedDate
  • version (str) – the release package’s version
ocdskit.combine.merge(data, uri='', publisher=None, published_date='', version='1.1', schema=None, return_versioned_release=False, return_package=False, use_linked_releases=False, streaming=False)[source]

Merges release packages and individual releases.

By default, yields compiled releases. If return_versioned_release is True, yields versioned releases. If return_package is True, wraps the compiled releases (and versioned releases if return_versioned_release is True) in a record package.

If return_package is set and publisher isn’t set, the output record package will have the same publisher as the last input release package.

Parameters:
  • data – an iterable of release packages and individual releases
  • uri (str) – if return_package is True, the record package’s uri
  • publisher (dict) – if return_package is True, the record package’s publisher
  • published_date (str) – if return_package is True, the record package’s publishedDate
  • version (str) – if return_package is True, the record package’s version
  • schema (dict) – the URL, path or dict of the patched release schema to use
  • return_package (bool) – wrap the compiled releases in a record package
  • use_linked_releases (bool) – if return_package is True, use linked releases instead of full releases, if the input is a release package
  • return_versioned_release (bool) – if return_package is True, include versioned releases in the record package; otherwise, yield versioned releases instead of compiled releases
  • streaming (bool) – if return_package is True, set the package’s records to a generator (this only works if the calling code exhausts the generator before merge returns)
Raises:
ocdskit.combine.compile_release_packages(*args, **kwargs)[source]