(
cls,
log, # type: str
pid, # type: int
timeout=5.0, # type: float
)
| 80 | |
| 81 | @classmethod |
| 82 | def record( |
| 83 | cls, |
| 84 | log, # type: str |
| 85 | pid, # type: int |
| 86 | timeout=5.0, # type: float |
| 87 | ): |
| 88 | # type: (...) -> Optional[Pidfile] |
| 89 | base_url = cls._read_base_url(log, timeout) |
| 90 | if not base_url: |
| 91 | return None |
| 92 | |
| 93 | create_time = cls._get_process_creation_time(pid) |
| 94 | if create_time is None: |
| 95 | return None |
| 96 | |
| 97 | url = "{base_url}/root/pypi/+simple/".format(base_url=base_url) |
| 98 | with safe_open(cls._PATH, "w") as fp: |
| 99 | json.dump(dict(url=url, pid=pid, create_time=create_time), fp, indent=2, sort_keys=True) |
| 100 | return cls(url=url, pid=pid, create_time=create_time) |
| 101 | |
| 102 | url = attr.ib() # type: str |
| 103 | pid = attr.ib() # type: int |
no test coverage detected