Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
flags.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# Copyright 2010-2025 Google LLC
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Collection of helpers to manage absl flags in colab."""
16
17
19 """Stub for absl flag to be used within a jupyter notebook."""
20
21 def __init__(self, name: str, value: str, doc: str):
22 self.__name = name
23 self.__value = value
24 self.__doc__ = doc
25
26 @property
27 def value(self) -> str:
28 """Returns the value passed at creation."""
29 return self.__value
30
31 @property
32 def name(self) -> str:
33 """Returns the name of the parameter."""
34 return self.__name
35
36
37def define_string(name: str, value: str, doc: str):
38 return NotebookStringFlag(name, value, doc)
39
40
42 """Stub for absl flag to be used within a jupyter notebook."""
43
44 def __init__(self, name: str, value: int, doc: str):
45 self.__name = name
46 self.__value = value
47 self.__doc__ = doc
48
49 @property
50 def value(self) -> int:
51 """Returns the value passed at creation."""
52 return self.__value
53
54 @property
55 def name(self) -> str:
56 """Returns the name of the parameter."""
57 return self.__name
58
59
60def define_integer(name: str, value: int, doc: str):
61 return NotebookIntFlag(name, value, doc)
62
63
65 """Stub for absl flag to be used within a jupyter notebook."""
66
67 def __init__(self, name: str, value: float, doc: str):
68 self.__name = name
69 self.__value = value
70 self.__doc__ = doc
71
72 @property
73 def value(self) -> float:
74 """Returns the value passed at creation."""
75 return self.__value
76
77 @property
78 def name(self) -> str:
79 """Returns the name of the parameter."""
80 return self.__name
81
82
83def define_float(name: str, value: bool, doc: str):
84 return NotebookFloatFlag(name, value, doc)
85
86
88 """Stub for absl flag to be used within a jupyter notebook."""
89
90 def __init__(self, name: str, value: bool, doc: str):
91 self.__name = name
92 self.__value = value
93 self.__doc__ = doc
94
95 @property
96 def value(self) -> bool:
97 """Returns the value passed at creation."""
98 return self.__value
99
100 @property
101 def name(self) -> str:
102 """Returns the name of the parameter."""
103 return self.__name
104
105
106def define_bool(name: str, value: bool, doc: str):
107 return NotebookBoolFlag(name, value, doc)
__init__(self, str name, bool value, str doc)
Definition flags.py:90
__init__(self, str name, float value, str doc)
Definition flags.py:67
__init__(self, str name, int value, str doc)
Definition flags.py:44
__init__(self, str name, str value, str doc)
Definition flags.py:21
define_bool(str name, bool value, str doc)
Definition flags.py:106
define_integer(str name, int value, str doc)
Definition flags.py:60
define_string(str name, str value, str doc)
Definition flags.py:37
define_float(str name, bool value, str doc)
Definition flags.py:83