LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Member Functions | List of all members
lsst.obs.base.gen2to3.repoConverter.MostRecentlyUsedStack Class Reference
Inheritance diagram for lsst.obs.base.gen2to3.repoConverter.MostRecentlyUsedStack:

Public Member Functions

def __init__ (self)
 
def __iter__ (self)
 
def apply
 
def push (self, element)
 

Detailed Description

A simple container that maintains a most-recently-used ordering.

Definition at line 50 of file repoConverter.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base.gen2to3.repoConverter.MostRecentlyUsedStack.__init__ (   self)

Definition at line 54 of file repoConverter.py.

54  def __init__(self):
55  self._elements = []
56 

Member Function Documentation

◆ __iter__()

def lsst.obs.base.gen2to3.repoConverter.MostRecentlyUsedStack.__iter__ (   self)

Definition at line 57 of file repoConverter.py.

57  def __iter__(self):
58  # Iterate in reverse order so we can keep the most recent element used
59  # at the end of the list. We want to use the end rather than the
60  # beginning because appending to lists is much more efficient than
61  # inserting at the beginning.
62  yield from reversed(self._elements)
63 

◆ apply()

def lsst.obs.base.gen2to3.repoConverter.MostRecentlyUsedStack.apply (   self,
  func 
)

Definition at line 64 of file repoConverter.py.

64  def apply(self, func: Callable[[T], Any]) -> Any:
65  """Apply a function to elements until it returns a value that coerces
66  to `True`, and move the corresponding element to the front of the
67  stack.
68 
69  Parameters
70  ----------
71  func : callable
72  Callable object.
73 
74  Returns
75  -------
76  value : `object`
77  The first value returned by ``func`` that coerces to `True`.
78  """
79  for n, element in enumerate(self):
80  result = func(element)
81  if result:
82  break
83  else:
84  return None
85  # Move the extractor that matched to the back of the list (note that
86  # n indexes from the back of the internal list).
87  if n != 0:
88  # i indexes from the front of the internal list.
89  i = len(self._elements) - 1 - n
90  assert self._elements[i] is element
91  del self._elements[i]
92  self._elements.append(element)
93  return result
94 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

◆ push()

def lsst.obs.base.gen2to3.repoConverter.MostRecentlyUsedStack.push (   self,
  element 
)
Add a new element to the front of the stack.

Definition at line 95 of file repoConverter.py.

95  def push(self, element):
96  """Add a new element to the front of the stack.
97  """
98  self._elements.append(element)
99 
100 
101 @dataclass
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

The documentation for this class was generated from the following file: