Registry

Catalog loading and registry exports.

class design_research_problems._catalog.ProblemRegistry[source]

Lazy-loading registry for the packaged problem catalog.

Initialize an empty lazy registry cache.

by_kind(kind)[source]

Return metadata entries with the requested kind.

Parameters:

kind – Problem family to filter for.

Returns:

Matching metadata entries.

capabilities(problem_id)[source]

Return the normalized capability flags for one problem ID.

Parameters:

problem_id – Stable catalog identifier.

Returns:

Capability flags in deterministic sorted order.

Raises:

KeyError – If the ID is unknown.

feature_flags(problem_id)[source]

Return the feature flags for one problem ID.

Parameters:

problem_id – Stable catalog identifier.

Returns:

Feature flags in deterministic sorted order.

Raises:

KeyError – If the ID is unknown.

get(problem_id)[source]

Instantiate one problem by ID.

Parameters:

problem_id – Stable catalog identifier.

Returns:

Loaded problem instance.

Raises:
get_as(problem_id, expected_type)[source]

Instantiate one problem by ID and assert the runtime type.

Parameters:
  • problem_id – Stable catalog identifier.

  • expected_type – Required runtime problem class.

Returns:

Loaded problem instance narrowed to expected_type.

Raises:

TypeError – If the loaded problem is not an instance of expected_type.

kind_feature_flags()[source]

Return aggregated feature flags for each problem family.

Returns:

Mapping of problem kinds to the union of feature flags across that family.

list()[source]

Return all problem metadata in ID-sorted order.

Returns:

Metadata entries sorted by problem ID.

search(tags=(), text='', feature_flags=(), kind=None, capabilities=(), study_suitability=())[source]

Search metadata by tags and free text.

Parameters:
  • tags – Tags that must all be present on a matching entry.

  • text – Case-insensitive free-text search term.

  • feature_flags – Feature flags that must all be present on a matching entry.

  • kind – Optional problem-family filter.

  • capabilities – Capability flags that must all be present.

  • study_suitability – Study-suitability flags that must all be present.

Returns:

Matching metadata entries.

study_suitability(problem_id)[source]

Return the normalized study-suitability flags for one problem ID.

Parameters:

problem_id – Stable catalog identifier.

Returns:

Study-suitability flags in deterministic sorted order.

Raises:

KeyError – If the ID is unknown.

design_research_problems._catalog.get_problem(problem_id)[source]

Return one problem instance by ID.

Parameters:

problem_id – Stable catalog identifier.

Returns:

Loaded problem instance.

design_research_problems._catalog.get_problem_as(problem_id, expected_type)[source]

Return one problem instance by ID with an asserted runtime type.

Parameters:
  • problem_id – Stable catalog identifier.

  • expected_type – Required runtime problem class.

Returns:

Loaded problem instance narrowed to expected_type.

design_research_problems._catalog.list_problems()[source]

Return all packaged problem IDs.

Returns:

Stable problem IDs in sorted order.