Beispiel #1
0
 def _make_cable(self, minimum_length):
   for clen, ctype, ccost, cpower in self._options:
     if clen >= minimum_length:
       if not self.partial_cables:
         return fabric.Cable(minimum_length, clen)
       else:
         return fabric.Cable(minimum_length, minimum_length)
   assert False, 'no cable available for length: {}'.format(minimum_length)
Beispiel #2
0
 def _make_cable(self, minimum_length):
     actual_length = minimum_length
     if not self.partial_cables:
         real_lengths = [
             0.5, 1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30, 50, 75, 100
         ]
         found = False
         for real_length in real_lengths:
             if real_length >= minimum_length:
                 actual_length = real_length
                 found = True
                 break
         assert found, 'no cable available for length: {}'.format(
             actual_length)
     return fabric.Cable(minimum_length, actual_length)