Parse the constraint. Parameters ---------- check : string String representation of the constraint. reverse : bool, optional (default=False) Whether to reverse the sign of the constraint. Returns ------- pair : tuple
(check, reverse=False)
| 169 | Path to the file with parameters documentation. |
| 170 | """ |
| 171 | def parse_check(check, reverse=False): |
| 172 | """Parse the constraint. |
| 173 | |
| 174 | Parameters |
| 175 | ---------- |
| 176 | check : string |
| 177 | String representation of the constraint. |
| 178 | reverse : bool, optional (default=False) |
| 179 | Whether to reverse the sign of the constraint. |
| 180 | |
| 181 | Returns |
| 182 | ------- |
| 183 | pair : tuple |
| 184 | Parsed constraint in the form of tuple (value, sign). |
| 185 | """ |
| 186 | try: |
| 187 | idx = 1 |
| 188 | float(check[idx:]) |
| 189 | except ValueError: |
| 190 | idx = 2 |
| 191 | float(check[idx:]) |
| 192 | if reverse: |
| 193 | reversed_sign = {'<': '>', '>': '<', '<=': '>=', '>=': '<='} |
| 194 | return check[idx:], reversed_sign[check[:idx]] |
| 195 | else: |
| 196 | return check[idx:], check[:idx] |
| 197 | |
| 198 | params_to_write = [] |
| 199 | for section_name, section_params in zip(sections, descriptions): |
no outgoing calls
no test coverage detected