Skip to content

Commit

Permalink
add verbose argument to arctern.version (#639)
Browse files Browse the repository at this point in the history
* add verbose argument to arctern.version

* [skip ci] add doc string for arctern.version

* [skip ci] add doc string for arctern.version

* add verbose argument to arctern_pyspark.version
  • Loading branch information
longjiquan authored May 25, 2020
1 parent 32697b2 commit 69f7c35
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cpp/src/gis/gis_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ std::shared_ptr<arrow::Array> ST_Envelope_Aggr(
/*************************** AGGREGATE FUNCTIONS ***************************/

std::string GIS_Version() {
const std::string info = "gis version : " + std::string(LIB_VERSION) + "\n" +
const std::string info = "version : " + std::string(LIB_VERSION) + "\n" +
#ifdef USE_GPU
"build type : " + CMAKE_BUILD_TYPE + "/GPU \n" +
#else
Expand Down
16 changes: 13 additions & 3 deletions python/arctern/_wrapper_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,8 +1533,18 @@ def fishnet_map_layer(vega, points, weights, transform=True):
rs = arctern_core_.fishnet_map(vega_string, geos_rs, weights_rs)
return base64.b64encode(rs.buffers()[1].to_pybytes())

def version():
def version(verbose=False):
"""
:return: version of arctern
Return the information of arctern version.
:type verbose: bool
:param verbose: whether to get other information besides version
:rtype: str
:return: Information of arctern version.
"""
return arctern_core_.GIS_Version().decode("utf-8")
full_version_info = arctern_core_.GIS_Version().decode("utf-8")
if verbose:
return full_version_info
only_versin_info = full_version_info.split("\n")[0]
return only_versin_info
12 changes: 9 additions & 3 deletions spark/pyspark/arctern_pyspark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
from .gis_func import *
from .plot import plot

def version():
def version(verbose=False):
"""
:return: version of arctern_pyspark
Return the information of arctern_pyspark version.
:type verbose: bool
:param verbose: whether to get other information besides version
:rtype: str
:return: Information of arctern_pyspark version.
"""
import arctern
return arctern.version()
return arctern.version(verbose)

0 comments on commit 69f7c35

Please sign in to comment.