Skip to content

Commit

Permalink
shape: Fixed buffer usage for Python 3.x
Browse files Browse the repository at this point in the history
This is theoretically irrelevant since shapely is not yet compatible
with Python 3.x, but flake8 is complaining on Python 3.x that buffer is
not defined.
  • Loading branch information
Turbo87 committed Apr 1, 2013
1 parent 7b1050b commit bdf9b78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions geoalchemy2/shape.py
Expand Up @@ -2,11 +2,17 @@
This module provides utility functions for integrating with Shapely.
"""

import sys

import shapely.wkb
import shapely.wkt

from .elements import WKBElement, WKTElement

# Backwards compatibility for Python 3.x
if sys.version_info[0] != 2:
buffer = memoryview


def to_shape(element):
"""
Expand Down
6 changes: 6 additions & 0 deletions geoalchemy2/tests/test_shape.py
@@ -1,6 +1,12 @@
import sys

from nose.tools import ok_, eq_
from nose.plugins.skip import SkipTest

# Backwards compatibility for Python 3.x
if sys.version_info[0] != 2:
buffer = memoryview


def test_to_shape_WKBElement():
from geoalchemy2.elements import WKBElement
Expand Down

0 comments on commit bdf9b78

Please sign in to comment.