Skip to content

Commit a692f06

Browse files
committed
Drop all the pdal.get* functions, define pdal.info as a SimpleNamespace instance
1 parent 56871ab commit a692f06

File tree

2 files changed

+17
-42
lines changed

2 files changed

+17
-42
lines changed

pdal/__init__.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
1-
from .libpdalpython import (
2-
getDebugInformation,
3-
getDimensions,
4-
getPluginInstallPath,
5-
getSha1,
6-
getVersionMajor,
7-
getVersionMinor,
8-
getVersionPatch,
9-
getVersionString,
10-
)
1+
from .libpdalpython import getDimensions, getInfo
112
from .pipeline import Pipeline
123

13-
144
__version__ = "2.4.2"
155

166
dimensions = getDimensions()
17-
del getDimensions
18-
19-
20-
class Info(object):
21-
version = getVersionString()
22-
major = getVersionMajor()
23-
minor = getVersionMinor()
24-
patch = getVersionPatch()
25-
debug = getDebugInformation()
26-
sha1 = getSha1()
27-
plugin = getPluginInstallPath()
28-
29-
30-
info = Info()
7+
info = getInfo()
8+
del getDimensions, getInfo

pdal/libpdalpython.pyx

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

44
from libcpp.vector cimport vector
55
from libcpp.string cimport string
6-
from libc.stdint cimport uint32_t, int64_t
6+
from libc.stdint cimport int64_t
77
from libcpp cimport bool
8-
from cpython.version cimport PY_MAJOR_VERSION
8+
from types import SimpleNamespace
99
cimport numpy as np
1010
np.import_array()
1111

12-
from cpython cimport PyObject, Py_INCREF
1312
from cython.operator cimport dereference as deref, preincrement as inc
1413

1514
cdef extern from "pdal/pdal_config.hpp" namespace "pdal::Config":
@@ -21,20 +20,18 @@ cdef extern from "pdal/pdal_config.hpp" namespace "pdal::Config":
2120
cdef string pluginInstallPath() except+
2221
cdef string versionString() except+
2322

24-
def getVersionString():
25-
return versionString()
26-
def getVersionMajor():
27-
return versionMajor()
28-
def getVersionMinor():
29-
return versionMinor()
30-
def getVersionPatch():
31-
return versionPatch()
32-
def getSha1():
33-
return sha1()
34-
def getDebugInformation():
35-
return debugInformation()
36-
def getPluginInstallPath():
37-
return pluginInstallPath()
23+
24+
def getInfo():
25+
return SimpleNamespace(
26+
version=versionString(),
27+
major=versionMajor(),
28+
minor=versionMinor(),
29+
patch=versionPatch(),
30+
debug=debugInformation(),
31+
sha1=sha1(),
32+
plugin=pluginInstallPath(),
33+
)
34+
3835

3936
cdef extern from "PyArray.hpp" namespace "pdal::python":
4037
cdef cppclass Array:

0 commit comments

Comments
 (0)