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

typing - IRObjectdict args definiton #223

Open
dromer opened this issue Dec 8, 2024 · 2 comments
Open

typing - IRObjectdict args definiton #223

dromer opened this issue Dec 8, 2024 · 2 comments

Comments

@dromer
Copy link
Collaborator

dromer commented Dec 8, 2024

The following list of potential args should be put into the type checker.
Many are likely optional and depending on the object type:

  • local
  • label
  • seed
  • name
  • index
  • length
  • cases
  • table_id
  • k
  • reverse
  • var_id
@dromer
Copy link
Collaborator Author

dromer commented Dec 8, 2024

hvcc/hvcc/generators/ir2c$ grep -r "args\[" *
ControlBinop.py:                    float(args["k"]),
ControlDelay.py:                float(args["delay"]))
ControlIf.py:                "true" if float(args["k"]) != 0.0 else "false"
ControlMessage.py:        if len(objects[obj_id].args["local"]) > 0:
ControlMessage.py:        for m in objects[obj_id].args["local"]:
ControlPack.py:                len(args["values"]),
ControlPack.py:                ", ".join(["{0}f".format(float(x)) for x in args["values"]]))
ControlPrint.py:        return [f"cPrint_onMessage(_c, m, \"{args['label']}\");"]
ControlRandom.py:                cls.preamble, obj_id, int(args["seed"]))
ControlSend.py:            send_name = objects[obj_id].args["name"]
ControlSlice.py:                int(args["index"]),
ControlSlice.py:                int(args["length"]))]
ControlSwitchcase.py:        cases = objects[obj_id].args["cases"]
ControlTabhead.py:        return [f"cTabhead_init(&cTabhead_{obj_id}, &hTable_{args['table_id']});"]
ControlTabread.py:                args["table_id"],
ControlTabread.py:                args["table"])
ControlTabwrite.py:                args["table_id"],
ControlTabwrite.py:                args["table"])
ControlVar.py:        if isinstance(args["k"], str):
ControlVar.py:                    args["k"])]
ControlVar.py:                    float(args["k"]))]
HeavyTable.py:                    len(args["values"]),
HeavyTable.py:                    ", ".join([f"{float(v)}f" for v in args["values"]]))]
HeavyTable.py:                    len(args["values"]))]
SignalBiquad.py:                float(args["ff0"]),
SignalBiquad.py:                float(args["ff1"]),
SignalBiquad.py:                float(args["ff2"]),
SignalBiquad.py:                float(args["fb1"]),
SignalBiquad.py:                float(args["fb2"]))]
SignalConvolution.py:                args["table_id"],
SignalConvolution.py:                int(args["size"]))
SignalEnvelope.py:                int(args["windowSize"]),
SignalEnvelope.py:                int(args["period"]))
SignalLorenz.py:                float(args["x"]),
SignalLorenz.py:                float(args["y"]),
SignalLorenz.py:                float(args["z"]))
SignalPhasor.py:            return [f"sPhasor_k_init(&sPhasor_{obj_id}, {args['frequency']}f, sampleRate);"]
SignalTabhead.py:        return [f"sTabhead_init(&sTabhead_{obj_id}, &hTable_{args['table_id']});"]
SignalTabread.py:                args["table_id"],
SignalTabwrite.py:        return [f"sTabwrite_init(&sTabwrite_{obj_id}, &hTable_{args['table_id']});"]
SignalVar.py:                f"{float(args['k'])}f" if obj_type.endswith("f") else int(args["k"]),
SignalVar.py:                f"{float(args['step'])}f" if obj_type.endswith("f") else int(args["step"]),
SignalVar.py:                "true" if args["reverse"] else "false")]
SignalVar.py:                    args["var_id"],
SignalVar.py:            if args["k"] == 0.0 and args.get("step", 0.0) == 0.0:
SignalVar.py:                c = [float(args["k"] + i * args.get("step", 0.0)) for i in range(8)]
SignalVar.py:                    args["var_id"],

@dromer
Copy link
Collaborator Author

dromer commented Dec 8, 2024

hvcc/hvcc/core/hv2ir$ grep -r "args\[" *
HeavyGraph.py:                                value = self.args[k]  # maintain the original data type
HeavyGraph.py:                                value = value.replace(dollar_key, str(self.args[k]))
HeavyGraph.py:                        args[key] = value
HeavyGraph.py:                self.inlet_objs.sort(key=lambda o: o.args["index"])
HeavyGraph.py:                self.outlet_objs.sort(key=lambda o: o.args["index"])
HeavyGraph.py:                self.input_channel_set.update(obj.args["channels"])
HeavyGraph.py:                self.output_channel_set.update(obj.args["channels"])
HeavyGraph.py:            extern = list(set([r.args["extern"] for r in receivers]) - set([None]))
HeavyGraph.py:            attributes = [r.args["attributes"] for r in receivers if len(r.args["attributes"]) > 0]
HeavyGraph.py:            receivers.sort(key=lambda x: x.args["priority"], reverse=True)
HeavyGraph.py:            any(o.args["index"] > 127 for o in self.inlet_objs)
HeavyGraph.py:                    extern=v[0].args["extern"]
HeavyGraph.py:            extern=v[0].args["extern"],
HeavyGraph.py:            attributes=v[0].args["attributes"],
HeavyIrObject.py:                        self.args[arg.name] = arg.default
HeavyIrObject.py:                        self.args[arg.name] = HeavyLangObject.force_arg_type(
HeavyIrObject.py:                            self.args[arg.name],
HeavyLangObject.py:        return self._obj_desc.args[index].name
HeavyLangObject.py:                        self.args[arg.name] = arg.default
HeavyLangObject.py:                    self.args[arg.name] = HeavyLangObject.force_arg_type(
HeavyLangObject.py:                        self.args[arg.name],
HeavyParser.py:                    graph_args[a["name"]] = a["default"]
HeavyParser.py:                graph_args[a["name"]] = HeavyLangObject.force_arg_type(
HeavyParser.py:                    graph_args[a["name"]],
HIrConvolution.py:                self.args["table"],
HIrConvolution.py:                self.args["table_id"] = table_obj.id
HIrConvolution.py:                self.add_error(f"Cannot find table named \"{self.args['table']}\" for object {self}.")
HIrInlet.py:            connections = self.graph.inlet_connections[self.args["index"]]
HIrOutlet.py:            for c in self.graph.outlet_connections[self.args["index"]]:
HIrPack.py:            num_inlets = len(args["values"])
HIrReceive.py:        if args is not None and args["extern"]:
HIrReceive.py:            if re.search(r"\W", args["name"]):
HIrReceive.py:                                alphanumeric characters or underscore: '{args['name']}'")
HIrSend.py:        if args is not None and args["extern"]:
HIrSend.py:            if re.search(r"\W", args["name"]):
HIrSend.py:                                alphanumeric characters or underscore: '{args['name']}'")
HIrSend.py:                extern=self.args["extern"],
HIrSend.py:                attributes=self.args["attributes"],
HIrSend.py:                hash=self.args["hash"],
HIrSend.py:                display=self.args["name"],
HIrSend.py:                name=((f"_{self.args['name']}") if re.match(r"\d", self.args["name"]) else self.args["name"])
HIrSwitchcase.py:            num_cases = len(args["cases"])
HIrTabhead.py:                self.args["table"],
HIrTabhead.py:                self.args["table_id"] = table_obj.id
HIrTabhead.py:                self.add_error(f"Can't find table with name \"{self.args['table']}\".")
HIrTabread.py:                self.args["table"],
HIrTabread.py:                self.args["table_id"] = table_obj.id
HIrTabread.py:                self.add_error(f"Cannot find table named \"{self.args['table']}\" for object {self}.")
HIrTabwrite.py:                self.args["table"],
HIrTabwrite.py:                self.args["table_id"] = table_obj.id
HIrTabwrite.py:                self.add_error(f"Can't find table with name \"{self.args['table']}\".")
HLangAdc.py:                         num_outlets=len(args[self._HEAVY_LANG_DICT[obj_type].args[0].name]),
HLangAdc.py:        for i, channel_index in enumerate(self.args["channels"]):
HLangBinop.py:            y = HeavyIrObject("__var~f", {"k": self.args[self.name_for_arg()]})
HLangBinop.py:            if (self.type == "+" and self.args["k"] == 0.0) or \
HLangBinop.py:                    (self.type == "-" and self.args["k"] == 0.0) or \
HLangBinop.py:                    (self.type == "*" and self.args["k"] == 1.0) or \
HLangBinop.py:                    (self.type == "/" and self.args["k"] == 1.0):
HLangBinop.py:                # self.args["k"] == 1.0 case handled above
HLangBinop.py:                if self.args["k"] == 0.0:
HLangBinop.py:                if self.args["k"] == -1.0:
HLangBinop.py:                args={"k": self.args[self.name_for_arg()]})
HLangBinop.py:            y = HeavyIrObject("__var~i", {"k": self.args[self.name_for_arg()]})
HLangBinop.py:                args={"k": self.args[self.name_for_arg()]})
HLangBinop.py:            args = {"k": self.args[self.name_for_arg()]}
HLangBinop.py:            args = {"k": self.args[self.name_for_arg()]}
HLangDac.py:                         num_inlets=len(args[self._HEAVY_LANG_DICT[obj_type].args[0].name]),
HLangDac.py:        for i, channel_index in enumerate(self.args["channels"]):
HLangRandom.py:        self.args["seed"] = int(random.uniform(-2147483647, 2147483648))
HLangSend.py:            ir_args["hash"] = f"0x{HeavyLangObject.get_hash(ir_args['name']):X}"
HLangSequence.py:        num_outlets = len(args[self._HEAVY_LANG_DICT[obj_type].args[0].name])
HLangSequence.py:        for a in self.args[self.name_for_arg()]:
HLangTable.py:            self.args["size"] = len(self.args["values"])
HLangTable.py:        if self.args["extern"]:
HLangTable.py:            if re.search(r"\W", args["name"]):
HLangTable.py:                                or underscore: '{args['name']}'")

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

1 participant