Skip to content

Commit

Permalink
2nd pass format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jchate6 committed Oct 18, 2023
1 parent 4c17e02 commit 5634a93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions tom_swift/swift.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class SwiftObservationForm(BaseObservationForm):
required=False,
label='XRT mode',
choices=SWIFT_XRT_MODE_CHOICES,
coerce=int, # convert the string '6' to int 6
coerce=int, # convert the string '6' to int 6
initial=6) # Windowed Timing (WT))

uvot_mode = forms.CharField(
Expand All @@ -192,7 +192,7 @@ class SwiftObservationForm(BaseObservationForm):
' See <a target=_blank'
' href=https://www.swift.psu.edu/operations/mode_lookup.php>'
'UVOT Mode Lookup Tool</a>'
)),
)),
) # 0x9999 is the "Filter of the Day" and does not require justification

# required unless uvot_mode is 0x9999 (Filter of the Day)
Expand Down Expand Up @@ -657,8 +657,8 @@ def validate_observation(self, observation_payload) -> []:
logger.debug(f'validate_observation response: {too_is_valid}')

if too_is_valid:
# if the too was internally valid, now validate with the server
logger.debug(f'validate_observation - calling too.server_validate()')
# if the TOO was internally valid, now validate with the server
logger.debug('validate_observation - calling too.server_validate()')
too_is_server_valid = self.swift_api.too.server_validate()

# logger.debug(f'validate_observation - too.status: {self.swift_api.too.status}')
Expand All @@ -681,7 +681,7 @@ def validate_observation(self, observation_payload) -> []:
logger.debug(f'validate_observation - too.status.status: {self.swift_api.too.status.status}')
logger.debug(f'validate_observation - too.status.errors: {self.swift_api.too.status.errors}')
logger.debug(f'validate_observation - type(too.status.errors): {type(self.swift_api.too.status.errors)}')

validation_errors = self.swift_api.too.status.errors

return validation_errors
Expand All @@ -698,7 +698,7 @@ def submit_observation(self, observation_payload) -> [()]:
returns a list of (field, error) tuples if the observation is invalid
See https://www.swift.psu.edu/too_api/ for documentation.
See https://www.swift.psu.edu/too_api/ for documentation.
The super class method is absract. No need to call it.
"""
Expand All @@ -712,9 +712,9 @@ def submit_observation(self, observation_payload) -> [()]:
f' to True before we call too.submit()')
self.swift_api.too.debug = True

logger.debug(f'calling too.submit()')
logger.debug('calling too.submit()')
self.swift_api.too.submit()
logger.debug(f'too.submit() returned')
logger.debug('too.submit() returned')

logger.info(f'submit_observation - too.status.status: {self.swift_api.too.status.status}')
logger.info(f'submit_observation - too.status.errors: {self.swift_api.too.status.errors}')
Expand Down
9 changes: 5 additions & 4 deletions tom_swift/swift_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ def get_credentials(self) -> (str, str):
"""
try:
username = settings.FACILITIES['SWIFT'].get('SWIFT_USERNAME', 'SWIFT_USERNAME not configured')
shared_secret = settings.FACILITIES['SWIFT'].get('SWIFT_SHARED_SECRET', 'SWIFT_SHARED_SECRET not configured')
shared_secret = settings.FACILITIES['SWIFT'].get('SWIFT_SHARED_SECRET',
'SWIFT_SHARED_SECRET not configured')

logger.info(f'swift username: {username}')
except KeyError as ex:
logger.error(f"'SWIFT' configuration dictionary not defined in settings.FACILITIES")
except KeyError:
logger.error("'SWIFT' configuration dictionary not defined in settings.FACILITIES")
raise ImproperlyConfigured
return username, shared_secret

Expand Down Expand Up @@ -131,7 +132,7 @@ def get_observation_type_choices():
#
# XRT modes are converted to numbers. So,
# too.xrt_mode = 6
# and
# and
# too.xrt_mode = 'WT'
# are equivalent.
#
Expand Down

0 comments on commit 5634a93

Please sign in to comment.