Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBHandler::config_db inconsistent zip list order #48

Open
diegonc opened this issue Dec 12, 2023 · 1 comment
Open

DBHandler::config_db inconsistent zip list order #48

diegonc opened this issue Dec 12, 2023 · 1 comment
Assignees

Comments

@diegonc
Copy link

diegonc commented Dec 12, 2023

In the DBHandler class there is the config_db method

def config_db(stack_config):

which in full reads:

@staticmethod
def config_db(stack_config):
    db = {}
    for number, gv_name in zip([stack_config.dbConfig.sizes.numBinary,
                                stack_config.dbConfig.sizes.numBinaryOutputStatus,
                                stack_config.dbConfig.sizes.numAnalog,
                                stack_config.dbConfig.sizes.numAnalogOutputStatus],
                                ["Analog", "AnalogOutputStatus",
                                 "Binary", "BinaryOutputStatus"]):
         val_body = dict((n, None) for n in range(number))
         db[gv_name] = val_body

    return db

I wonder how this actually works given that the order of the first list in the zip call does not seem to be the same as the one of the second list.

@kefeimo
Copy link
Contributor

kefeimo commented Dec 13, 2023

In the DBHandler class there is the config_db method

def config_db(stack_config):

which in full reads:

@staticmethod
def config_db(stack_config):
    db = {}
    for number, gv_name in zip([stack_config.dbConfig.sizes.numBinary,
                                stack_config.dbConfig.sizes.numBinaryOutputStatus,
                                stack_config.dbConfig.sizes.numAnalog,
                                stack_config.dbConfig.sizes.numAnalogOutputStatus],
                                ["Analog", "AnalogOutputStatus",
                                 "Binary", "BinaryOutputStatus"]):
         val_body = dict((n, None) for n in range(number))
         db[gv_name] = val_body

    return db

I wonder how this actually works given that the order of the first list in the zip call does not seem to be the same as the one of the second list.

Thanks for bringing up the issue. Please see #49 for the fix.

@kefeimo kefeimo self-assigned this Dec 13, 2023
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

No branches or pull requests

2 participants