diff --git a/models.py b/models.py index 410c79b..f9927e1 100644 --- a/models.py +++ b/models.py @@ -303,8 +303,7 @@ def special(self): if weather_type == 'none': return Condition(type='normal', text='') - else: - return Condition(type=weather_type, text=random.choice(self.special_conditions[weather_type])) + return Condition(type=weather_type, text=random.choice(self.special_conditions[weather_type])) def update_precipitation(self): """ @@ -330,8 +329,7 @@ def precipitation(self): detailed_type = intensity + '-' + precip_type text = random.choice(self.precipitations[precip_type][intensity]) return Condition(type=detailed_type, text=text) - else: - return Condition(type='none', text='') + return Condition(type='none', text='') def alert(self, alert, timezone_id): """ diff --git a/requirements-dev.txt b/requirements-dev.txt index 61c5cb4..23e007c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ testfixtures>=4.13.5,<5.0 invoke>=0.15.0,<1.0 -pylint>=1.6.5,<2.0 +pylint>=1.7.1,<2.0 yamllint>=1.6.1,<2.0 coverage>=4.3.4,<5.0 \ No newline at end of file diff --git a/strings.yml b/strings.yml index 423bc83..8ce41f9 100644 --- a/strings.yml +++ b/strings.yml @@ -133,7 +133,7 @@ precipitations: - "It's snowing. \U0001f328" - "\U0001f328" - "\u2744" - - "Yay, snow! \u2603\\ufe0f" + - "Yay, snow! \u2603\ufe0f" light: - "Light snow!" - "It's lightly snowing." diff --git a/tasks.py b/tasks.py index b5ac4c6..b167687 100644 --- a/tasks.py +++ b/tasks.py @@ -1,5 +1,4 @@ from invoke import task -import sys @task(help={ @@ -32,18 +31,12 @@ def lint(ctx, pylintrc='.pylintrc', extra=''): This will, by default, use the PyLint configuration found in '.pylintrc', but can accept a different path. """ - - # pylint doesn't support Python 3.6 yet - # FIXME when supported - if sys.version_info > (3, 6): - ctx.run('echo "pylint does not support Python 3.6"') - else: - from pylint.lint import Run - args = ['--reports=no', '--rcfile=' + pylintrc] - files = ['weatherBot.py', 'utils.py', 'models.py', 'keys.py'] - if extra: - files.append(extra) - Run(args + files) + from pylint.lint import Run + args = ['--reports=no', '--rcfile=' + pylintrc] + files = ['weatherBot.py', 'utils.py', 'models.py', 'keys.py'] + if extra: + files.append(extra) + Run(args + files) @task(help={ diff --git a/utils.py b/utils.py index 9844410..6cdf190 100644 --- a/utils.py +++ b/utils.py @@ -72,22 +72,22 @@ def get_units(unit): 'pressure': 'hPa', 'visibility': 'mi' } - else: # si - return { - 'unit': 'si', - 'nearestStormDistance': 'km', - 'precipIntensity': 'mm/h', - 'precipIntensityMax': 'mm/h', - 'precipAccumulation': 'cm', - 'temperature': 'C', - 'temperatureMin': 'C', - 'temperatureMax': 'C', - 'apparentTemperature': 'C', - 'dewPoint': 'C', - 'windSpeed': 'm/s', - 'pressure': 'hPa', - 'visibility': 'km' - } + # si + return { + 'unit': 'si', + 'nearestStormDistance': 'km', + 'precipIntensity': 'mm/h', + 'precipIntensityMax': 'mm/h', + 'precipAccumulation': 'cm', + 'temperature': 'C', + 'temperatureMin': 'C', + 'temperatureMax': 'C', + 'apparentTemperature': 'C', + 'dewPoint': 'C', + 'windSpeed': 'm/s', + 'pressure': 'hPa', + 'visibility': 'km' + } def get_wind_direction(degrees): @@ -201,8 +201,7 @@ def precipitation_intensity(precip_intensity, unit): return intensities[unit]['light'][0] elif precip_intensity >= intensities[unit]['very-light'][1]: return intensities[unit]['very-light'][0] - else: - return 'none' + return 'none' def parse_time_string(raw_string):