mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors. Reviewed By: shannonzhu Differential Revision: D18250419 fbshipit-source-id: b4ab494552f8ad6601224c03eab6ee5904b83255
This commit is contained in:
parent
017f709b05
commit
3f46bd1142
@ -895,6 +895,7 @@ class ConfigUpdater(object):
|
||||
return
|
||||
while True:
|
||||
self._lock_file = typing.cast(typing.TextIO, open(self._lock_path, "w+"))
|
||||
# pyre-fixme[16]: `Optional` has no attribute `fileno`.
|
||||
fcntl.flock(self._lock_file.fileno(), fcntl.LOCK_EX)
|
||||
# The original creator of the lock file will unlink it when
|
||||
# it is finished. Make sure we grab the lock on the file still on
|
||||
@ -907,6 +908,7 @@ class ConfigUpdater(object):
|
||||
|
||||
# We acquired a lock on an old deleted file.
|
||||
# Close it, and try to acquire the current lock file again.
|
||||
# pyre-fixme[16]: `Optional` has no attribute `close`.
|
||||
self._lock_file.close()
|
||||
self._lock_file = None
|
||||
continue
|
||||
@ -1037,6 +1039,7 @@ class EdenCheckout:
|
||||
def get_config(self) -> CheckoutConfig:
|
||||
if self._config is None:
|
||||
self._config = self._read_config()
|
||||
# pyre-fixme[7]: Expected `CheckoutConfig` but got `Optional[CheckoutConfig]`.
|
||||
return self._config
|
||||
|
||||
def save_config(self, checkout_config: CheckoutConfig) -> None:
|
||||
|
@ -90,6 +90,7 @@ class DirstateChecker(HgFileChecker):
|
||||
# If we need to update state make sure we reported an error
|
||||
if (
|
||||
self._new_parents != self._old_dirstate_parents
|
||||
# pyre-fixme[16]: `Optional` has no attribute `__getitem__`.
|
||||
or self._new_parents[0] != self._old_snapshot
|
||||
):
|
||||
assert errors
|
||||
@ -131,7 +132,10 @@ class DirstateChecker(HgFileChecker):
|
||||
return
|
||||
|
||||
self._old_snapshot = self._check_commit(
|
||||
errors, self._old_snapshot, "Eden's snapshot file"
|
||||
errors,
|
||||
# pyre-fixme[6]: Expected `bytes` for 2nd param but got `Optional[bytes]`.
|
||||
self._old_snapshot,
|
||||
"Eden's snapshot file",
|
||||
)
|
||||
|
||||
def _check_commit(
|
||||
|
@ -370,6 +370,7 @@ class FilesystemChecker:
|
||||
|
||||
def __enter__(self) -> "FilesystemChecker":
|
||||
self._overlay_lock = self.overlay.try_lock()
|
||||
# pyre-fixme[16]: `Optional` has no attribute `__enter__`.
|
||||
self._overlay_locked = self._overlay_lock.__enter__()
|
||||
return self
|
||||
|
||||
|
@ -96,6 +96,8 @@ class TerminalSettings:
|
||||
"""
|
||||
global _term_settings
|
||||
if _term_settings is not None:
|
||||
# pyre-fixme[7]: Expected `TerminalSettings` but got
|
||||
# `Optional[TerminalSettings]`.
|
||||
return _term_settings
|
||||
|
||||
import curses
|
||||
@ -129,6 +131,8 @@ class TerminalSettings:
|
||||
attributes=attributes,
|
||||
reset=reset,
|
||||
)
|
||||
# pyre-fixme[7]: Expected `TerminalSettings` but got
|
||||
# `Optional[TerminalSettings]`.
|
||||
return _term_settings
|
||||
|
||||
def get_attr_codes(
|
||||
|
@ -524,6 +524,7 @@ def can_run_eden() -> bool:
|
||||
if _can_run_eden is None:
|
||||
_can_run_eden = _compute_can_run_eden()
|
||||
|
||||
# pyre-fixme[7]: Expected `bool` but got `Optional[bool]`.
|
||||
return _can_run_eden
|
||||
|
||||
|
||||
@ -547,6 +548,7 @@ def can_run_sudo() -> bool:
|
||||
if _can_run_sudo is None:
|
||||
_can_run_sudo = _compute_can_run_sudo()
|
||||
|
||||
# pyre-fixme[7]: Expected `bool` but got `Optional[bool]`.
|
||||
return _can_run_sudo
|
||||
|
||||
|
||||
|
@ -21,11 +21,14 @@ class EdenFSSystemdMixin(metaclass=abc.ABCMeta):
|
||||
def set_up_edenfs_systemd_service(self) -> None:
|
||||
assert self.systemd is None
|
||||
self.systemd = self.make_temporary_systemd_user_service_manager()
|
||||
# pyre-fixme[16]: Optional type has no attribute
|
||||
# `enable_runtime_unit_from_file`.
|
||||
self.systemd.enable_runtime_unit_from_file(
|
||||
unit_file=pathlib.Path(
|
||||
typing.cast(str, FindExe.SYSTEMD_FB_EDENFS_SERVICE) # T38947910
|
||||
)
|
||||
)
|
||||
# pyre-fixme[16]: Optional type has no attribute `extra_env`.
|
||||
self.set_environment_variables(self.systemd.extra_env)
|
||||
|
||||
def get_edenfs_systemd_service(self, eden_dir: pathlib.Path) -> SystemdService:
|
||||
|
@ -37,7 +37,6 @@ class HgRepository(repobase.Repository):
|
||||
k: v for k, v in os.environ.items() if not k.startswith("HG")
|
||||
}
|
||||
self.hg_environment["HGPLAIN"] = "1"
|
||||
# pyre-fixme[6]: Expected `str` for 2nd param but got `Callable[[], str]`.
|
||||
self.hg_environment["HG_REAL_BIN"] = FindExe.HG_REAL
|
||||
self.hg_environment["NOSCMLOG"] = "1"
|
||||
# Set HGRCPATH to make sure we aren't affected by the local system's
|
||||
|
@ -56,20 +56,25 @@ class ServiceTestCaseBase(
|
||||
def tmp_dir(self) -> pathlib.Path:
|
||||
if self.__tmp_dir is None:
|
||||
self.__tmp_dir = pathlib.Path(self.make_temporary_directory())
|
||||
# pyre-fixme[7]: Expected `Path` but got `Optional[Path]`.
|
||||
return self.__tmp_dir
|
||||
|
||||
@property
|
||||
def etc_eden_dir(self) -> pathlib.Path:
|
||||
if self.__etc_eden_dir is None:
|
||||
self.__etc_eden_dir = self.tmp_dir / "etc_eden"
|
||||
# pyre-fixme[16]: Optional type has no attribute `mkdir`.
|
||||
self.__etc_eden_dir.mkdir()
|
||||
# pyre-fixme[7]: Expected `Path` but got `Optional[Path]`.
|
||||
return self.__etc_eden_dir
|
||||
|
||||
@property
|
||||
def home_dir(self) -> pathlib.Path:
|
||||
if self.__home_dir is None:
|
||||
self.__home_dir = self.tmp_dir / "home"
|
||||
# pyre-fixme[16]: Optional type has no attribute `mkdir`.
|
||||
self.__home_dir.mkdir()
|
||||
# pyre-fixme[7]: Expected `Path` but got `Optional[Path]`.
|
||||
return self.__home_dir
|
||||
|
||||
|
||||
|
@ -89,7 +89,6 @@ class EdenTestCase(
|
||||
is enabled for a test case.
|
||||
This can be removed once a future version of hypothesis
|
||||
ships with support for this baked in. """
|
||||
# pyre-fixme[16]: Module `testcase` has no attribute `is_hypothesis_test`.
|
||||
if is_hypothesis_test(getattr(self, self._testMethodName)):
|
||||
try:
|
||||
old_setUp = self.setUp
|
||||
|
Loading…
Reference in New Issue
Block a user