How to use pygeodiff - 10 common examples

To help you get started, we’ve selected a few pygeodiff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def __init__(self, name):
        if name is None:
            self.libname = self.package_libname()
            if not os.path.exists(self.libname):
                # not found, try system library
                self.libname = find_library("geodiff")
        else:
            self.libname = name

        if self.libname is None:
            raise GeoDiffLibVersionError("Unable to locate GeoDiff library, tried " + self.package_libname() + " and geodiff on system.")

        self.lib = ctypes.CDLL(self.libname, use_errno=True)
        self.init()
        self.check_version()
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def has_changes(self, changeset):
        func = self.lib.GEODIFF_hasChanges
        func.argtypes = [ctypes.c_char_p]
        func.restype = ctypes.c_int

        # create byte objects from the strings
        b_string1 = changeset.encode('utf-8')

        nchanges = func(b_string1)
        if nchanges < 0:
            raise GeoDiffLibError("has_changes")
        return nchanges == 1
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def _parse_return_code(rc, msg):
    if rc == SUCCESS:
        return
    elif rc == ERROR:
        raise GeoDiffLibError(msg)
    elif rc == CONFLICT:
        raise GeoDiffLibConflictError(msg)
    elif rc == UNSUPPORTED_CHANGE:
        raise GeoDiffLibUnsupportedChangeError(msg)
    else:
        raise GeoDiffLibVersionError("Internal error (enum " + str(rc) + " not handled)")
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
:copyright: (c) 2019 Peter Petrik
    :license: MIT, see LICENSE for more details.
'''

import ctypes
import os
import platform
from ctypes.util import find_library
from .__about__ import __version__


class GeoDiffLibError(Exception):
    pass


class GeoDiffLibConflictError(GeoDiffLibError):
    pass

class GeoDiffLibUnsupportedChangeError(GeoDiffLibError):
    pass

class GeoDiffLibVersionError(GeoDiffLibError):
    pass


# keep in sync with c-library
SUCCESS=0
ERROR=1
CONFLICT=2
UNSUPPORTED_CHANGE=3

def _parse_return_code(rc, msg):
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
import ctypes
import os
import platform
from ctypes.util import find_library
from .__about__ import __version__


class GeoDiffLibError(Exception):
    pass


class GeoDiffLibConflictError(GeoDiffLibError):
    pass

class GeoDiffLibUnsupportedChangeError(GeoDiffLibError):
    pass

class GeoDiffLibVersionError(GeoDiffLibError):
    pass


# keep in sync with c-library
SUCCESS=0
ERROR=1
CONFLICT=2
UNSUPPORTED_CHANGE=3

def _parse_return_code(rc, msg):
    if rc == SUCCESS:
        return
    elif rc == ERROR:
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
import platform
from ctypes.util import find_library
from .__about__ import __version__


class GeoDiffLibError(Exception):
    pass


class GeoDiffLibConflictError(GeoDiffLibError):
    pass

class GeoDiffLibUnsupportedChangeError(GeoDiffLibError):
    pass

class GeoDiffLibVersionError(GeoDiffLibError):
    pass


# keep in sync with c-library
SUCCESS=0
ERROR=1
CONFLICT=2
UNSUPPORTED_CHANGE=3

def _parse_return_code(rc, msg):
    if rc == SUCCESS:
        return
    elif rc == ERROR:
        raise GeoDiffLibError(msg)
    elif rc == CONFLICT:
        raise GeoDiffLibConflictError(msg)
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def _parse_return_code(rc, msg):
    if rc == SUCCESS:
        return
    elif rc == ERROR:
        raise GeoDiffLibError(msg)
    elif rc == CONFLICT:
        raise GeoDiffLibConflictError(msg)
    elif rc == UNSUPPORTED_CHANGE:
        raise GeoDiffLibUnsupportedChangeError(msg)
    else:
        raise GeoDiffLibVersionError("Internal error (enum " + str(rc) + " not handled)")
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def check_version(self):
        cversion = self.version()
        pyversion = __version__
        if cversion != pyversion:
            raise GeoDiffLibVersionError("version mismatch (%s C vs %s PY)".format(cversion, pyversion))
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def _parse_return_code(rc, msg):
    if rc == SUCCESS:
        return
    elif rc == ERROR:
        raise GeoDiffLibError(msg)
    elif rc == CONFLICT:
        raise GeoDiffLibConflictError(msg)
    elif rc == UNSUPPORTED_CHANGE:
        raise GeoDiffLibUnsupportedChangeError(msg)
    else:
        raise GeoDiffLibVersionError("Internal error (enum " + str(rc) + " not handled)")
github lutraconsulting / geodiff / pygeodiff / geodifflib.py View on Github external
def _parse_return_code(rc, msg):
    if rc == SUCCESS:
        return
    elif rc == ERROR:
        raise GeoDiffLibError(msg)
    elif rc == CONFLICT:
        raise GeoDiffLibConflictError(msg)
    elif rc == UNSUPPORTED_CHANGE:
        raise GeoDiffLibUnsupportedChangeError(msg)
    else:
        raise GeoDiffLibVersionError("Internal error (enum " + str(rc) + " not handled)")