From 9e94f9002640face00f7d283baf0ac821bec1437 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sat, 21 Mar 2020 21:11:15 +0900 Subject: [PATCH] [builtin/declare] Update type annotations of functions --- core/state.py | 5 +++-- osh/builtin_assign.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/state.py b/core/state.py index 401720bdcf..d2a473edc7 100644 --- a/core/state.py +++ b/core/state.py @@ -1388,7 +1388,7 @@ def GetVar(self, name, lookup_mode=scope_e.Dynamic): return value.Undef() def GetCell(self, name, lookup_mode = scope_e.Dynamic): - # type: (str) -> cell + # type: (str, scope_t) -> cell """For the 'repr' builtin.""" cell, _ = self._ResolveNameOnly(name, lookup_mode) return cell @@ -1498,7 +1498,7 @@ def GetAllVars(self): return result def GetAllCells(self, lookup_mode = scope_e.Dynamic): - # type: () -> Dict[str, cell] + # type: (scope_t) -> Dict[str, cell] """Get all variables and their values, for 'set' builtin. """ result = {} # type: Dict[str, str] @@ -1521,6 +1521,7 @@ def GetAllCells(self, lookup_mode = scope_e.Dynamic): return result def IsGlobalScope(self): + # type: () -> bool return len(self.var_stack) == 1 def SetLocalString(mem, name, s): diff --git a/osh/builtin_assign.py b/osh/builtin_assign.py index b8db85fed6..a2aae31950 100644 --- a/osh/builtin_assign.py +++ b/osh/builtin_assign.py @@ -27,6 +27,7 @@ def _PrintVariables(mem, cmd_val, arg, print_flags, readonly = False, exported = False): + # type: (Mem, value_t, Any, bool, bool, bool) -> int flag_g = getattr(arg, 'g', None) flag_n = getattr(arg, 'n', None) flag_r = getattr(arg, 'r', None)