Skip to content

Commit

Permalink
Use yapf disable to write the code more compact and view logic more c…
Browse files Browse the repository at this point in the history
…learly.
  • Loading branch information
priti-ashvin-shah-ibm committed Aug 8, 2022
1 parent e895607 commit 90dec8b
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions qiskit_metal/toolbox_metal/bounds_for_path_and_poly_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from qiskit_metal.toolbox_python.utility_functions import determine_larger_box

import pandas as pd
import numpy as np


class BoundsForPathAndPolyTables():
Expand Down Expand Up @@ -133,25 +134,13 @@ def ensure_component_box_smaller_than_chip_box_(
box_minx, box_miny, box_maxx, box_maxy = box_for_xy_bounds
safe_xy_box = list()
# Keep the order of appends in this way. It should match (minx, miny, maxx, maxy)
if box_minx < chip_minx:
safe_xy_box.append(chip_minx)
else:
safe_xy_box.append(box_minx)

if box_miny < chip_miny:
safe_xy_box.append(chip_miny)
else:
safe_xy_box.append(box_miny)

if box_maxx > chip_maxx:
safe_xy_box.append(chip_maxx)
else:
safe_xy_box.append(box_maxx)

if box_maxy > chip_maxy:
safe_xy_box.append(chip_maxy)
else:
safe_xy_box.append(box_maxy)

# yapf: disable
safe_xy_box.append(chip_minx) if box_minx < chip_minx else safe_xy_box.append(box_minx)
safe_xy_box.append(chip_miny) if box_miny < chip_miny else safe_xy_box.append(box_miny)
safe_xy_box.append(chip_maxx) if box_maxx > chip_maxx else safe_xy_box.append(box_maxx)
safe_xy_box.append(chip_maxy) if box_maxy > chip_maxy else safe_xy_box.append(box_maxy)
# yapf: enable

return tuple(safe_xy_box)

Expand Down

0 comments on commit 90dec8b

Please sign in to comment.