Skip to content

Commit

Permalink
Use correct python convention for what's private and what is part of …
Browse files Browse the repository at this point in the history
…the public api of the class, also python style method names
  • Loading branch information
emilybache committed Sep 20, 2012
1 parent 5429543 commit 2d1de05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class UnicodeFileToHtmlTextConverter(object):
def __init__(self, full_filename_with_path):
self.full_filename_with_path = full_filename_with_path

def convertToHtml(self):
def convert_to_html(self):
f = open(self.full_filename_with_path, "r")
html = ""
for line in f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ def sample_pressure():
class Alarm(object):

def __init__(self):
self.low_pressure_threshold = 17
self.high_pressure_threshold = 21
self.sensor = Sensor()
self.alarm_on = False
self.alarm_count = 0
self._low_pressure_threshold = 17
self._high_pressure_threshold = 21
self._sensor = Sensor()
self.is_alarm_on = False
self._alarm_count = 0

def check(self):
psi_pressure_value = self.sensor.pop_next_pressure_psi_value()
if psi_pressure_value < self.low_pressure_threshold or self.high_pressure_threshold < psi_pressure_value:
self.alarm_on = True
self.alarm_count += 1

def is_alarm_on(self):
return self.alarm_on
psi_pressure_value = self._sensor.pop_next_pressure_psi_value()
if psi_pressure_value < self._low_pressure_threshold or self._high_pressure_threshold < psi_pressure_value:
self.is_alarm_on = True
self._alarm_count += 1

0 comments on commit 2d1de05

Please sign in to comment.