mirror of
https://github.com/FreeOpcUa/opcua-asyncio
synced 2025-10-29 17:07:18 +08:00
Fix smaller issues (#244)
* remove redundant parenthese Add pretty argument to docstrings Fix warning in Travis tests about invalid escape sequences Add new line to be PEP8 conform Remove unused import Remove doubled expressions * Convert strings to tuples
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,9 +13,7 @@ dist
|
||||
t.py
|
||||
tmp
|
||||
old
|
||||
dist
|
||||
*.egg-info
|
||||
*.swp
|
||||
newdocs
|
||||
examples/history.db
|
||||
*.sql
|
||||
|
||||
@@ -26,7 +26,7 @@ def _to_camel_case(name):
|
||||
turtle_actionlib/ShapeActionFeedback -> TurtleActionlibShapeActionFeedback
|
||||
"""
|
||||
name = re.sub(r'[^a-zA-Z0-9]+', ' ', name)
|
||||
name = re.sub('(^|\s)(\S)', _repl_func, name)
|
||||
name = re.sub(r'(^|\s)(\S)', _repl_func, name)
|
||||
name = name.replace(' ', '')
|
||||
return name
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class XmlExporter:
|
||||
Write the XML etree in the exporter object to a file
|
||||
Args:
|
||||
xmlpath: string representing the path/file name
|
||||
|
||||
pretty: add spaces and newlines, to be more readable
|
||||
Returns:
|
||||
"""
|
||||
# try to write the XML etree to a file
|
||||
|
||||
@@ -567,7 +567,7 @@ class LocalizedText(FrozenClass):
|
||||
|
||||
@staticmethod
|
||||
def from_string(string):
|
||||
m = re.match("^LocalizedText\(Encoding:(.*), Locale:(.*), Text:(.*)\)$", string)
|
||||
m = re.match(r"^LocalizedText\(Encoding:(.*), Locale:(.*), Text:(.*)\)$", string)
|
||||
if m:
|
||||
text = m.group(3) if m.group(3) != str(None) else None
|
||||
locale = m.group(2) if m.group(2) != str(None) else None
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shlex
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
|
||||
@@ -7,6 +7,7 @@ import datetime
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
class EventsCodeGenerator:
|
||||
|
||||
def __init__(self, event_model, output_file):
|
||||
|
||||
@@ -448,7 +448,7 @@ def add_basetype_members(model):
|
||||
emptystruct = False
|
||||
if len(struct.fields) == 0:
|
||||
emptystruct = True
|
||||
if struct.basetype in ('ExtensionObject'):
|
||||
if struct.basetype in ('ExtensionObject',):
|
||||
struct.basetype = None
|
||||
continue
|
||||
base = model.get_struct(struct.basetype)
|
||||
|
||||
@@ -151,7 +151,7 @@ class CodeGenerator:
|
||||
self.write("self.Encoding = 1")
|
||||
elif field.uatype == obj.name: # help!!! selv referencing class
|
||||
self.write("self.{} = None".format(field.name))
|
||||
elif not obj.name in ("ExtensionObject") and field.name == "TypeId": # and ( obj.name.endswith("Request") or obj.name.endswith("Response")):
|
||||
elif not obj.name in ("ExtensionObject",) and field.name == "TypeId": # and ( obj.name.endswith("Request") or obj.name.endswith("Response")):
|
||||
self.write(f"self.TypeId = FourByteNodeId(ObjectIds.{obj.name}_Encoding_DefaultBinary)")
|
||||
else:
|
||||
self.write(f"self.{field.name} = {'[]' if field.length else self.get_default_value(field)}")
|
||||
|
||||
@@ -77,7 +77,7 @@ def test_sync_server_get_node(server):
|
||||
assert isinstance(nodes[0], Node)
|
||||
|
||||
|
||||
class MySubHandler():
|
||||
class MySubHandler:
|
||||
|
||||
def __init__(self):
|
||||
self.future = Future()
|
||||
|
||||
Reference in New Issue
Block a user