Skip to content

Commit

Permalink
Bugfix: Move loop_root sentinel value above exhaustive conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher87 committed Sep 25, 2024
1 parent 0f2cfeb commit 30ddf30
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions icepyx/core/granules.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ def place_order(
status = statuslist[0]
print("Initial status of your order request at NSIDC is: ", status)

loop_root = None

Check warning on line 415 in icepyx/core/granules.py

View check run for this annotation

Codecov / codecov/patch

icepyx/core/granules.py#L415

Added line #L415 was not covered by tests
# If status is already finished without going into pending/processing
if status.startswith("complete"):
loop_response = self.session.get(statusURL)
loop_root = ET.fromstring(loop_response.content)

# Continue loop while request is still processing
loop_root = None
while status == "pending" or status == "processing":
print(
"Your order status is still ",
Expand All @@ -443,11 +443,10 @@ def place_order(
continue

if not isinstance(loop_root, ET.Element):
# The typechecker determined that loop_root could be unbound at this
# point. We know for sure this shouldn't be possible, though, because
# the while loop should run once.
# See: https://github.com/microsoft/pyright/discussions/2033
raise RuntimeError("Programmer error!")
# The typechecker needs help knowing that at this point loop_root is
# set, as it can't tell that the conditionals above are supposed to be
# exhaustive.
raise icepyx.core.exceptions.ExhaustiveTypeGuardException

Check warning on line 449 in icepyx/core/granules.py

View check run for this annotation

Codecov / codecov/patch

icepyx/core/granules.py#L449

Added line #L449 was not covered by tests

# Order can either complete, complete_with_errors, or fail:
# Provide complete_with_errors error message:
Expand Down

0 comments on commit 30ddf30

Please sign in to comment.