Skip to content

Commit

Permalink
list all possible keywords in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
cocoa-xu committed May 31, 2024
1 parent 693bba5 commit d19ff7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions py_src/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def evision_elixir_module_fixes():
waitAny(streams[, timeoutNs]) -> retval, readyIndex
```
\"\"\"
@spec waitAny(list(Evision.VideoCapture.t()), [{:timeoutNs, term()}, {atom(), term()},...] | nil) :: list(integer()) | false | {:error, String.t()}
@spec waitAny(list(Evision.VideoCapture.t()), [{:timeoutNs, term()} | {atom(), term()}] | nil) :: list(integer()) | false | {:error, String.t()}
def waitAny(streams, opts) when is_list(streams) and (opts == nil or (is_list(opts) and is_tuple(hd(opts))))
do
positional = [
Expand Down Expand Up @@ -154,7 +154,7 @@ def waitAny(streams) when is_list(streams)
NMSBoxes(bboxes, scores, score_threshold, nms_threshold[, eta[, top_k]]) -> indices
```
\"\"\"
@spec nmsBoxes(list({number(), number(), number(), number()}) | Evision.Mat.t() | Nx.Tensor.t(), list(number()), number(), number(), [{:eta, term()}, {:top_k, term()}, {atom(), term()},...] | nil) :: list(integer()) | {:error, String.t()}
@spec nmsBoxes(list({number(), number(), number(), number()}) | Evision.Mat.t() | Nx.Tensor.t(), list(number()), number(), number(), [{:eta, term()} | {:top_k, term()} | {atom(), term()}] | nil) :: list(integer()) | {:error, String.t()}
def nmsBoxes(bboxes, scores, score_threshold, nms_threshold, opts) when is_list(bboxes) and is_list(scores) and is_float(score_threshold) and is_float(nms_threshold) and (opts == nil or (is_list(opts) and is_tuple(hd(opts))))
do
positional = [
Expand Down Expand Up @@ -304,7 +304,7 @@ def nmsBoxes(bboxes, scores, score_threshold, nms_threshold) when (is_struct(bbo
NMSBoxesBatched(bboxes, scores, class_ids, score_threshold, nms_threshold[, eta[, top_k]]) -> indices
```
\"\"\"
@spec nmsBoxesBatched(list({number(), number(), number(), number()}), list(number()), list(integer()), number(), number(), [{:eta, term()}, {:top_k, term()}, {atom(), term()},...] | nil) :: list(integer()) | {:error, String.t()}
@spec nmsBoxesBatched(list({number(), number(), number(), number()}), list(number()), list(integer()), number(), number(), [{:eta, term()} | {:top_k, term()} | {atom(), term()}] | nil) :: list(integer()) | {:error, String.t()}
def nmsBoxesBatched(bboxes, scores, class_ids, score_threshold, nms_threshold, opts) when is_list(bboxes) and is_list(scores) and is_list(class_ids) and is_float(score_threshold) and is_float(nms_threshold) and (opts == nil or (is_list(opts) and is_tuple(hd(opts))))
do
positional = [
Expand Down Expand Up @@ -477,7 +477,7 @@ def nmsBoxesBatched(bboxes, scores, class_ids, score_threshold, nms_threshold) w
softNMSBoxes(bboxes, scores, score_threshold, nms_threshold[, top_k[, sigma[, method]]]) -> updated_scores, indices
```
\"\"\"
@spec softNMSBoxes(list({number(), number(), number(), number()}), list(number()), number(), number(), [{:top_k, term()}, {:sigma, term()}, {:method, term()}, {atom(), term()},...] | nil) :: {list(number()), list(integer())} | {:error, String.t()}
@spec softNMSBoxes(list({number(), number(), number(), number()}), list(number()), number(), number(), [{:top_k, term()} | {:sigma, term()} | {:method, term()} | {atom(), term()}] | nil) :: {list(number()), list(integer())} | {:error, String.t()}
def softNMSBoxes(bboxes, scores, score_threshold, nms_threshold, opts) when is_list(bboxes) and is_list(scores) and is_float(score_threshold) and is_float(nms_threshold) and (opts == nil or (is_list(opts) and is_tuple(hd(opts))))
do
positional = [
Expand Down
2 changes: 1 addition & 1 deletion py_src/func_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def generate_spec_elixir(self, module_func_name: str, is_instance_method: bool,
for arg_name in keyword_arg_names:
named_in_args_spec.append(f'{{:{arg_name}, term()}}')
if len(named_in_args_spec) > 0:
named_in_args_spec = f"[{', '.join(named_in_args_spec)}, " + "{atom(), term()},...] | nil"
named_in_args_spec = f"[{' | '.join(named_in_args_spec)} " + " | {atom(), term()}] | nil"
else:
named_in_args_spec = "[{atom(), term()},...] | nil"
in_args_spec.append(named_in_args_spec)
Expand Down

0 comments on commit d19ff7c

Please sign in to comment.