Skip to content

add "num" in DATATYPE_MAP in order to generate %Numeric properties.#3

Open
SylvainGuilbaud wants to merge 1 commit intointersystems:mainfrom
SylvainGuilbaud:datatypes
Open

add "num" in DATATYPE_MAP in order to generate %Numeric properties.#3
SylvainGuilbaud wants to merge 1 commit intointersystems:mainfrom
SylvainGuilbaud:datatypes

Conversation

@SylvainGuilbaud
Copy link
Copy Markdown

@SylvainGuilbaud SylvainGuilbaud commented Mar 24, 2026

when you overload a CallInterval property you raise the error :
ERROR #5478: Keyword signature error in xxx:Property:CallInterval, keyword 'Type' must be '%Library.Numeric' or its subclass

For instance, if an Adapter defines CallInterval property with "int" datatype the compilation fails, as this property is already defined as %Numeric in Ens.InboundAdapter.

# =========================
# Inbound Adapter (CallInterval)
# =========================
class CallIntervalAdapter(InboundAdapter):
    CallInterval = IRISProperty(datatype="num", settings="CallInterval", default=30, description="Interval between calls in seconds")

    def OnTask(self):
        IRISLog.Info("Interval: " + str(self.CallInterval))
        interval = float(self.CallInterval) if self.CallInterval else 5.0
        time.sleep(interval)
        self.business_host_process_input("tick")
        return Status.OK()

DATATYPE_MAP = {"str": "%VarString", "int": "%Integer", "bool": "%Boolean", "num":"%Numeric"}

DATATYPE_MAP_Parameters = {"str": "STRING", "int": "INTEGER", "bool": "BOOLEAN"}
DATATYPE_MAP_Parameters = {"str": "STRING", "int": "INTEGER", "bool": "BOOLEAN", "num":"NUMERIC"}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. The code change for Property DATATYPE_MAP looks reasonable.

Could you please remove the version bump in pyproject.toml? We usually handle version updates at release time rather than in individual feature/fix PRs. I also suspect this version change may have caused issues with the automated tests.

Also, could you add a small test before I merge this? It should be enough to extend an existing test with a new property using "num" and verify that it compiles successfully, i.e. that the automated tests run without errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants