(value: str)
| 348 | |
| 349 | |
| 350 | def parse_nginx_timestamp(value: str) -> str | None: |
| 351 | match = re.match( |
| 352 | r"^(?P<day>\d{2})/(?P<month>[A-Za-z]{3})/(?P<year>\d{4}):" |
| 353 | r"(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2}) (?P<offset>[+-]\d{4})$", |
| 354 | value, |
| 355 | ) |
| 356 | if not match: |
| 357 | return None |
| 358 | month = NGINX_MONTHS.get(match.group("month")) |
| 359 | if month is None: |
| 360 | return None |
| 361 | offset = match.group("offset") |
| 362 | iso = ( |
| 363 | f"{match.group('year')}-{month:02d}-{match.group('day')}T" |
| 364 | f"{match.group('hour')}:{match.group('minute')}:{match.group('second')}" |
| 365 | f"{offset[:3]}:{offset[3:]}" |
| 366 | ) |
| 367 | try: |
| 368 | return datetime.fromisoformat(iso).isoformat() |
| 369 | except ValueError: |
| 370 | return None |
| 371 | |
| 372 | |
| 373 | def get_listener_map(ports: list[int] | None = None) -> dict[int, ListenerInfo]: |
no outgoing calls
no test coverage detected