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