schola.core.utils.IdManager

class schola.core.utils.IdManager(ids)[source]

Bases: object

A class to manage the mapping between nested and flattened ids.

Parameters:

ids (List[List[int]]) – A nested list of lists of ids to manage, index in the list is first id, second id is stored in the second list.

ids

The nested list of lists of ids to manage.

Type:

List[List[int]]

Methods

__init__(ids)

flatten_id_dict(nested_id_dict[, default])

Flatten a dictionary of nested ids into a list of values.

get_flattened_id(first_id, second_id)

Get the flattened id from a nested id.

get_nested_id(flat_id)

Get the nested id from a flattened id.

nest_id_list(id_list[, default])

Nest a list of values, indexed by flattened id, into a dictionary of nested ids.

partial_get(first_id)

Get the second ids for a given first id.

Attributes

id_list

List of nested ids, for lookups from flattened id to nested ids.

id_map

List of dictionaries mapping nested ids to flattened ids.

num_ids

The number of ids managed by the IdManager.

__init__(ids)[source]
Parameters:

ids (List[List[int]])

flatten_id_dict(nested_id_dict, default=None)[source]

Flatten a dictionary of nested ids into a list of values.

Parameters:
  • nested_id_dict (Dict[int, Dict[int, T]]) – The dictionary to flatten.

  • default (Optional[T], optional) – The default value to use if a key is not found, by default None.

Returns:

A flattened list of the values found in the dictionary.

Return type:

List[T]

get_flattened_id(first_id, second_id)[source]

Get the flattened id from a nested id.

Parameters:
  • first_id (int) – The first id.

  • second_id (int) – The second id.

Returns:

The flattened id.

Return type:

int

get_nested_id(flat_id)[source]

Get the nested id from a flattened id.

Parameters:

flat_id (int) – The flattened id to convert.

Returns:

The nested id.

Return type:

Tuple[int,int]

property id_list: List[Tuple[int, int]]

List of nested ids, for lookups from flattened id to nested ids.

Returns:

List of nested ids.

Return type:

List[Tuple[int, int]]

property id_map: List[Dict[int, int]]

List of dictionaries mapping nested ids to flattened ids.

Returns:

List of dictionaries mapping nested ids to flattened ids.

Return type:

List[Dict[int,int]]

nest_id_list(id_list, default=None)[source]

Nest a list of values, indexed by flattened id, into a dictionary of nested ids.

Parameters:
  • id_list (List[T]) – The list of values to convert into a nested dictionary.

  • default (Optional[T], optional) – The default value to use if a key is not found, by default None.

Returns:

A nested dictionary of the values in id_list or default if values are missing.

Return type:

Dict[int, Dict[int, T]]

property num_ids: int

The number of ids managed by the IdManager.

Returns:

The number of ids.

Return type:

int

partial_get(first_id)[source]

Get the second ids for a given first id.

Parameters:

first_id (int) – The first id to get the second ids for.

Returns:

The second ids for the given first id.

Return type:

List[int]

Related pages

  • Visit the Schola product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNA™ 2 GPUs, AMD Ryzen™ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!