Every line of 'get first item in tuple python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
22 def get_tuple(x): 23 """ 24 Get oemof tuple within iterable or create it. 25 26 Tuples from Pyomo are of type `(n, n, int)`, `(n, n)` and `(n, int)`. 27 For single nodes `n` a tuple with one object `(n,)` is created. 28 """ 29 for i in x: 30 if isinstance(i, tuple): 31 return i 32 elif issubclass(type(i), Node): 33 return i, 34 else: 35 pass