def test_bunch(): b = Bunch(x=5, y=10) assert 'y' in b assert 'x' in b assert b.x == 5 b['a'] = 'hi' assert b.a == 'hi'
def _trigger_df_change_event(self): self.notify_change( Bunch( name='_df', old=None, new=self._df, owner=self, type='change', ))
def on_state_change(self, *args, obj=None, **kwargs): if self._block_on_state_change: return obj.notify_change( Bunch({ 'name': self.name, 'type': 'change', 'value': self.get(obj), 'new': self.get(obj) }))
def test_bunch_dir(): b = Bunch(x=5, y=10) assert 'x' in dir(b) assert 'keys' in dir(b)
'attribution': '© <a href="https://here.com">HERE.com</a>', 'name': 'HERE'} """ return TileLayer( url=build_tiles_url(**basemap, **kwargs), min_zoom=kwargs.get("min_zoom", 1), max_zoom=kwargs.get("max_zoom", 18), attribution='© <a href="https://here.com">HERE.com</a>', name="HERE." + kwargs.get("scheme", "normal.day"), **kwargs) basemaps = Bunch(Default=dict(maptype="base", tiletype="maptile", scheme="normal.day"), Satellite=dict(maptype="aerial", tiletype="maptile", scheme="satellite.day"), TrafficDay=dict(maptype='traffic', tiletype='traffictile', scheme="normal.day"), TrafficNight=dict(maptype='traffic', tiletype='traffictile', scheme="normal.night"), TransitDay=dict(maptype='base', tiletype='maptile', scheme="normal.day.transit"), TransitNight=dict(maptype='base', tiletype='maptile', scheme="normal.night.transit"))
projections = Bunch( # Alaska Polar Stereographic (WGS84) EPSG5936=Bunch(Basemap=dict( name='EPSG:5936', custom=True, proj4def="""+proj=stere +lat_0=90 +lat_ts=90 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs""", origin=[-2.8567784109255e+07, 3.2567784109255e+07], resolutions=[ 238810.813354, 119405.406677, 59702.7033384999, 29851.3516692501, 14925.675834625, 7462.83791731252, 3731.41895865639, 1865.70947932806, 932.854739664032, 466.427369832148, 233.213684916074, 116.60684245803701, 58.30342122888621, 29.151710614575396, 14.5758553072877, 7.28792765351156, 3.64396382688807, 1.82198191331174, 0.910990956788164, 0.45549547826179, 0.227747739130895, 0.113873869697739, 0.05693693484887, 0.028468467424435 ], bounds=[[-2623285.8808999992907047, -2623285.8808999992907047], [6623285.8803000003099442, 6623285.8803000003099442]])), # Polar Stereographic South (WGS84) EPSG3031=Bunch(Basemap=dict( name='EPSG:3031', custom=True, proj4def="""+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs""", origin=[-3.06361E7, 3.0636099999999993E7], resolutions=[ 67733.46880027094, 33866.73440013547, 16933.367200067736, 8466.683600033868, 4233.341800016934, 2116.670900008467, 1058.3354500042335, 529.1677250021168, 264.5838625010584, ], bounds=[[-4524583.19363305, -4524449.487765655], [4524449.4877656475, 4524583.193633042]])))
from traitlets import (Float, Unicode, Int, Tuple, List, Instance, Bool, Dict, Enum, link, observe, default, validate, TraitError, Union, HasTraits) from traitlets.utils.bunch import Bunch from .options import * from .utils import widget_serialization_no_none from ._version import EXTENSION_VERSION PUBLIC_GENOMES_FILE = os.path.join(os.path.dirname(__file__), 'public_genomes.json') PUBLIC_GENOMES = Bunch( {v['id']: v for v in json.load(open(PUBLIC_GENOMES_FILE, 'r'))}) @widgets.register class IgvBrowser(widgets.DOMWidget): """An IGV browser widget.""" def __init__(self, **kwargs): super().__init__(**kwargs) self.on_msg(self._custom_message_handler) out = widgets.Output() # Name of the widget view class in front-end _view_name = Unicode('IgvBrowser').tag(sync=True) # Name of the widget model class in front-end
basemaps = Bunch( OpenStreetMap= Bunch(Mapnik=dict( url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', max_zoom=19, attribution= 'Map data (c) <a href="https://openstreetmap.org">OpenStreetMap</a> contributors', name='OpenStreetMap.Mapnik'), BlackAndWhite=dict( url='http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png', max_zoom=18, attribution= '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', name='OpenStreetMap.BlackAndWhite', ), DE=dict( url= 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', max_zoom=18, attribution= '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', name='OpenStreetMap.DE'), France=dict( url='http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', max_zoom=20, attribution= '© Openstreetmap France | © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', name='OpenStreetMap.France'), HOT=dict( url='http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', max_zoom=19, attribution ='© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>', name='OpenStreetMap.HOT')), OpenTopoMap=dict( url='https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', max_zoom=17, attribution= 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)', name='OpenTopoMap'), Hydda=Bunch( Full=dict( url='http://{s}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png', max_zoom=18, attribution= 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', name='Hydda.Full'), Base=dict( url='http://{s}.tile.openstreetmap.se/hydda/base/{z}/{x}/{y}.png', max_zoom=18, attribution= 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', name='Hydda.Base'), ), Esri=Bunch( WorldStreetMap=dict( url= 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', max_zoom=20, attribution= 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012', name='Esri.WorldStreetMap'), DeLorme=dict( url= 'http://server.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer/tile/{z}/{y}/{x}', min_zoom=1, max_zoom=11, attribution= 'Tiles © Esri — Copyright: ©2012 DeLorme', name='Esri.DeLorme'), WorldTopoMap=dict( url= 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', max_zoom=20, attribution= 'Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community', name='Esri.WorldTopoMap'), WorldImagery=dict( url= 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', max_zoom=20, attribution= 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', name='Esri.WorldImagery'), NatGeoWorldMap=dict( url= 'http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', max_zoom=16, attribution= 'Tiles © Esri — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC', name='Esri.NatGeoWorldMap'), ), HikeBike=Bunch(HikeBike=dict( url='http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png', max_zoom=19, attribution= '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', name='HikeBike.HikeBike'), ), MtbMap=dict( url='http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png', max_zoom=20, attribution= '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> & USGS', name='MtbMap'), CartoDB=Bunch( Positron=dict( url='http://c.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', max_zoom=20, attribution= '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="http://cartodb.com/attributions">CartoDB</a>', name='CartoDB.Positron'), DarkMatter =dict( url='http://c.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', max_zoom=20, attribution= '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="http://cartodb.com/attributions">CartoDB</a>', name='CartoDB.DarkMatter')), NASAGIBS=Bunch( ModisTerraTrueColorCR=dict( url ='https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_CorrectedReflectance_TrueColor/default/%s/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg', max_zoom=9, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.ModisTerraTrueColorCR'), ModisTerraBands367CR=dict( url= 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_CorrectedReflectance_Bands367/default/%s/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg', max_zoom=9, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.ModisTerraBands367CR'), ModisTerraBands721CR=dict( url= 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_CorrectedReflectance_Bands721/default/%s/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg', max_zoom=9, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.MidsTerraBands721CR'), ModisAquaTrueColorCR=dict( url= 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_TrueColor/default/%s/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg', max_zoom=9, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.ModisAquaTrueColorCR'), ModisAquaBands721CR=dict( url= 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_Bands721/default/%s/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg', max_zoom=9, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.ModisAquaBands721CR'), ViirsTrueColorCR=dict( url= 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/%s/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg', max_zoom=9, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.ViirsTrueColorCR'), ViirsEarthAtNight2012=dict( url= 'http://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_Black_Marble/default/2012-01-01/GoogleMapsCompatible_Level8/{z}/{y}/{x}.png', max_zoom=8, attribution= 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.', name='NASAGIBS.ViirsEarthAtNight2012')), Strava=Bunch( All=dict( url ='https://heatmap-external-a.strava.com//tiles/all/hot/{z}/{x}/{y}.png?v=19', max_zoom=15, attribution= 'Map tiles by <a href="https://labs.strava.com/heatmap">Strava 2017</a>', name='Strava.All'), Ride=dict( url= 'https://heatmap-external-a.strava.com//tiles/ride/hot/{z}/{x}/{y}.png?v=19', max_zoom=15, attribution= 'Map tiles <a href="https://labs.strava.com/heatmap">Strava 2017</a>', name='Strava.Ride'), Run=dict( url= 'https://heatmap-external-a.strava.com//tiles/run/bluered/{z}/{x}/{y}.png?v=19', max_zoom=15, attribution= 'Map tiles by <a href="https://labs.strava.com/heatmap">Strava 2017</a>', name='Strava.Run'), Water=dict( url= 'https://heatmap-external-a.strava.com//tiles/water/blue/{z}/{x}/{y}.png?v=19', max_zoom=15, attribution= 'Map tiles by <a href="https://labs.strava.com/heatmap">Strava 2017</a>', name='Strava.Water'), Winter=dict( url= 'https://heatmap-external-a.strava.com//tiles/winter/hot/{z}/{x}/{y}.png?v=19', max_zoom=15, attribution= 'Map tiles by <a href="https://labs.strava.com/heatmap">Strava 2017</a>', name='Strava.Winter')), Stamen=Bunch( Terrain= dict(url='https://stamen-tiles-a.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png', attribution=''.join([ 'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, ', 'under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ', 'Data by <a href="http://openstreetmap.org/">OpenStreetMap</a>, ', 'under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.' ]), name='Stamen.Terrain', min_zoom=0, max_zoom=18), Toner=dict( url='https://stamen-tiles-a.a.ssl.fastly.net/toner/{z}/{x}/{y}.png', attribution =''.join([ 'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, ', 'under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ', 'Data by <a href="http://openstreetmap.org/">OpenStreetMap</a>, ', 'under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.' ]), name='Stamen.Toner', min_zoom=0, max_zoom=20), Watercolor=dict( url= 'https://stamen-tiles-a.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png', attribution=''.join([ 'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, ', 'under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ', 'Data by <a href="http://openstreetmap.org/">OpenStreetMap</a>, ', 'under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.' ]), name='Stamen.Watercolor', min_zoom=1, max_zoom=18)))
colormaps = Bunch( BrBG=0, PRGn=1, PiYG=2, PuOr=3, RdBu=4, RdGy=5, RdYlBu=6, RdYlGn=7, Spectral=8, BuGn=9, BuPu=10, GnBu=11, OrRd=12, PuBuGn=13, PuBu=14, PuRd=15, RdPu=16, YlGnBu=17, YlGn=18, YlOrBr=19, YlOrRd=20, Blues=21, Greens=22, Greys=23, Purples=24, Reds=25, Oranges=26, Cividis=27, CubehelixDefault=28, Rainbow=29, Warm=30, Cool=31, Sinebow=32, Turbo=33, Viridis=34, Magma=35, Inferno=36, Plasma=37 )
projections = Bunch( # Alaska Polar Stereographic (WGS84) EPSG5936=dict( name='EPSG5936', custom=True, proj4def="""+proj=stere +lat_0=90 +lat_ts=90 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs""", origin=[-2.8567784109255e+07, 3.2567784109255e+07], resolutions=[ 238810.813354, 119405.406677, 59702.7033384999, 29851.3516692501, 14925.675834625, 7462.83791731252, 3731.41895865639, 1865.70947932806, 932.854739664032, 466.427369832148, 233.213684916074, 116.60684245803701, 58.30342122888621, 29.151710614575396, 14.5758553072877, 7.28792765351156, 3.64396382688807, 1.82198191331174, 0.910990956788164, 0.45549547826179, 0.227747739130895, 0.113873869697739, 0.05693693484887, 0.028468467424435 ], bounds=[[-2623285.8808999992907047, -2623285.8808999992907047], [6623285.8803000003099442, 6623285.8803000003099442]]), # Polar Stereographic South (WGS84) EPSG3031=dict(name='EPSG3031', custom=True, proj4def="""+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs""", origin=[-3.06361E7, 3.0636099999999993E7], resolutions=[ 67733.46880027094, 33866.73440013547, 16933.367200067736, 8466.683600033868, 4233.341800016934, 2116.670900008467, 1058.3354500042335, 529.1677250021168, 264.5838625010584, ], bounds=[[-4524583.19363305, -4524449.487765655], [4524449.4877656475, 4524583.193633042]]))
projections = Bunch( EPSG3857=dict( name='EPSG3857', custom=False, ), Earth=dict(name='Earth', custom=False), EPSG3395=dict(name='EPSG3395', custom=False), EPSG4326=dict(name='EPSG4326', custom=False), Base=dict(name='Base', custom=False), Simple=dict(name='Simple', custom=False), EPSG3413=dict( name='EPSG3413', custom=True, proj4def= """+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs""", # origin and bounds for 500m resolution origin=[-4194304 / 2, 4194304 / 2], resolutions=[8192.0, 4096.0, 2048.0, 1024.0, 512.0, 256.0], bounds=[[-4194304 / 2, -4194304 / 2], [4194304 / 2, 4194304 / 2]]), EPSG3031=dict( name='EPSG3031', custom=True, proj4def= """+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs""", # origin and bounds for 500m resolution origin=[-4194304 / 2, 4194304 / 2], resolutions=[8192.0, 4096.0, 2048.0, 1024.0, 512.0, 256.0], bounds=[[-4194304 / 2, -4194304 / 2], [4194304 / 2, 4194304 / 2]]))