Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #24 from BrianMitchL/development
Browse files Browse the repository at this point in the history
Update pylint and fix emoji bug
  • Loading branch information
BrianMitchL committed Apr 18, 2017
2 parents be0d880 + 50910e8 commit 14a3b15
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 37 deletions.
6 changes: 2 additions & 4 deletions models.py
Expand Up @@ -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):
"""
Expand All @@ -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):
"""
Expand Down
2 changes: 1 addition & 1 deletion 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
2 changes: 1 addition & 1 deletion strings.yml
Expand Up @@ -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."
Expand Down
19 changes: 6 additions & 13 deletions tasks.py
@@ -1,5 +1,4 @@
from invoke import task
import sys


@task(help={
Expand Down Expand Up @@ -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={
Expand Down
35 changes: 17 additions & 18 deletions utils.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 14a3b15

Please sign in to comment.