1
0
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:
swamper123
2020-07-24 20:22:02 +02:00
committed by GitHub
parent 8b9670a5dd
commit e316e7ccfe
9 changed files with 7 additions and 9 deletions

2
.gitignore vendored
View File

@@ -13,9 +13,7 @@ dist
t.py
tmp
old
dist
*.egg-info
*.swp
newdocs
examples/history.db
*.sql

View File

@@ -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

View File

@@ -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

View 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

View File

@@ -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

View File

@@ -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):

View 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)

View File

@@ -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)}")

View File

@@ -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()