Skip to content

Commit

Permalink
Merge branch 'master' into feature/supportvariosaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Nobu19800 committed Sep 13, 2024
2 parents 2e30723 + 6fd9d88 commit 0f44459
Show file tree
Hide file tree
Showing 79 changed files with 5,343 additions and 1,710 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Workflow for openrtm-aist-python static code analysis
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu_2004_pycodestyle, ubuntu_2004_pyflakes, ubuntu_2004_flake8, ubuntu_2004_bandit]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run static code analysis
run: |
export OPENRTMPYTHON_IMAGE=openrtm-aist-python:${{matrix.os}}-$(date +%s)
docker build .. --file scripts/${{matrix.os}}/Dockerfile --tag $OPENRTMPYTHON_IMAGE
docker run $OPENRTMPYTHON_IMAGE
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (C) 2003-2018
Copyright (C) 2003-2024
Noriaki Ando and the OpenRTM-aist Project team
Intelligent Systems Research Institute,
National Institute of Advanced Industrial Science and Technology (AIST),
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
include OpenRTM-aist.pth
include MANIFEST.in
include setup.py
include setup.cfg
include pyproject.toml
include README
exclude README.md
recursive-include packages Makefile
recursive-include packages/deb *.sh copyright changelog rules README* compat control control.* files
recursive-include packages/rpm *.sh openrtm-aist.spec.in openrtm-aist_py3.spec.in
Expand Down
3 changes: 3 additions & 0 deletions OpenRTM_aist/CORBA_IORUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
# @author Noriaki Ando
#

import sys
from omniORB import CORBA
from omniORB import *
from omniORB import any
from omniORB import cdrMarshal
from omniORB import cdrUnmarshal
from IORProfile_idl import *
from IORProfile_idl import _0__GlobalIDL
endian = True
Expand Down
2 changes: 1 addition & 1 deletion OpenRTM_aist/CSPInPort.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def getDataBufferMode(self, con, retry):
if not self._syncmode:
guard_ctrl = OpenRTM_aist.ScopedLock(self._ctrl._cond)
if not self._thebuffer.empty():
_, value = self._thebuffer.read(value)
_, value = self._thebuffer.read()
if guard_ctrl is not None:
del guard_ctrl
self.notify()
Expand Down
2 changes: 1 addition & 1 deletion OpenRTM_aist/ConfigAdmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ def __init__(self, name):
return

def __call__(self, conf):
if conf is None:
if conf is None or conf == 0:
return False

return self._name == conf.name
2 changes: 1 addition & 1 deletion OpenRTM_aist/ConnectorListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ def notify(self, info, cdrdata):

endian = info.properties.getProperty(
"serializer.cdr.endian", "little")
if endian is not "little" and endian is not None:
if endian != "little" and endian is not None:
# Maybe endian is ["little","big"]
endian = OpenRTM_aist.split(endian, ",")
# Maybe self._endian is "little" or "big"
Expand Down
17 changes: 3 additions & 14 deletions OpenRTM_aist/CorbaNaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,12 @@ def rebind(self, name_list, obj, force=True):
if force:
self.rebindRecursive(self._rootContext, name_list, obj)
else:
self.__print_exception()
raise

except CosNaming.NamingContext.CannotProceed as err:
if force:
self.rebindRecursive(err.cxt, err.rest_of_name, obj)
else:
self.__print_exception()
raise

##
Expand Down Expand Up @@ -571,12 +569,8 @@ def resolve(self, name):
else:
name_ = name

try:
obj = self._rootContext.resolve(name_)
return obj
except CosNaming.NamingContext.NotFound:
self.__print_exception()
return None
obj = self._rootContext.resolve(name_)
return obj

##
# @if jp
Expand Down Expand Up @@ -612,10 +606,7 @@ def unbind(self, name):
else:
name_ = name

try:
self._rootContext.unbind(name_)
except BaseException:
self.__print_exception()
self._rootContext.unbind(name_)

return

Expand Down Expand Up @@ -680,14 +671,12 @@ def bindNewContext(self, name, force=True):
if force:
self.bindRecursive(self._rootContext, name_, self.newContext())
else:
self.__print_exception()
raise
except CosNaming.NamingContext.CannotProceed as err:
if force:
self.bindRecursive(
err.cxt, err.rest_of_name, self.newContext())
else:
self.__print_exception()
raise
return None

Expand Down
29 changes: 11 additions & 18 deletions OpenRTM_aist/DefaultConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
lang = "Python"
elif os.name == "posix":
cpp_suffixes = "so"
supported_languages = "C++, Python, Python3, Java"
lang = "Python3"
supported_languages = "C++, Python, Java"
lang = "Python"
else:
cpp_suffixes = "dylib"
supported_languages = "C++, Python, Python3, Java"
lang = "Python3"
supported_languages = "C++, Python, Java"
lang = "Python"

##
# @if jp
Expand Down Expand Up @@ -90,32 +90,25 @@
"manager.auto_shutdown_duration", "20.0",
"manager.termination_waittime", "1.0",
"manager.name", "manager",
"manager.command", "rtcd",
"manager.command", "rtcd2_python",
"manager.nameservers", "default",
"manager.language", lang,
"manager.components.naming_policy", "process_unique",
"manager.modules.C++.manager_cmd", "rtcd",
"manager.modules.Python.manager_cmd", "rtcd_python",
"manager.modules.Java.manager_cmd", "rtcd_java",
"manager.modules.C++.manager_cmd", "rtcd2",
"manager.modules.Python.manager_cmd", "rtcd2_python",
"manager.modules.Java.manager_cmd", "rtcd2_java",
"manager.modules.search_auto", "YES",
"manager.local_service.enabled_services", "ALL",
"sdo.service.provider.enabled_services", "ALL",
"sdo.service.consumer.enabled_services", "ALL",
"manager.supported_languages", supported_languages,
"manager.modules.C++.profile_cmd", "rtcprof",
"manager.modules.Python.profile_cmd", "rtcprof_python",
"manager.modules.Java.profile_cmd", "rtcprof_java",
"manager.modules.C++.profile_cmd", "rtcprof2",
"manager.modules.Python.profile_cmd", "rtcprof2_python",
"manager.modules.Java.profile_cmd", "rtcprof2_java",
"manager.modules.C++.suffixes", cpp_suffixes,
"manager.modules.Python.suffixes", "py",
"manager.modules.Java.suffixes", "class",
"manager.modules.C++.load_paths", "",
"manager.modules.Python.load_paths", "",
"manager.modules.Java.load_paths", ""]

if os.name != "nt":
python3_config = [
"manager.modules.Python3.manager_cmd", "rtcd_python3",
"manager.modules.Python3.profile_cmd", "rtcprof_python3",
"manager.modules.Python3.suffixes", "py",
"manager.modules.Python3.load_paths", ""]
default_config.extend(python3_config)
2 changes: 1 addition & 1 deletion OpenRTM_aist/EventPort_pyfsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __call__(self, info, cdrdata):
return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE, cdrdata

def run(self, data):
self._fsm.dispatch(pyfsm.Event(self._handler, data_))
self._fsm.dispatch(pyfsm.Event(self._handler, data))


class EventConnListener(OpenRTM_aist.ConnectorListener):
Expand Down
5 changes: 2 additions & 3 deletions OpenRTM_aist/ExecutionContextWorker.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,11 @@ def addComponent(self, comp):
id_, comp))
del guard
except BaseException:
del guard
self._rtcout.RTC_ERROR("addComponent() failed.")
return RTC.RTC_ERROR

self._rtcout.RTC_DEBUG("addComponent() succeeded.")
if self._running == False:
if self._running is False:
self.updateComponentList()
return RTC.RTC_OK

Expand Down Expand Up @@ -635,7 +634,7 @@ def removeComponent(self, comp):
guard = OpenRTM_aist.ScopedLock(self._removedMutex)
self._removedComps.append(rtobj_)
del guard
if self._running == False:
if self._running is False:
self.updateComponentList()
return RTC.RTC_OK

Expand Down
4 changes: 2 additions & 2 deletions OpenRTM_aist/ExtTrigExecutionContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,13 @@ def onStopping(self):

def onAddedComponent(self, rtobj):
guard = OpenRTM_aist.ScopedLock(self._workerthread._mutex)
if self._workerthread._ticked == False:
if self._workerthread._ticked is False:
self._worker.updateComponentList()
return RTC.RTC_OK

def onRemovedComponent(self, rtobj):
guard = OpenRTM_aist.ScopedLock(self._workerthread._mutex)
if self._workerthread._ticked == False:
if self._workerthread._ticked is False:
self._worker.updateComponentList()
return RTC.RTC_OK

Expand Down
2 changes: 1 addition & 1 deletion OpenRTM_aist/FiniteStateMachineComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# Advanced Industrial Science and Technology (AIST), Japan
# All rights reserved.


import OpenRTM_aist
import RTC
import OpenRTM
import OpenRTM__POA

Expand Down
32 changes: 0 additions & 32 deletions OpenRTM_aist/FiniteStateMachineComponentBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,38 +282,6 @@ def get_owned_contexts(self):
# @endif
# virtual ExecutionContext_ptr get_context(UniqueId exec_handle)

def get_owned_contexts(self):
return OpenRTM_aist.RTObject_impl.get_owned_contexts(self)

##
# @if jp
# @brief [CORBA interface] ExecutionContextを取得する
#
# 指定したハンドルの ExecutionContext を取得する。
# ハンドルから ExecutionContext へのマッピングは、特定の RTC インスタンスに
# 固有である。ハンドルはこの RTC を attach_context した際に取得できる。
#
# @param self
# @param ec_id 取得対象 ExecutionContext ハンドル
#
# @return ExecutionContext
#
# @else
# @brief [CORBA interface] Get ExecutionContext.
#
# Obtain a reference to the execution context represented by the given
# handle.
# The mapping from handle to context is specific to a particular RTC
# instance. The given handle must have been obtained by a previous call to
# attach_context on this RTC.
#
# @param ec_id ExecutionContext handle
#
# @return ExecutionContext
#
# @endif
# virtual ExecutionContext_ptr get_context(UniqueId exec_handle)

def get_context(self, ec_id):
return OpenRTM_aist.RTObject_impl.get_context(self, ec_id)

Expand Down
8 changes: 4 additions & 4 deletions OpenRTM_aist/GlobalFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self):
# bool hasFactory(const Identifier& id)

def hasFactory(self, id):
if not id in self._creators:
if id not in self._creators:
return False
return True

Expand All @@ -51,7 +51,7 @@ def getIdentifiers(self):
# ReturnCode addFactory(const Identifier& id,
# Creator creator)

def addFactory(self, id, creator):
def addFactory(self, id, creator, prop=None):
if not creator:
return self.INVALID_ARG

Expand All @@ -64,7 +64,7 @@ def addFactory(self, id, creator):
# ReturnCode removeFactory(const Identifier& id)

def removeFactory(self, id):
if not id in self._creators:
if id not in self._creators:
return self.NOT_FOUND

del self._creators[id]
Expand All @@ -73,7 +73,7 @@ def removeFactory(self, id):
# AbstractClass* createObject(const Identifier& id)

def createObject(self, id):
if not id in self._creators:
if id not in self._creators:
print("Factory.createObject return None id: ", id)
return None
obj_ = self._creators[id]()
Expand Down
10 changes: 5 additions & 5 deletions OpenRTM_aist/InPort.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def __init__(self, name, value):
self._valueMutex = threading.RLock()

marshaling_types = OpenRTM_aist.SerializerFactories.instance().getSerializerList(value)
marshaling_types = OpenRTM_aist.flatten(marshaling_types).lstrip()
self.addProperty("dataport.marshaling_types", marshaling_types)
marshaling_types_str = ",".join([x.strip() for x in marshaling_types])
self.addProperty("dataport.marshaling_types", marshaling_types_str)

self._listeners.setDataType(copy.deepcopy(value))
self._listeners.setPortType(OpenRTM_aist.PortType.InPortType)
Expand Down Expand Up @@ -152,7 +152,7 @@ def isNew(self, names=None):
self._rtcout.RTC_TRACE("isNew()")

guard = OpenRTM_aist.ScopedLock(self._valueMutex)
if self._directNewData == True:
if self._directNewData is True:
self._rtcout.RTC_TRACE(
"isNew() returns true because of direct write.")
return True
Expand Down Expand Up @@ -226,7 +226,7 @@ def isNew(self, names=None):

def isEmpty(self, names=None):
self._rtcout.RTC_TRACE("isEmpty()")
if self._directNewData == True:
if self._directNewData is True:
return False
if not self._connectors:
self._rtcout.RTC_DEBUG("no connectors")
Expand Down Expand Up @@ -347,7 +347,7 @@ def read(self, name=None):
self._rtcout.RTC_TRACE("OnRead called")

guard = OpenRTM_aist.ScopedLock(self._valueMutex)
if self._directNewData == True:
if self._directNewData is True:

self._rtcout.RTC_TRACE("Direct data transfer")
if self._OnReadConvert is not None:
Expand Down
4 changes: 2 additions & 2 deletions OpenRTM_aist/InPortBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ def publishInterfaces(self, cprof):
# marge ConnectorProfile for buffer property.
prop.mergeProperties(conn_prop.getNode("dataport.inport"))

if not self.isExistingMarshalingType(prop):
if self._value is not None and not self.isExistingMarshalingType(prop):
return RTC.RTC_ERROR

#
Expand Down Expand Up @@ -1008,7 +1008,7 @@ def subscribeInterfaces(self, cprof):
# marge ConnectorProfile for buffer property.
prop.mergeProperties(conn_prop.getNode("dataport.inport"))

if not self.isExistingMarshalingType(prop):
if self._value is not None and not self.isExistingMarshalingType(prop):
return RTC.RTC_ERROR

#
Expand Down
2 changes: 1 addition & 1 deletion OpenRTM_aist/InPortPushConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def disconnect(self):
self._provider = None

# delete buffer
if self._buffer and self._deleteBuffer == True:
if self._buffer and self._deleteBuffer is True:
bfactory = OpenRTM_aist.CdrBufferFactory.instance()

self._buffer = None
Expand Down
Loading

0 comments on commit 0f44459

Please sign in to comment.