Skip to content

Commit

Permalink
syntax sugar
Browse files Browse the repository at this point in the history
  • Loading branch information
yxieca committed Dec 4, 2018
1 parent b10dac0 commit c799a5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sonic_sfp/sfputilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def _sfp_eeprom_present(self, sysfs_sfp_i2c_client_eeprompath, offset):
return False
else:
try:
sysfsfile = open(sysfs_sfp_i2c_client_eeprompath, mode="rb", buffering=0)
sysfsfile.seek(offset)
sysfsfile.read(1)
with open(sysfs_sfp_i2c_client_eeprompath, mode="rb", buffering=0) as sysfsfile:
sysfsfile.seek(offset)
sysfsfile.read(1)
except IOError:
return False
except:
Expand Down

0 comments on commit c799a5e

Please sign in to comment.