Skip to content

Commit

Permalink
Rename async.py to async_.py for Python 3.7 compatibility (#372)
Browse files Browse the repository at this point in the history
async became a reserved keyword in Python 3.7.
  • Loading branch information
sebastic authored and olt committed Jul 23, 2018
1 parent f8c32bf commit ee5c958
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions mapproxy/cache/s3.py
Expand Up @@ -22,7 +22,7 @@
from mapproxy.image import ImageSource
from mapproxy.cache import path
from mapproxy.cache.base import tile_buffer, TileCacheBase
from mapproxy.util import async
from mapproxy.util import async_
from mapproxy.util.py import reraise_exception

try:
Expand Down Expand Up @@ -115,7 +115,7 @@ def is_cached(self, tile):
return True

def load_tiles(self, tiles, with_metadata=True):
p = async.Pool(min(4, len(tiles)))
p = async_.Pool(min(4, len(tiles)))
return all(p.map(self.load_tile, tiles))

def load_tile(self, tile, with_metadata=True):
Expand Down Expand Up @@ -143,7 +143,7 @@ def remove_tile(self, tile):
self.conn().delete_object(Bucket=self.bucket_name, Key=key)

def store_tiles(self, tiles):
p = async.Pool(min(self._concurrent_writer, len(tiles)))
p = async_.Pool(min(self._concurrent_writer, len(tiles)))
p.map(self.store_tile, tiles)

def store_tile(self, tile):
Expand Down
8 changes: 4 additions & 4 deletions mapproxy/cache/tile.py
Expand Up @@ -42,7 +42,7 @@
from mapproxy.image.merge import merge_images
from mapproxy.image.tile import TileSplitter
from mapproxy.layer import MapQuery, BlankImage
from mapproxy.util import async
from mapproxy.util import async_
from mapproxy.util.py import reraise

class TileManager(object):
Expand Down Expand Up @@ -250,7 +250,7 @@ def _create_single_tiles(self, tiles):

def _create_threaded(self, create_func, tiles):
result = []
async_pool = async.Pool(self.tile_mgr.concurrent_tile_creators)
async_pool = async_.Pool(self.tile_mgr.concurrent_tile_creators)
for new_tiles in async_pool.imap(create_func, tiles):
result.extend(new_tiles)
return result
Expand Down Expand Up @@ -303,7 +303,7 @@ def get_map_from_source(source):
return (img, source.coverage)

layers = []
for layer in async.imap(get_map_from_source, self.sources):
for layer in async_.imap(get_map_from_source, self.sources):
if layer[0] is not None:
layers.append(layer)

Expand Down Expand Up @@ -358,7 +358,7 @@ def _create_bulk_meta_tile(self, meta_tile):
main_tile = Tile(meta_tile.main_tile_coord)
with self.tile_mgr.lock(main_tile):
if not all(self.is_cached(t) for t in meta_tile.tiles if t is not None):
async_pool = async.Pool(self.tile_mgr.concurrent_tile_creators)
async_pool = async_.Pool(self.tile_mgr.concurrent_tile_creators)
def query_tile(coord):
try:
query = MapQuery(self.grid.tile_bbox(coord), tile_size, self.grid.srs, self.tile_mgr.request_format,
Expand Down
2 changes: 1 addition & 1 deletion mapproxy/client/cgi.py
Expand Up @@ -26,7 +26,7 @@
from mapproxy.image import ImageSource
from mapproxy.client.http import HTTPClientError
from mapproxy.client.log import log_request
from mapproxy.util.async import import_module
from mapproxy.util.async_ import import_module
from mapproxy.compat.modules import urlparse
from mapproxy.compat import BytesIO

Expand Down
4 changes: 2 additions & 2 deletions mapproxy/service/wms.py
Expand Up @@ -34,7 +34,7 @@
from mapproxy.image.message import attribution_image, message_image
from mapproxy.layer import BlankImage, MapQuery, InfoQuery, LegendQuery, MapError, LimitedLayer
from mapproxy.layer import MapBBOXError, merge_layer_extents, merge_layer_res_ranges
from mapproxy.util import async
from mapproxy.util import async_
from mapproxy.util.py import cached_property, reraise
from mapproxy.util.coverage import load_limited_to
from mapproxy.util.ext.odict import odict
Expand Down Expand Up @@ -582,7 +582,7 @@ def render(self, layer_merger):
render_layers = combined_layers(self.layers, self.query)
if not render_layers: return

async_pool = async.Pool(size=min(len(render_layers), self.concurrent_rendering))
async_pool = async_.Pool(size=min(len(render_layers), self.concurrent_rendering))

if self.raise_source_errors:
return self._render_raise_exceptions(async_pool, render_layers, layer_merger)
Expand Down
2 changes: 1 addition & 1 deletion mapproxy/source/mapnik.py
Expand Up @@ -26,7 +26,7 @@
from mapproxy.source import SourceError
from mapproxy.client.log import log_request
from mapproxy.util.py import reraise_exception
from mapproxy.util.async import run_non_blocking
from mapproxy.util.async_ import run_non_blocking
from mapproxy.compat import BytesIO

try:
Expand Down
4 changes: 2 additions & 2 deletions mapproxy/test/unit/test_async.py
Expand Up @@ -20,7 +20,7 @@

import pytest

from mapproxy.util.async import imap_async_threaded, ThreadPool
from mapproxy.util.async_ import imap_async_threaded, ThreadPool


class TestThreaded(object):
Expand Down Expand Up @@ -50,7 +50,7 @@ def func(x):

try:
import eventlet
from mapproxy.util.async import imap_async_eventlet, EventletPool
from mapproxy.util.async_ import imap_async_eventlet, EventletPool
_has_eventlet = True
except ImportError:
_has_eventlet = False
Expand Down
File renamed without changes.

0 comments on commit ee5c958

Please sign in to comment.