Skip to content

Commit

Permalink
Merge pull request #35 from PrediktorAS/feature/set-classmethods-for-…
Browse files Browse the repository at this point in the history
…uagraph

Refactor the UAGraph class
  • Loading branch information
DawidMakar-acaisoft authored Dec 21, 2023
2 parents c839cfc + 8496059 commit 5947910
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions opcua_tools/ua_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def __init__(
)
self.namespaces = namespaces

@staticmethod
@classmethod
def from_path(
path: str, namespace_dict: Optional[Dict[int, str]] = None
cls, path: str, namespace_dict: Optional[Dict[int, str]] = None
) -> "UAGraph":
if namespace_dict:
namespace_list = []
Expand All @@ -56,7 +56,7 @@ def from_path(
else:
parse_dict = parse_xml_dir(path)

ua_graph = UAGraph(
ua_graph = cls(
nodes=parse_dict["nodes"],
references=parse_dict["references"],
namespaces=parse_dict["namespaces"],
Expand All @@ -66,10 +66,10 @@ def from_path(

return ua_graph

@staticmethod
def from_file_list(file_list: List[str]) -> "UAGraph":
@classmethod
def from_file_list(cls, file_list: List[str]) -> "UAGraph":
parse_dict = parse_xml_files(file_list)
return UAGraph(
return cls(
nodes=parse_dict["nodes"],
references=parse_dict["references"],
namespaces=parse_dict["namespaces"],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name="opcua-tools",
version="1.1.2",
version="1.2.0",
description="OPCUA Tools for Python using Pandas DataFrames",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 5947910

Please sign in to comment.