Skip to content

Commit

Permalink
Merge pull request #690 from Hugovdberg/release/v0.10.5
Browse files Browse the repository at this point in the history
Release/v0.10.5
  • Loading branch information
Hugovdberg authored Feb 4, 2023
2 parents c8b5506 + 2df18a7 commit 0fae26d
Show file tree
Hide file tree
Showing 11 changed files with 642 additions and 356 deletions.
1 change: 1 addition & 0 deletions PIconnect/AFSDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __fallback():
if (
os.getenv("GITHUB_ACTIONS", "false").lower() == "true"
or os.getenv("TF_BUILD", "false").lower() == "true"
or os.getenv("READTHEDOCS", "false").lower() == "true"
):
_af, _AF_SDK_version = __fallback()
else:
Expand Down
1 change: 0 additions & 1 deletion PIconnect/PI.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def _lookup_servers() -> Dict[str, AF.PI.PIServer]:


def _lookup_default_server() -> Optional[AF.PI.PIServer]:

default_server = None
try:
default_server = AF.PI.PIServers().DefaultPIServer
Expand Down
25 changes: 24 additions & 1 deletion PIconnect/PIAF.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""
import dataclasses
import warnings
from typing import Any, Dict, Optional, Union, cast
from typing import Any, Dict, Optional, Union, cast, List

from PIconnect import AF, PIAFBase, PIConsts, _time
from PIconnect._utils import InitialisationWarning
from PIconnect import PIAFAttribute


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -150,6 +151,28 @@ def descendant(self, path: str) -> "PIAFElement":
"""Return a descendant of the database from an exact path."""
return PIAFElement(self.database.Elements.get_Item(path))

def search(self, query: Union[str, List[str]]) -> "PIAFAttribute":
"""return a list of PIAFAttributes directly from a list of element|attribute path strings
like this:
list("BaseElement/childElement/childElement|Attribute|ChildAttribute|ChildAttribute",
"BaseElement/childElement/childElement|Attribute|ChildAttribute|ChildAttribute")
"""
attributelist = []
if isinstance(query, List):
return [y for x in query for y in self.search(x)]
if "|" in query:
splitpath = query.split("|")
elem = self.descendant(splitpath[0])
attribute = elem.attributes[splitpath[1]]
if len(splitpath) > 2:
for x in range(len(splitpath) - 2):
attribute = attribute.children[splitpath[x + 2]]
attributelist.append(attribute)
return attributelist

def event_frames(
self,
start_time: _time.TimeLike = "",
Expand Down
2 changes: 1 addition & 1 deletion PIconnect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# pragma pylint: enable=unused-import

__version__ = "0.10.4"
__version__ = "0.10.5"
__sdk_version = tuple(int(x) for x in AF.PISystems().Version.split("."))

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pandas = "*"
pytz = "*"
wrapt = "*"
pythonnet = "*"
piconnect = {editable = true,path = "."}
piconnect = {editable = true, path = "."}

[dev-packages]
black = "*"
Expand Down
648 changes: 393 additions & 255 deletions Pipfile.lock

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docs/tutorials/piaf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@ the latter element could be accessed directly as follows:
use either raw strings (using the `r` prefix, as in the example
above) or escape each backslash as `\\\\\\\\`.

.. _finding_attributes:

************************************
Searching attributes based on full path
************************************

To get the direct attribute based on the entire element/attributes path
you can use the :any:`PIAFDatabase.search` method. You can provide a single string or list of strings with
the full path and returns a list of attribute objects.

.. code-block:: python
import PIconnect as PI
with PI.PIAFDatabase() as database:
attributes = database.search([r"Plant1\Outlet|Flow|PV", r"Plant1\Outlet|Flow|SP"])
.. note:: Elements in the hierarchy are separated by a single backslash `\\`,
use either raw strings (using the `r` prefix, as in the example
above) or escape each backslash as `\\\\\\\\`.

.. _connect_piaf_database:

****************************************
Expand Down
36 changes: 24 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
-i https://pypi.org/simple
cffi==1.15.1
clr-loader==0.2.4 ; python_version >= '3.7'
numpy==1.24.0rc2 ; python_version >= '3.10'
pandas==1.5.2
-e .
pycparser==2.21
python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pythonnet==3.0.1
pytz==2022.6
six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
wrapt==1.14.1
-i https://pypi.org/simple

cffi==1.15.1

clr-loader==0.2.5 ; python_version >= '3.7'

numpy==1.24.1 ; python_version >= '3.10'

pandas==1.5.2

-e .

pycparser==2.21

python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

pythonnet==3.0.1

pytz==2022.7.1

six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

wrapt==1.14.1

242 changes: 162 additions & 80 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,80 +1,162 @@
-i https://pypi.org/simple
alabaster==0.7.12
astroid==2.11.7 ; python_full_version >= '3.6.2'
attrs==22.1.0 ; python_version >= '3.5'
babel==2.11.0 ; python_version >= '3.6'
black==22.12.0
bleach==5.0.1 ; python_version >= '3.7'
certifi==2022.12.7 ; python_version >= '3.6'
charset-normalizer==2.1.1 ; python_full_version >= '3.6.0'
click==8.1.3 ; python_version >= '3.7'
codacy-coverage==1.3.11
codecov==2.1.12
colorama==0.4.6 ; sys_platform == 'win32'
commonmark==0.9.1
coverage==7.0.0b1
dill==0.3.6 ; python_version >= '3.7'
doc8==1.0.0
docutils==0.19 ; python_version >= '3.7'
exceptiongroup==1.0.4 ; python_version < '3.11'
flake8==6.0.0
idna==3.4 ; python_version >= '3.5'
imagesize==1.4.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
importlib-metadata==5.1.0 ; python_version >= '3.7'
iniconfig==1.1.1
isort==5.11.3 ; python_full_version >= '3.7.0'
jaraco.classes==3.2.3 ; python_version >= '3.7'
jinja2==3.1.2 ; python_version >= '3.7'
keyring==23.11.0 ; python_version >= '3.7'
lazy-object-proxy==1.8.0 ; python_version >= '3.7'
markupsafe==2.1.1 ; python_version >= '3.7'
mccabe==0.7.0 ; python_version >= '3.6'
more-itertools==9.0.0 ; python_version >= '3.7'
mypy-extensions==0.4.3
packaging==22.0 ; python_version >= '3.7'
pathspec==0.10.3 ; python_version >= '3.7'
pbr==5.11.0 ; python_version >= '2.6'
pkginfo==1.9.2 ; python_version >= '3.6'
platformdirs==2.6.0 ; python_version >= '3.7'
pluggy==1.0.0 ; python_version >= '3.6'
pycodestyle==2.10.0 ; python_version >= '3.6'
pyflakes==3.0.1 ; python_version >= '3.6'
pygments==2.13.0 ; python_version >= '3.6'
pylint==3.0.0a5
pytest==7.2.0
pytest-cov==4.0.0
pytz==2022.6
pywin32-ctypes==0.2.0 ; sys_platform == 'win32'
pyyaml==6.0
readme-renderer==37.3 ; python_version >= '3.7'
requests==2.28.1 ; python_version >= '3.7' and python_version < '4'
requests-toolbelt==0.10.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
restructuredtext-lint==1.4.0
rfc3986==2.0.0 ; python_version >= '3.7'
rich==12.6.0 ; python_full_version >= '3.6.3' and python_full_version < '4.0.0'
setuptools==65.6.3 ; python_version >= '3.7'
six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
snowballstemmer==2.2.0
sphinx==6.0.0b2
sphinxcontrib-applehelp==1.0.2 ; python_version >= '3.5'
sphinxcontrib-devhelp==1.0.2 ; python_version >= '3.5'
sphinxcontrib-htmlhelp==2.0.0 ; python_version >= '3.6'
sphinxcontrib-jsmath==1.0.1 ; python_version >= '3.5'
sphinxcontrib-qthelp==1.0.3 ; python_version >= '3.5'
sphinxcontrib-serializinghtml==1.1.5 ; python_version >= '3.5'
stevedore==4.1.1 ; python_version >= '3.8'
tomli==2.0.1 ; python_full_version < '3.11.0a7'
tomlkit==0.11.6 ; python_version >= '3.6'
twine==4.0.2
urllib3==1.26.13 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
webencodings==0.5.1
wrapt==1.14.1
zipp==3.11.0 ; python_version >= '3.7'
cffi==1.15.1
clr-loader==0.2.4 ; python_version >= '3.7'
numpy==1.24.0rc2 ; python_version >= '3.10'
pandas==1.5.2
-e .
pycparser==2.21
python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pythonnet==3.0.1
-i https://pypi.org/simple

alabaster==0.7.13 ; python_version >= '3.6'

astroid==2.11.7 ; python_full_version >= '3.6.2'

attrs==22.2.0 ; python_version >= '3.6'

babel==2.11.0 ; python_version >= '3.6'

black==23.1.0

bleach==6.0.0 ; python_version >= '3.7'

certifi==2022.12.7 ; python_version >= '3.6'

charset-normalizer==3.0.1 ; python_full_version >= '3.6.0'

click==8.1.3 ; python_version >= '3.7'

codacy-coverage==1.3.11

codecov==2.1.12

colorama==0.4.6 ; sys_platform == 'win32'

coverage==7.1.0

dill==0.3.6 ; python_version >= '3.7'

doc8==1.1.1

docutils==0.19 ; python_version >= '3.7'

exceptiongroup==1.1.0 ; python_version < '3.11'

flake8==6.0.0

idna==3.4 ; python_version >= '3.5'

imagesize==1.4.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

importlib-metadata==6.0.0 ; python_version >= '3.7'

iniconfig==2.0.0 ; python_version >= '3.7'

isort==5.12.0 ; python_full_version >= '3.8.0'

jaraco.classes==3.2.3 ; python_version >= '3.7'

jinja2==3.1.2 ; python_version >= '3.7'

keyring==23.13.1 ; python_version >= '3.7'

lazy-object-proxy==1.9.0 ; python_version >= '3.7'

markdown-it-py==2.1.0 ; python_version >= '3.7'

markupsafe==2.1.2 ; python_version >= '3.7'

mccabe==0.7.0 ; python_version >= '3.6'

mdurl==0.1.2 ; python_version >= '3.7'

more-itertools==9.0.0 ; python_version >= '3.7'

mypy-extensions==1.0.0 ; python_version >= '3.5'

packaging==23.0 ; python_version >= '3.7'

pathspec==0.11.0 ; python_version >= '3.7'

pbr==5.11.1 ; python_version >= '2.6'

pkginfo==1.9.6 ; python_version >= '3.6'

platformdirs==2.6.2 ; python_version >= '3.7'

pluggy==1.0.0 ; python_version >= '3.6'

pycodestyle==2.10.0 ; python_version >= '3.6'

pyflakes==3.0.1 ; python_version >= '3.6'

pygments==2.14.0 ; python_version >= '3.6'

pylint==3.0.0a5

pytest==7.2.1

pytest-cov==4.0.0

pytz==2022.7.1

pywin32-ctypes==0.2.0 ; sys_platform == 'win32'

pyyaml==6.0

readme-renderer==37.3 ; python_version >= '3.7'

requests==2.28.2 ; python_version >= '3.7' and python_version < '4'

requests-toolbelt==0.10.1 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

restructuredtext-lint==1.4.0

rfc3986==2.0.0 ; python_version >= '3.7'

rich==13.3.1 ; python_full_version >= '3.7.0'

setuptools==67.1.0 ; python_version >= '3.7'

six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

snowballstemmer==2.2.0

sphinx==6.1.3

sphinxcontrib-applehelp==1.0.4 ; python_version >= '3.8'

sphinxcontrib-devhelp==1.0.2 ; python_version >= '3.5'

sphinxcontrib-htmlhelp==2.0.1 ; python_version >= '3.8'

sphinxcontrib-jsmath==1.0.1 ; python_version >= '3.5'

sphinxcontrib-qthelp==1.0.3 ; python_version >= '3.5'

sphinxcontrib-serializinghtml==1.1.5 ; python_version >= '3.5'

stevedore==4.1.1 ; python_version >= '3.8'

tomli==2.0.1 ; python_version < '3.11'

tomlkit==0.11.6 ; python_version >= '3.6'

twine==4.0.2

urllib3==1.26.14 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'

webencodings==0.5.1

wrapt==1.14.1

zipp==3.12.0 ; python_version >= '3.7'

cffi==1.15.1

clr-loader==0.2.5 ; python_version >= '3.7'

numpy==1.24.1 ; python_version >= '3.10'

pandas==1.5.2

-e .

pycparser==2.21

python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

pythonnet==3.0.1

8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ packages =
PIconnect
PIconnect._typing
install_requires =
pandas
wrapt
pytz
pythonnet
pandas==1.5.2
wrapt==1.14.1
pytz==2022.7.1
pythonnet==3.0.1
python_requires = >= 3.8
include_package_data = True
zip_safe=False
Expand Down
Loading

0 comments on commit 0fae26d

Please sign in to comment.