Questions tagged [callable]
A task that returns a result and may throw an exception.
callable
767
questions
-1
votes
0
answers
39
views
Why I am getting this error: TypeError: Expected a Runnable, callable or dict.Instead got an unsupported type: <class 'NoneType'>
import streamlit as st
from langchain_google_vertexai import VertexAI
from langchain_core.prompts import PromptTemplate
import os
import sys
sys.path.append(os.path.abspath(''))
class QuizGenerator:
...
0
votes
1
answer
23
views
Does python 3.12 allows to append items from the list to tuple, I am trying this but getting error TYPEERROR: 'tuple' object is not callable
Please find the below code, once I execute this code I am getting 'tuple' object is not callable error please give the solution, thanks in advance.
`mytuple = ("apple", "banana", &...
0
votes
2
answers
67
views
How can a Callable return a value from a predefined void callback?
I am using a data-related API interface which has a key void callback function that is automatically invoked to mark the end of some IO operations. I want to make the class Callable<String> and ...
-1
votes
1
answer
66
views
Make a `Callable` of my `Runnable` in Java
I have some tasks defined as Runnable objects. I want to invoke those tasks by using the invokeAll or invokeAny methods on ExecutorService.
The problem is that those methods take a collection of ...
0
votes
0
answers
70
views
CompletableFuture supplyAsync, thenApplyAsync, thenAcceptAsync working incorrect
I made Async CompletableFuture so that I would first make a payment and then sleep for 10 minutes. And this was repeated endlessly. But sleep once doesn't work anymore
public class PaymentWorker ...
-1
votes
1
answer
54
views
Spring Boot Asynchronous Controller via Callable not working
I want to make an endpoint that is asynchronous with Spring Boot.
I want to avoid Futures and thus @Async because it forces the use of futures.
I read and applied the code from this article : https://...
-1
votes
2
answers
77
views
How to pass a callable object as runnable object? Can we type cast Callable to Runnable?
How is the below structure possibly working?
Please explain.
Thanks in advance.
public abstract class AbstractCallableClass {
protected abstract V getCallable();
public void passRunnable() {
...
0
votes
0
answers
112
views
Haversine, module not callable
I want to use a function from haversine.
I installed the Haversine package (terminal: pip install haversine) but I can't run it.
import gurobipy as gp
from gurobipy import GRB
import random
import ...
0
votes
0
answers
12
views
'int' is not callable on my Object with a custom Function
I'm learning Objects & Classes and am doing some practice. I've essentially done the exact same thing before but now with different names for my Classes and Objects. Here's my code (the error ...
-2
votes
1
answer
108
views
Best way to call common methods from a Callable class?
I use java classes of type Callable (up to 200 in parallel), which call a method of a tool class (centralizing common methods), and I notice that if this method is not 'synchronized', I get errors.
I'...
0
votes
3
answers
105
views
C++17: pass multiple callable objects together with their parameters
I would like to write a function (C++17 if that matters) that accepts multiple callable objects together with their arguments and executes them in a loop. I would also like to avoid any intermediate ...
0
votes
1
answer
72
views
How to apply a (potentially) different callable to each row in a pandas DataFrame
I have a number of DataFrames, each with the same number of rows. input_df contains input data, param_df contains the parameters used for calculations, and output_df contains output data. One of the ...
2
votes
2
answers
90
views
How to access $this in the context of a callable outside of class scope?
class foo {
function bar(callable $callable) {
$callable();
}
function printStr() {
echo "hi";
}
}
$foo = new foo();
$foo->bar(function () {
$this-&...
1
vote
1
answer
2k
views
OpenAI is not callable
When I try to run the following code:
import os
from langchain.llms import OpenAI
from apikey import apikey
import streamlit as st
os.environ["OPENAI_API_KEY"] = apikey
st.title("...
8
votes
1
answer
306
views
How do you create a callable variable to call a class method with arguments?
I'm trying to create a callable variable for a class method.
class Person {
method walk(Str $direction) {
say "Walking $direction";
}
}
I can create a callable variable for ...