qubiter.LoopyPlaceholderManager module

class qubiter.LoopyPlaceholderManager.LoopyPlaceholderManager(loop_out, indentation_li, **kwargs)[source]

Bases: qubiter.PlaceholderManager.PlaceholderManager

This class is important to you only if you are interested in using loops in the English file.

This class is a child of PlaceholderManager. Like its parent PlaceholderManager, it stores and processes info having to do with placeholder variables.

This class in used by class LoopFileGenerator to write a Loop File, which is a template Python file that when modified by you and executed, generates the history of each placeholder variable ( either a hash variable or a functional placeholder) used in a target circuit with nested loops.

A history of a variable is a list of all the values it will assume all the times it is used in the circuit (each repetition in a loop or nested loops is counted as a different use.)

Variables with a _li suffix are one item lists. This is a way of passing by reference (i.e., by pointer) instead of by value, an immutable in Python.

Variables:
  • indentation_li (list[int]) – one item list containing an int that stores the current number of indentation spaces in the Loop File being written
  • loop_out (_io.TextIOWrapper) – out stream to Loop File being generated by collaboration of this class and a LoopFileManager. This class writes to loop_out info stored in it
__init__(loop_out, indentation_li, **kwargs)[source]

Constructor

Parameters:
  • loop_out (_io.TextIOWrapper) –
  • indentation_li (list[int]) –
  • kwargs (dict) –
degs_str_to_rads(degs_str, line_count)[source]

This method overrides method of same name in parent class PlaceholderManager. This method is called by class SEO_reader every time a placeholder with a legal name is encountered while reading an input English file. This method analyzes the legal name and writes info gleaned from that analysis to the Loop File being written.

Parameters:
  • degs_str (str) –
  • line_count (int) –
Returns:

Return type:

float | str

write_loop_file_ending()[source]

This method writes stuff at the end of the Loop File, after the English file has been read.

Returns:
Return type:None
write_loop_file_prelude()[source]

This method writes stuff at the beginning of the Loop File, before the English file has been read.

Returns:
Return type:None