Skip to content

Commit 179c9a5

Browse files
committed
Skip Python 3.3 in Travis...
1 parent fc7ed17 commit 179c9a5

File tree

10 files changed

+93
-74
lines changed

10 files changed

+93
-74
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ sudo: false
44

55
env:
66
- PYTHON="2.7"
7-
- PYTHON="3.3"
87
- PYTHON="3.4"
98
- PYTHON="3.5"
109

@@ -28,5 +27,4 @@ before_install:
2827

2928
script:
3029
- python setup.py test
31-
- find ./folium -type f -name "*.py" | xargs flake8 --max-line-length=100
32-
- find ./tests -type f -name "*.py" | xargs flake8 --max-line-length=100
30+
- find . -type f -name "*.py" ! -name 'conf.py' | xargs flake8 --max-line-length=100

examples/base_map.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
import folium
55

6-
#Standard OSM
6+
# Standard OSM.
77
map_osm = folium.Map(location=[45.5236, -122.6750])
88
map_osm.create_map(path='osm.html')
99

10-
#Stamen Toner
10+
# Stamen Toner.
1111
stamen = folium.Map(location=[45.5236, -122.6750], tiles='Stamen Toner',
1212
zoom_start=13)
1313
stamen.create_map(path='stamen_toner.html')

examples/choropleth_counties.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
'''
22
Choropleth maps of US counties.
33
4-
GeoJSON via the US Census and Eric Celeste: http://eric.clst.org/Stuff/USGeoJSON
4+
GeoJSON via the US Census and Eric Celeste:
5+
6+
http://eric.clst.org/Stuff/USGeoJSON
57
68
'''
79

@@ -11,7 +13,7 @@
1113
county_data = r'us_county_data.csv'
1214
county_geo = r'us_counties_20m_topo.json'
1315

14-
#Read into Dataframe, cast to string for consistency
16+
# Read into Dataframe, cast to string for consistency.
1517
df = pd.read_csv(county_data, na_values=[' '])
1618
df['FIPS_Code'] = df['FIPS_Code'].astype(str)
1719

@@ -25,11 +27,11 @@ def set_id(fips):
2527
else:
2628
return ''.join(['0500000US', fips])
2729

28-
#Apply set_id, drop NaN
30+
# Apply set_id, drop NaN.
2931
df['GEO_ID'] = df['FIPS_Code'].apply(set_id)
3032
df = df.dropna()
3133

32-
#Number of employed with auto scale
34+
# Number of employed with auto scale.
3335
map_1 = folium.Map(location=[48, -102], zoom_start=3)
3436
map_1.geo_json(geo_path=county_geo, data_out='data1.json', data=df,
3537
columns=['GEO_ID', 'Employed_2011'],
@@ -38,7 +40,7 @@ def set_id(fips):
3840
topojson='objects.us_counties_20m')
3941
map_1.create_map(path='map_1.html')
4042

41-
#Unemployment with custom defined scale
43+
# Unemployment with custom defined scale.
4244
map_2 = folium.Map(location=[40, -99], zoom_start=4)
4345
map_2.geo_json(geo_path=county_geo, data_out='data2.json', data=df,
4446
columns=['GEO_ID', 'Unemployment_rate_2011'],
@@ -49,7 +51,7 @@ def set_id(fips):
4951
topojson='objects.us_counties_20m')
5052
map_2.create_map(path='map_2.html')
5153

52-
#Median Household income
54+
# Median Household income.
5355
map_3 = folium.Map(location=[40, -99], zoom_start=4)
5456
map_3.geo_json(geo_path=county_geo, data_out='data3.json', data=df,
5557
columns=['GEO_ID', 'Median_Household_Income_2011'],

examples/choropleth_states.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
state_data = pd.read_csv(state_unemployment)
1313

14-
#Let Folium determine the scale
14+
# Let Folium determine the scale.
1515
states = folium.Map(location=[48, -102], zoom_start=3)
1616
states.geo_json(geo_path=state_geo, data=state_data,
1717
columns=['State', 'Unemployment'],
@@ -20,7 +20,7 @@
2020
legend_name='Unemployment Rate (%)')
2121
states.create_map(path='us_state_map.html')
2222

23-
#Let's define our own scale and change the line opacity
23+
# Let's define our own scale and change the line opacity.
2424
states2 = folium.Map(location=[48, -102], zoom_start=3)
2525
states2.geo_json(geo_path=state_geo, data=state_data,
2626
columns=['State', 'Unemployment'],

examples/folium_vincent_markers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414

1515
NOAA_46041 = NOAA_46041.dropna()
1616

17-
#Binned wind speeds for NOAA 46050
17+
# Binned wind speeds for NOAA 46050.
1818
bins = range(0, 13, 1)
1919
cuts = pd.cut(NOAA_46050['wind_speed_cwind (m/s)'], bins)
2020
ws_binned = pd.value_counts(cuts).reindex(cuts.levels)
2121

22-
#NOAA 46401 Wave Period
22+
# NOAA 46401 Wave Period.
2323
vis1 = vincent.Line(NOAA_46041['dominant_wave_period (s)'],
2424
width=400, height=200)
2525
vis1.axis_titles(x='Time', y='Dominant Wave Period (s)')
2626
vis1.to_json('vis1.json')
2727

28-
#NOAA 46050 Binned Wind Speed
28+
# NOAA 46050 Binned Wind Speed.
2929
vis2 = vincent.Bar(ws_binned, width=400, height=200)
3030
vis2.axis_titles(x='Wind Speed (m/s)', y='# of Obs')
3131
vis2.to_json('vis2.json')
3232

33-
#NOAA 46243 Wave Height
33+
# NOAA 46243 Wave Height.
3434
vis3 = vincent.Area(NOAA_46243['significant_wave_height (m)'],
3535
width=400, height=200)
3636
vis3.axis_titles(x='Time', y='Significant Wave Height (m)')
3737
vis3.to_json('vis3.json')
3838

39-
#Map all buoys
39+
# Map all buoys.
4040
buoy_map = folium.Map(location=[46.3014, -123.7390], zoom_start=7,
4141
tiles='Stamen Terrain')
4242
buoy_map.polygon_marker(location=[47.3489, -124.708], fill_color='#43d9de',

examples/line_example.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33

44
import folium
55

6-
# Coordinates are 15 points on the great circle from Boston to
6+
# Coordinates are 15 points on the great circle from Boston to
77
# San Francisco.
88
# Reference: http://williams.best.vwh.net/avform.htm#Intermediate
99
coordinates = [
10-
[ 42.3581 , -71.0636 ],
11-
[ 42.82995815, -74.78991444],
12-
[ 43.17929819, -78.56603306],
13-
[ 43.40320216, -82.37774519],
14-
[ 43.49975489, -86.20965845],
15-
[ 43.46811941, -90.04569087],
16-
[ 43.30857071, -93.86961818],
17-
[ 43.02248456, -97.66563267],
18-
[ 42.61228259, -101.41886832],
19-
[ 42.08133868, -105.11585198],
20-
[ 41.4338549 , -108.74485069],
21-
[ 40.67471747, -112.29609954],
22-
[ 39.8093434 , -115.76190821],
23-
[ 38.84352776, -119.13665678],
24-
[ 37.7833 , -122.4167 ]]
10+
[42.3581, -71.0636],
11+
[42.82995815, -74.78991444],
12+
[43.17929819, -78.56603306],
13+
[43.40320216, -82.37774519],
14+
[43.49975489, -86.20965845],
15+
[43.46811941, -90.04569087],
16+
[43.30857071, -93.86961818],
17+
[43.02248456, -97.66563267],
18+
[42.61228259, -101.41886832],
19+
[42.08133868, -105.11585198],
20+
[41.4338549, -108.74485069],
21+
[40.67471747, -112.29609954],
22+
[39.8093434, -115.76190821],
23+
[38.84352776, -119.13665678],
24+
[37.7833, -122.4167]]
2525

2626

2727
# Create the map and add the line

examples/markers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
import folium
55

6-
#Simple Markers with Stamen Terrain
6+
# Simple Markers with Stamen Terrain.
77
map_1 = folium.Map(location=[45.372, -121.6972], zoom_start=12,
88
tiles='Stamen Terrain')
99
map_1.simple_marker([45.3288, -121.6625], popup='Mt. Hood Meadows')
1010
map_1.simple_marker([45.3311, -121.7113], popup='Timberline Lodge')
1111
map_1.create_map(path='mthood.html')
1212

13-
#Circle Markers with Stamen Toner
13+
# Circle Markers with Stamen Toner.
1414
map_2 = folium.Map(location=[45.5236, -122.6750], tiles='Stamen Toner',
1515
zoom_start=13)
1616
map_2.simple_marker(location=[45.5244, -122.6699], popup='The Waterfront')
@@ -19,20 +19,20 @@
1919
fill_color='#3186cc')
2020
map_2.create_map(path='portland.html')
2121

22-
#Lat/Lng popovers
22+
# Lat/Lng popovers.
2323
map_3 = folium.Map(location=[46.1991, -122.1889], tiles='Stamen Terrain',
2424
zoom_start=13)
2525
map_3.lat_lng_popover()
2626
map_3.create_map(path='sthelens.html')
2727

28-
#Click for marker
28+
# Click for marker.
2929
map_4 = folium.Map(location=[46.8527, -121.7649], tiles='Stamen Terrain',
3030
zoom_start=13)
3131
map_4.simple_marker(location=[46.8354, -121.7325], popup='Camp Muir')
3232
map_4.click_for_marker(popup='Waypoint')
3333
map_4.create_map(path='mtrainier.html')
3434

35-
#Polygon markers
35+
# Polygon markers.
3636
map_5 = folium.Map(location=[45.5236, -122.6750], zoom_start=13)
3737
map_5.polygon_marker(location=[45.5012, -122.6655], popup='Ross Island Bridge',
3838
fill_color='#132b5e', num_sides=3, radius=10)

folium/features.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class WmsTileLayer(Layer):
3333
transparent: bool, default True
3434
Whether the layer shall allow transparency.
3535
attr: str, default None
36-
The attribution of the service. Will be displayed in the bottom right corner.
36+
The attribution of the service. Displayed in the bottom right corner.
3737
name : string, default None
3838
The name of the Layer, as it will appear in LayerControls
3939
overlay : bool, default False
@@ -44,7 +44,8 @@ class WmsTileLayer(Layer):
4444
def __init__(self, url, format=None, layers=None,
4545
transparent=True, attr=None,
4646
name=None, overlay=True, control=True):
47-
super(WmsTileLayer, self).__init__(overlay=overlay, control=control, name=name)
47+
super(WmsTileLayer, self).__init__(overlay=overlay,
48+
control=control, name=name)
4849
self._name = 'WmsTileLayer'
4950
self.tile_name = name if name is not None else 'WmsTileLayer_'+self._id
5051
self.url = url
@@ -157,8 +158,8 @@ class Vega(Element):
157158
----------
158159
data: JSON-like str or object
159160
The Vega description of the chart.
160-
It can also ba any object that has a method `to_json`, so that you can (for instance)
161-
provide a `vincent` chart.
161+
It can also be any object that has a method `to_json`,
162+
so that you can (for instance) provide a `vincent` chart.
162163
width: int or str, default None
163164
The width of the output element.
164165
If None, either data['width'] (if available) or '100%' will be used.
@@ -168,11 +169,11 @@ class Vega(Element):
168169
If None, either data['width'] (if available) or '100%' will be used.
169170
Ex: 120, '120px', '80%'
170171
left: int or str, default '0%'
171-
The horizontal distance of the output with respect to the parent HTML object.
172-
Ex: 120, '120px', '80%'
172+
The horizontal distance of the output with respect to the parent
173+
HTML object. Ex: 120, '120px', '80%'
173174
top: int or str, default '0%'
174-
The vertical distance of the output with respect to the parent HTML object.
175-
Ex: 120, '120px', '80%'
175+
The vertical distance of the output with respect to the parent
176+
HTML object. Ex: 120, '120px', '80%'
176177
position: str, default 'relative'
177178
The `position` argument that the CSS shall contain.
178179
Ex: 'relative', 'absolute'
@@ -278,8 +279,10 @@ class GeoJson(Layer):
278279
... '#00ff00'}
279280
>>> GeoJson(geojson, style_function=style_function)
280281
"""
281-
def __init__(self, data, style_function=None, name=None, overlay=True, control=True):
282-
super(GeoJson, self).__init__(name=name, overlay=overlay, control=control)
282+
def __init__(self, data, style_function=None, name=None,
283+
overlay=True, control=True):
284+
super(GeoJson, self).__init__(name=name, overlay=overlay,
285+
control=control)
283286
self._name = 'GeoJson'
284287
if hasattr(data, 'read'):
285288
self.embed = True
@@ -309,7 +312,8 @@ def __init__(self, data, style_function=None, name=None, overlay=True, control=T
309312
raise ValueError('Unhandled object {!r}.'.format(data))
310313

311314
if style_function is None:
312-
def style_function(x): return {}
315+
def style_function(x):
316+
return {}
313317
self.style_function = style_function
314318

315319
self._template = Template(u"""
@@ -322,8 +326,10 @@ def style_function(x): return {}
322326
""") # noqa
323327

324328
def style_data(self):
325-
"""Applies self.style_function to each feature of self.data and returns a corresponding
326-
JSON output.
329+
"""
330+
Applies `self.style_function` to each feature of `self.data` and
331+
returns a corresponding JSON output.
332+
327333
"""
328334
if 'features' not in self.data.keys():
329335
# Catch case when GeoJSON is just a single Feature or a geometry.
@@ -409,7 +415,8 @@ class TopoJson(Layer):
409415
"""
410416
def __init__(self, data, object_path, style_function=None,
411417
name=None, overlay=True, control=True):
412-
super(TopoJson, self).__init__(name=name, overlay=overlay, control=control)
418+
super(TopoJson, self).__init__(name=name, overlay=overlay,
419+
control=control)
413420
self._name = 'TopoJson'
414421
if 'read' in dir(data):
415422
self.embed = True
@@ -424,7 +431,8 @@ def __init__(self, data, object_path, style_function=None,
424431
self.object_path = object_path
425432

426433
if style_function is None:
427-
def style_function(x): return {}
434+
def style_function(x):
435+
return {}
428436
self.style_function = style_function
429437

430438
self._template = Template(u"""
@@ -440,8 +448,10 @@ def style_function(x): return {}
440448
""") # noqa
441449

442450
def style_data(self):
443-
"""Applies self.style_function to each feature of self.data and returns a corresponding
444-
JSON output.
451+
"""
452+
Applies self.style_function to each feature of self.data and returns
453+
a corresponding JSON output.
454+
445455
"""
446456
def recursive_get(data, keys):
447457
if len(keys):
@@ -510,7 +520,8 @@ class MarkerCluster(Layer):
510520
Whether the Layer will be included in LayerControls
511521
"""
512522
def __init__(self, name=None, overlay=True, control=True):
513-
super(MarkerCluster, self).__init__(name=name, overlay=overlay, control=control)
523+
super(MarkerCluster, self).__init__(name=name, overlay=overlay,
524+
control=control)
514525
self._name = 'MarkerCluster'
515526
self._template = Template(u"""
516527
{% macro script(this, kwargs) %}
@@ -640,8 +651,11 @@ def __init__(self, location, radius=500, color='black',
640651

641652

642653
class LatLngPopup(MacroElement):
643-
"""When one clicks on a Map that contains a LatLngPopup, a popup is shown that displays
644-
the latitude and longitude of the pointer."""
654+
"""
655+
When one clicks on a Map that contains a LatLngPopup,
656+
a popup is shown that displays the latitude and longitude of the pointer.
657+
658+
"""
645659
def __init__(self):
646660
super(LatLngPopup, self).__init__()
647661
self._name = 'LatLngPopup'

0 commit comments

Comments
 (0)