Skip to content

Commit d5bacbc

Browse files
kbrix2000oroulet
authored andcommitted
Fix some more typos.
1 parent 888462e commit d5bacbc

32 files changed

+105
-106
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async with Client(url='opc.tcp://localhost:4840/freeopcua/server/') as client:
5353
value = await node.read_value()
5454
```
5555

56-
Of course you can also call the `connect`, `disconnect` methods yourself if you do not want to use the context manager.
56+
Of course, you can also call the `connect`, `disconnect` methods yourself if you do not want to use the context manager.
5757

5858
See the example folder and the code for more information on the client API.
5959

asyncua/client/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def set_password(self, pwd: str):
123123

124124
def set_locale(self, locale: List[str]) -> None:
125125
"""
126-
Sets the prefred locales of the client, the server chooses which locale he can provide.
127-
Normaly the first matching locale in the list will be chossen, by the server.
126+
Sets the preferred locales of the client, the server chooses which locale he can provide.
127+
Normally the first matching locale in the list will be chosen, by the server.
128128
Call this before connect()
129129
"""
130130
self._locale = locale
@@ -390,7 +390,7 @@ async def find_servers_on_network(self):
390390
async def create_session(self):
391391
"""
392392
send a CreateSessionRequest to server with reasonable parameters.
393-
If you want o modify settings look at code of this methods
393+
If you want to modify settings look at code of these methods
394394
and make your own
395395
"""
396396
self._closing = False
@@ -467,8 +467,8 @@ async def _monitor_server_loop(self):
467467
async def _renew_channel_loop(self):
468468
"""
469469
Renew the SecureChannel before the SecureChannelTimeout will happen.
470-
In theory we could do that only if no session activity
471-
but it does not cost much..
470+
In theory, we could do that only if no session activity,
471+
but it does not cost much.
472472
"""
473473
try:
474474
# Part4 5.5.2.1:

asyncua/client/ua_client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, timeout: float = 1, security_policy: ua.SecurityPolicy = ua.S
4747
# needed to pass params from asynchronous request to synchronous data receive callback, as well as
4848
# passing back the processed response to the request so that it can return it.
4949
self._open_secure_channel_exchange: Union[ua.OpenSecureChannelResponse, ua.OpenSecureChannelParameters, None] = None
50-
# Hook for upperlayer tasks before a request is send (optional)
50+
# Hook for upper layer tasks before a request is sent (optional)
5151
self.pre_request_hook: Optional[Callable[[], Awaitable[None]]] = None
5252

5353
def connection_made(self, transport: asyncio.Transport): # type: ignore
@@ -153,8 +153,8 @@ async def send_request(self, request, timeout: Optional[float] = None, message_t
153153
"""
154154
timeout = self.timeout if timeout is None else timeout
155155
if self.pre_request_hook:
156-
# This will propagade exceptions from background tasks to the libary user before calling a request which will
157-
# timeout then.
156+
# This will propagate exceptions from background tasks to the library user before calling a request which will
157+
# time out then.
158158
await self.pre_request_hook()
159159
try:
160160
data = await asyncio.wait_for(self._send_request(request, timeout, message_type), timeout if timeout else None)
@@ -230,7 +230,7 @@ async def open_secure_channel(self, params):
230230
async def close_secure_channel(self):
231231
"""
232232
Close secure channel.
233-
It seems to trigger a shutdown of socket in most servers, so be prepare to reconnect.
233+
It seems to trigger a shutdown of socket in most servers, so be prepared to reconnect.
234234
OPC UA specs Part 6, 7.1.4 say that Server does not send a CloseSecureChannel response
235235
and should just close socket.
236236
"""
@@ -310,7 +310,7 @@ async def open_secure_channel(self, params):
310310
async def close_secure_channel(self):
311311
"""
312312
close secure channel. It seems to trigger a shutdown of socket
313-
in most servers, so be prepare to reconnect
313+
in most servers, so be prepared to reconnect
314314
"""
315315
if not self.protocol or self.protocol.state == UASocketProtocol.CLOSED:
316316
self.logger.warning("close_secure_channel was called but connection is closed")
@@ -485,7 +485,7 @@ async def create_subscription(
485485
response.Parameters.SubscriptionId
486486
)
487487
if not self._publish_task or self._publish_task.done():
488-
# Start the publish loop if it is not yet running
488+
# Start the publishing loop if it is not yet running
489489
# The current strategy is to have only one open publish request per UaClient. This might not be enough
490490
# in high latency networks or in case many subscriptions are created. A Set of Tasks of `_publish_loop`
491491
# could be used if necessary.
@@ -494,7 +494,7 @@ async def create_subscription(
494494

495495
async def inform_subscriptions(self, status: ua.StatusCode):
496496
"""
497-
Inform all current subscriptions with a status code. This calls the handlers status_change_notification
497+
Inform all current subscriptions with a status code. This calls the handler's status_change_notification
498498
"""
499499
status_message = ua.StatusChangeNotification(Status=status)
500500
notification_message = ua.NotificationMessage(NotificationData=[status_message])
@@ -570,7 +570,7 @@ async def _publish_loop(self):
570570
continue
571571
except BadNoSubscription: # See Spec. Part 5, 13.8.1
572572
# BadNoSubscription is expected to be received after deleting the last subscription.
573-
# We use this as a signal to exit this task and stop sending PublishRequests. This is easier then
573+
# We use this as a signal to exit this task and stop sending PublishRequests. This is easier than
574574
# checking if there are no more subscriptions registered in this client (). A Publish response
575575
# could still arrive before the DeleteSubscription response.
576576
#
@@ -780,6 +780,6 @@ async def set_publishing_mode(self, params) -> ua.uatypes.StatusCode:
780780
return response.Parameters.Results
781781

782782
async def transfer_subscriptions(self, params: ua.TransferSubscriptionsParameters) -> List[ua.TransferResult]:
783-
# Subscriptions aren't bound to a Session and can be transfered!
783+
# Subscriptions aren't bound to a Session and can be transferred!
784784
# https://reference.opcfoundation.org/Core/Part4/v104/5.13.7/
785785
raise NotImplementedError

asyncua/client/ua_file_transfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ async def write(self, data: bytes) -> None:
8989
It is server-dependent whether the written data are persistently
9090
stored if the session is ended without calling the Close Method with the fileHandle.
9191
Writing an empty or null ByteString returns a Good result code without any
92-
affect on the file.
92+
effect on the file.
9393
"""
9494
_logger.debug("Request to write to file %s", self._file_node)
9595
if self._write_node is None:

asyncua/common/statemachine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, id, name: str=None, number: int=None, node: Optional[Node]=No
4848

4949
class Transition:
5050
'''
51-
Helperclass for Transitions (TransitionVariableType)
51+
Helper class for Transitions (TransitionVariableType)
5252
https://reference.opcfoundation.org/v104/Core/docs/Part5/B.4.4/
5353
name: type string will be converted automatically to qualifiedname
5454
-> Name is a QualifiedName which uniquely identifies a transition within the StateMachineType.
@@ -57,7 +57,7 @@ class Transition:
5757
transitiontime: TransitionTime specifies when the transition occurred.
5858
effectivetransitiontime: EffectiveTransitionTime specifies the time when the current state or one of its substates was entered.
5959
If, for example, a StateA is active and – while active – switches several times between its substates SubA and SubB,
60-
then the TransitionTime stays at the point in time where StateA became active whereas the EffectiveTransitionTime changes
60+
then the TransitionTime stays at the point in time when StateA became active whereas the EffectiveTransitionTime changes
6161
with each change of a substate.
6262
'''
6363
def __init__(self, id, name: str=None, number: int=None, node: Node=None):
@@ -153,7 +153,7 @@ async def init(self, statemachine: Node):
153153
elif dn.Text == "EffectiveDisplayName":
154154
self._current_state_effective_display_name_node = await self._current_state_node.get_child(["EffectiveDisplayName"])
155155
else:
156-
_logger.warning(f"{await statemachine.read_browse_name()} CurrentState Unknown propertie: {dn.Text}")
156+
_logger.warning(f"{await statemachine.read_browse_name()} CurrentState Unknown property: {dn.Text}")
157157
if self._optionals:
158158
self._last_transition_node = await statemachine.get_child(["LastTransition"])
159159
last_transition_props = await self._last_transition_node.get_properties()
@@ -168,7 +168,7 @@ async def init(self, statemachine: Node):
168168
elif dn.Text == "TransitionTime":
169169
self._last_transition_transitiontime_node = await self._last_transition_node.get_child(["TransitionTime"])
170170
else:
171-
_logger.warning(f"{await statemachine.read_browse_name()} LastTransition Unknown propertie: {dn.Text}")
171+
_logger.warning(f"{await statemachine.read_browse_name()} LastTransition Unknown property: {dn.Text}")
172172
self._evgen = await self._server.get_event_generator(self.evtype, self._state_machine_node)
173173

174174
async def change_state(self, state: State, transition: Transition=None, event_msg:Union[str, ua.LocalizedText]=None, severity: int=500):

asyncua/common/structures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ def set_typeid(self, name, typeid):
228228
async def load_type_definitions(server, nodes=None):
229229
"""
230230
Download xml from given variable node defining custom structures.
231-
If no node is given, attemps to import variables from all nodes under
231+
If no node is given, attempts to import variables from all nodes under
232232
"0:OPC Binary"
233233
the code is generated and imported on the fly. If you know the structures
234-
are not going to be modified it might be interresting to copy the generated files
234+
are not going to be modified it might be interesting to copy the generated files
235235
and include them in you code
236236
"""
237237
if nodes is None:
@@ -251,7 +251,7 @@ async def load_type_definitions(server, nodes=None):
251251
generator.get_python_classes(structs_dict)
252252
# same but using a file that is imported. This can be useful for debugging library
253253
# name = node.read_browse_name().Name
254-
# Make sure structure names do not contain charaters that cannot be used in Python class file names
254+
# Make sure structure names do not contain characters that cannot be used in Python class file names
255255
# name = clean_name(name)
256256
# name = "structures_" + node.read_browse_name().Name
257257
# generator.save_and_import(name + ".py", append_to=structs_dict)
@@ -268,7 +268,7 @@ async def load_type_definitions(server, nodes=None):
268268
continue
269269
nodeid = ref_desc_list[0].NodeId
270270
ua.register_extension_object(name, nodeid, structs_dict[name])
271-
# save the typeid if user want to create static file for type definitnion
271+
# save the typeid if user want to create static file for type definition
272272
generator.set_typeid(name, nodeid.to_string())
273273

274274
for key, val in structs_dict.items():

asyncua/common/structures104.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async def new_enum(
120120
def clean_name(name):
121121
"""
122122
Remove characters that might be present in OPC UA structures
123-
but cannot be part of of Python class names
123+
but cannot be part of Python class names
124124
"""
125125
if keyword.iskeyword(name):
126126
return name + "_"
@@ -383,7 +383,7 @@ async def _recursive_parse_basedatatypes(server, base_node, parent_datatype, new
383383
for desc in await base_node.get_children_descriptions(refs=ua.ObjectIds.HasSubtype):
384384
name = clean_name(desc.BrowseName.Name)
385385
if parent_datatype not in 'Number':
386-
# Don't insert Number alias, they should be allready insert because they have to be basetypes allready
386+
# Don't insert Number alias, they should be already insert because they have to be basetypes already
387387
if not hasattr(ua, name):
388388
env = make_basetype_code(name, parent_datatype)
389389
ua.register_basetype(name, desc.NodeId, env[name])
@@ -421,7 +421,7 @@ async def _load_base_datatypes(server: Union["Server", "Client"]) -> Any:
421421

422422
async def load_data_type_definitions(server: Union["Server", "Client"], base_node: Node = None, overwrite_existing=False) -> Dict:
423423
"""
424-
Read DataTypeDefition attribute on all Structure and Enumeration defined
424+
Read DataTypeDefinition attribute on all Structure and Enumeration defined
425425
on server and generate Python objects in ua namespace to be used to talk with server
426426
"""
427427
new_objects = await _load_base_datatypes(server) # we need to load all basedatatypes alias first
@@ -510,7 +510,7 @@ async def load_enums(server: Union["Server", "Client"], base_node: Node = None,
510510
name = clean_name(desc.BrowseName.Name)
511511
if hasattr(ua, name):
512512
continue
513-
logger.info("Registring Enum %s %s OptionSet=%s", desc.NodeId, name, option_set)
513+
logger.info("Registering Enum %s %s OptionSet=%s", desc.NodeId, name, option_set)
514514
edef = await _read_data_type_definition(server, desc)
515515
if not edef:
516516
continue

asyncua/common/ua_utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Usefull method and classes not belonging anywhere and depending on asyncua library
2+
Useful methods and classes not belonging anywhere and depending on asyncua library
33
"""
44

55
import uuid
@@ -16,7 +16,7 @@
1616

1717
def value_to_datavalue(val, varianttype=None):
1818
"""
19-
convert anyting to a DataValue using varianttype
19+
convert anything to a DataValue using varianttype
2020
"""
2121
if isinstance(val, ua.DataValue):
2222
return val
@@ -31,7 +31,7 @@ def val_to_string(val, truncate=False):
3131
which should be easy to understand for human
3232
easy to modify, and not too hard to parse back ....not easy
3333
meant for UI or command lines
34-
if truncate is true then huge strings or bytes are tuncated
34+
if truncate is true then huge strings or bytes are truncated
3535
3636
"""
3737
if isinstance(val, (list, tuple)):
@@ -172,7 +172,7 @@ async def get_node_subtypes(node, nodes=None):
172172
async def get_node_supertypes(node, includeitself=False, skipbase=True):
173173
"""
174174
return get all subtype parents of node recursive
175-
:param node: can be a ua.Node or ua.NodeId
175+
:param node: can be an ua.Node or ua.NodeId
176176
:param includeitself: include also node to the list
177177
:param skipbase don't include the toplevel one
178178
:returns list of ua.Node, top parent first
@@ -216,7 +216,7 @@ async def is_child_present(node, browsename):
216216
return if a browsename is present a child from the provide node
217217
:param node: node wherein to find the browsename
218218
:param browsename: browsename to search
219-
:returns returne True if the browsename is present else False
219+
:returns returns True if the browsename is present else False
220220
"""
221221
child_descs = await node.get_children_descriptions()
222222
for child_desc in child_descs:
@@ -232,7 +232,7 @@ async def data_type_to_variant_type(dtype_node):
232232
"""
233233
base = await get_base_data_type(dtype_node)
234234
if base.nodeid.Identifier == 29:
235-
# we have an enumeration, value is a Int32
235+
# we have an enumeration, value is an Int32
236236
return ua.VariantType.Int32
237237
elif base.nodeid.Identifier in [24, 26, 27, 28]:
238238
# BaseDataType, Number, Integer, UInteger -> Variant
@@ -277,10 +277,10 @@ async def get_nodes_of_namespace(server, namespaces=None):
277277
elif isinstance(namespaces, (str, int)):
278278
namespaces = [namespaces]
279279

280-
# make sure all namespace are indexes (if needed convert strings to indexes)
280+
# make sure all namespace are indexes (if needed, convert strings to indexes)
281281
namespace_indexes = [n if isinstance(n, int) else ns_available.index(n) for n in namespaces]
282282

283-
# filter nodeis based on the provide namespaces and convert the nodeid to a node
283+
# filter node is based on the provided namespaces and convert the nodeid to a node
284284
nodes = [
285285
server.get_node(nodeid) for nodeid in server.iserver.aspace.keys()
286286
if nodeid.NamespaceIndex != 0 and nodeid.NamespaceIndex in namespace_indexes
@@ -297,7 +297,7 @@ def get_default_value(uatype):
297297

298298

299299
def data_type_to_string(dtype):
300-
# we could just display browse name of node but it requires a query
300+
# we could just display browse name of node, but it requires a query
301301
if dtype.NamespaceIndex == 0 and dtype.Identifier in ua.ObjectIdNames:
302302
string = ua.ObjectIdNames[dtype.Identifier]
303303
else:

asyncua/common/xmlexporter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ async def add_etree_datatype(self, obj):
322322
elif isinstance(sdef, ua.EnumDefinition):
323323
self._enum_fields_to_etree(sdef_el, sdef)
324324
else:
325-
self.logger.warning("Unknown DataTypeSpecification elemnt: %s", sdef)
325+
self.logger.warning("Unknown DataTypeSpecification element: %s", sdef)
326326

327327
def _structure_fields_to_etree(self, sdef_el, sdef):
328328
for field in sdef.Fields:
@@ -447,7 +447,7 @@ async def _value_to_etree(self, el, type_name, dtype, val):
447447
if isinstance(val, (list, tuple)):
448448
if dtype.NamespaceIndex == 0 and dtype.Identifier <= 21:
449449
elname = "uax:ListOf" + type_name
450-
else: # this is an extentionObject:
450+
else: # this is an extensionObject:
451451
elname = "uax:ListOfExtensionObject"
452452

453453
list_el = Et.SubElement(el, elname)
@@ -489,9 +489,9 @@ async def _extobj_to_etree(self, val_el, name, dtype, val):
489489

490490
async def _all_fields_to_etree(self, struct_el, val):
491491
# TODO: adding the 'ua' module to the globals to resolve the type hints might not be enough.
492-
# its possible that the type annotations also refere to classes defined in other modules.
492+
# it is possible that the type annotations also refere to classes defined in other modules.
493493
for field in fields_with_resolved_types(val, globalns={"ua": ua}):
494-
# FIXME; what happend if we have a custom type which is not part of ObjectIds???
494+
# FIXME; what happened if we have a custom type which is not part of ObjectIds???
495495
if field.name == "Encoding":
496496
continue
497497
type_name = type_string_from_type(field.type)

asyncua/common/xmlimporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class XmlImporter:
2121

2222
def __init__(self, server, strict_mode=True):
2323
'''
24-
strict_mode: stop on a error, if False only a error message is logged,
24+
strict_mode: stop on an error, if False only an error message is logged,
2525
but the import continues
2626
'''
2727
self.parser = None
@@ -279,7 +279,7 @@ def make_objects(self, node_data):
279279
def _migrate_ns(self, obj: Union[ua.NodeId, ua.QualifiedName]) -> Union[ua.NodeId, ua.QualifiedName]:
280280
"""
281281
Check if the index of nodeid or browsename given in the xml model file
282-
must be converted to a already existing namespace id based on the files
282+
must be converted to an already existing namespace id based on the files
283283
namespace uri
284284
285285
:returns: NodeId (str)

0 commit comments

Comments
 (0)