Skip to content

Commit dcefae4

Browse files
committed
Prepare for DSS C-API 0.10.6, new tests still pending
- Use DSS C-API 0.10.6a2 while testing - New DSS.Error.ExtendedErrors - New DSS.LegacyModels - Several new properties in PDElements (see dss-extensions/dss_capi#81) - Update validation to include new test files and disable ExtendedErrors (otherwise the behavior cannot be validated since the official OpenDSS will ignore some errors) - Use extensive error checks, covering most API calls (not only setters), closes #29
1 parent 53e207d commit dcefae4

101 files changed

Lines changed: 2804 additions & 3137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ matrix:
77
sudo: required
88
env:
99
- DOCKER_IMAGE=pmeira/manylinux_wheel_cmake_fpc
10-
- DSS_CAPI_TAG=0.10.5
10+
- DSS_CAPI_TAG=0.10.6a2
1111
- LINUX_X64=1
1212
- CONDA_SUBDIR=linux-64
1313
services:
@@ -32,7 +32,7 @@ matrix:
3232
sudo: required
3333
env:
3434
- DOCKER_IMAGE=pmeira/manylinux_wheel_cmake_fpc_i686
35-
- DSS_CAPI_TAG=0.10.5
35+
- DSS_CAPI_TAG=0.10.6a2
3636
- CONDA_SUBDIR=linux-32
3737
services:
3838
- docker
@@ -52,7 +52,7 @@ matrix:
5252
- name: "osx_x64"
5353
os: osx
5454
env:
55-
- DSS_CAPI_TAG=0.10.5
55+
- DSS_CAPI_TAG=0.10.6a2
5656
script:
5757
- export TRAVIS_TAG_DSS_PYTHON=$TRAVIS_TAG
5858
- export TRAVIS_TAG=

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ clone_folder: c:\projects\dss_python
55
cache:
66
- c:\projects\VCForPython27.msi
77
environment:
8-
DSS_CAPI_TAG: 0.10.5
8+
DSS_CAPI_TAG: 0.10.6a2
99
DSS_CAPI_PATH: c:\projects\dss_capi
1010
ANACONDA_API_TOKEN:
1111
secure: Pcm5IXFi4ZUsi1ue5QvPNASDo1Ns1REYbAwDJXRd3FRn2CfKbNPgnPda6fxoN6wG

dss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
from .v7 import *
77
from .patch_dss_com import patch_dss_com
88

9-
__version__ = '0.10.5'
9+
__version__ = '0.10.6a'

dss/_cffi_api_util.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,48 +340,48 @@ def __init__(self, api_util):
340340
@property
341341
def First(self):
342342
'''Sets the first object of this type active. Returns 0 if none.'''
343-
return self._Get_First()
343+
return self.CheckForError(self._Get_First())
344344

345345
@property
346346
def Next(self):
347347
'''(read-only) Sets next object of this type active. Returns 0 if no more.'''
348-
return self._Get_Next()
348+
return self.CheckForError(self._Get_Next())
349349

350350
@property
351351
def Count(self):
352352
'''Number of objects of this type'''
353-
return self._Get_Count()
353+
return self.CheckForError(self._Get_Count())
354354

355355
def __len__(self):
356-
return self._Get_Count()
356+
return self.CheckForError(self._Get_Count())
357357

358358
def __iter__(self):
359-
idx = self._Get_First()
359+
idx = self.CheckForError(self._Get_First())
360360
while idx != 0:
361361
yield self
362-
idx = self._Get_Next()
362+
idx = self.CheckForError(self._Get_Next())
363363

364364
@property
365365
def AllNames(self):
366366
'''Array of all names of this object type'''
367-
return self._get_string_array(self._Get_AllNames)
367+
return self.CheckForError(self._get_string_array(self._Get_AllNames))
368368

369369
@property
370370
def Name(self):
371371
'''Gets the current name or sets the active object of this type by name'''
372-
return self._get_string(self._Get_Name())
372+
return self._get_string(self.CheckForError(self._Get_Name()))
373373

374374
@Name.setter
375375
def Name(self, Value):
376376
if type(Value) is not bytes:
377377
Value = Value.encode(self._api_util.codec)
378378

379-
self.CheckForError(self._Set_Name(Value))
379+
self.CheckForError(self.CheckForError(self._Set_Name(Value)))
380380

381381
@property
382382
def idx(self):
383383
'''Gets the current index or sets the active object of this type by index'''
384-
return self._Get_idx()
384+
return self.CheckForError(self._Get_idx())
385385

386386
@idx.setter
387387
def idx(self, Value):

dss/dss_capi_gr/IActiveClass.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''
22
A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.
33
4-
Copyright (c) 2016-2019 Paulo Meira
4+
Copyright (c) 2016-2020 Paulo Meira
55
'''
66
from __future__ import absolute_import
77
from .._cffi_api_util import Base
@@ -19,20 +19,20 @@ class IActiveClass(Base):
1919
@property
2020
def ActiveClassName(self):
2121
'''(read-only) Returns name of active class.'''
22-
return self._get_string(self._lib.ActiveClass_Get_ActiveClassName())
22+
return self._get_string(self.CheckForError(self._lib.ActiveClass_Get_ActiveClassName()))
2323

2424
@property
2525
def AllNames(self):
2626
'''(read-only) Array of strings consisting of all element names in the active class.'''
27-
return self._get_string_array(self._lib.ActiveClass_Get_AllNames)
27+
return self.CheckForError(self._get_string_array(self._lib.ActiveClass_Get_AllNames))
2828

2929
@property
3030
def Count(self):
3131
'''(read-only) Number of elements in Active Class. Same as NumElements Property.'''
32-
return self._lib.ActiveClass_Get_Count()
32+
return self.CheckForError(self._lib.ActiveClass_Get_Count())
3333

3434
def __len__(self):
35-
return self._lib.ActiveClass_Get_Count()
35+
return self.CheckForError(self._lib.ActiveClass_Get_Count())
3636

3737
def __iter__(self):
3838
n = self.First
@@ -43,32 +43,31 @@ def __iter__(self):
4343
@property
4444
def First(self):
4545
'''(read-only) Sets first element in the active class to be the active DSS object. If object is a CktElement, ActiveCktELment also points to this element. Returns 0 if none.'''
46-
return self._lib.ActiveClass_Get_First()
46+
return self.CheckForError(self._lib.ActiveClass_Get_First())
4747

4848
@property
4949
def Name(self):
5050
'''Name of the Active Element of the Active Class'''
51-
return self._get_string(self._lib.ActiveClass_Get_Name())
51+
return self._get_string(self.CheckForError(self._lib.ActiveClass_Get_Name()))
5252

5353
@Name.setter
5454
def Name(self, Value):
5555
if type(Value) is not bytes:
5656
Value = Value.encode(self._api_util.codec)
5757

58-
self._lib.ActiveClass_Set_Name(Value)
59-
self.CheckForError()
58+
self.CheckForError(self._lib.ActiveClass_Set_Name(Value))
6059

6160
@property
6261
def Next(self):
6362
'''(read-only) Sets next element in active class to be the active DSS object. If object is a CktElement, ActiveCktElement also points to this element. Returns 0 if no more.'''
64-
return self._lib.ActiveClass_Get_Next()
63+
return self.CheckForError(self._lib.ActiveClass_Get_Next())
6564

6665
@property
6766
def NumElements(self):
6867
'''(read-only) Number of elements in this class. Same as Count property.'''
69-
return self._lib.ActiveClass_Get_NumElements()
68+
return self.CheckForError(self._lib.ActiveClass_Get_NumElements())
7069

7170
@property
7271
def ActiveClassParent(self):
7372
'''Get the name of the parent class of the active class'''
74-
return self._get_string(self._lib.ActiveClass_Get_ActiveClassParent())
73+
return self._get_string(self.CheckForError(self._lib.ActiveClass_Get_ActiveClassParent()))

0 commit comments

Comments
 (0)