Skip to content

Commit 00a5863

Browse files
committed
fix!: Fix shadowing of python builtins
docs/conf.py:57:1: A001 Variable `copyright` is shadowing a Python builtin src/libtmux/common.py:142:9: A001 Variable `vars` is shadowing a Python builtin src/libtmux/common.py:179:9: A001 Variable `vars` is shadowing a Python builtin src/libtmux/server.py:618:25: A002 Argument `id` is shadowing a Python builtin src/libtmux/session.py:621:25: A002 Argument `id` is shadowing a Python builtin src/libtmux/window.py:656:25: A002 Argument `id` is shadowing a Python builtin
1 parent cea1967 commit 00a5863

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
master_doc = "index"
5555

5656
project = about["__title__"]
57-
copyright = about["__copyright__"]
57+
project_copyright = about["__copyright__"]
5858

5959
version = "%s" % (".".join(about["__version__"].split("."))[:2])
6060
release = "%s" % (about["__version__"])

src/libtmux/common.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ def show_environment(self) -> Dict[str, Union[bool, str]]:
137137
tmux_args += [self._add_option]
138138
cmd = self.cmd(*tmux_args)
139139
output = cmd.stdout
140-
vars = [tuple(item.split("=", 1)) for item in output]
141-
vars_dict: t.Dict[str, t.Union[str, bool]] = {}
142-
for _t in vars:
140+
opts = [tuple(item.split("=", 1)) for item in output]
141+
opts_dict: t.Dict[str, t.Union[str, bool]] = {}
142+
for _t in opts:
143143
if len(_t) == 2:
144-
vars_dict[_t[0]] = _t[1]
144+
opts_dict[_t[0]] = _t[1]
145145
elif len(_t) == 1:
146-
vars_dict[_t[0]] = True
146+
opts_dict[_t[0]] = True
147147
else:
148148
raise exc.VariableUnpackingError(variable=_t)
149149

150-
return vars_dict
150+
return opts_dict
151151

152152
def getenv(self, name: str) -> Optional[t.Union[str, bool]]:
153153
"""Show environment variable ``$ tmux show-environment -t [session] <name>``.
@@ -174,17 +174,17 @@ def getenv(self, name: str) -> Optional[t.Union[str, bool]]:
174174
tmux_args += (name,)
175175
cmd = self.cmd(*tmux_args)
176176
output = cmd.stdout
177-
vars = [tuple(item.split("=", 1)) for item in output]
178-
vars_dict: t.Dict[str, t.Union[str, bool]] = {}
179-
for _t in vars:
177+
opts = [tuple(item.split("=", 1)) for item in output]
178+
opts_dict: t.Dict[str, t.Union[str, bool]] = {}
179+
for _t in opts:
180180
if len(_t) == 2:
181-
vars_dict[_t[0]] = _t[1]
181+
opts_dict[_t[0]] = _t[1]
182182
elif len(_t) == 1:
183-
vars_dict[_t[0]] = True
183+
opts_dict[_t[0]] = True
184184
else:
185185
raise exc.VariableUnpackingError(variable=_t)
186186

187-
return vars_dict.get(name)
187+
return opts_dict.get(name)
188188

189189

190190
class tmux_cmd:

src/libtmux/server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def _update_panes(self) -> "Server":
606606
self._list_panes()
607607
return self
608608

609-
def get_by_id(self, id: str) -> t.Optional[Session]:
609+
def get_by_id(self, session_id: str) -> t.Optional[Session]:
610610
"""Return session by id. Deprecated in favor of :meth:`.sessions.get()`.
611611
612612
.. deprecated:: 0.16
@@ -615,7 +615,7 @@ def get_by_id(self, id: str) -> t.Optional[Session]:
615615
616616
"""
617617
warnings.warn("Server.get_by_id() is deprecated", stacklevel=2)
618-
return self.sessions.get(session_id=id, default=None)
618+
return self.sessions.get(session_id=session_id, default=None)
619619

620620
def where(self, kwargs: t.Dict[str, t.Any]) -> t.List[Session]:
621621
"""Filter through sessions, return list of :class:`Session`.

src/libtmux/session.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ def __getitem__(self, key: str) -> t.Any:
618618
)
619619
return getattr(self, key)
620620

621-
def get_by_id(self, id: str) -> t.Optional[Window]:
621+
def get_by_id(self, session_id: str) -> t.Optional[Window]:
622622
"""Return window by id. Deprecated in favor of :meth:`.windows.get()`.
623623
624624
.. deprecated:: 0.16
@@ -627,7 +627,7 @@ def get_by_id(self, id: str) -> t.Optional[Window]:
627627
628628
"""
629629
warnings.warn("Session.get_by_id() is deprecated", stacklevel=2)
630-
return self.windows.get(window_id=id, default=None)
630+
return self.windows.get(window_id=session_id, default=None)
631631

632632
def where(self, kwargs: t.Dict[str, t.Any]) -> t.List[Window]:
633633
"""Filter through windows, return list of :class:`Window`.

src/libtmux/window.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def __getitem__(self, key: str) -> t.Any:
653653
warnings.warn(f"Item lookups, e.g. window['{key}'] is deprecated", stacklevel=2)
654654
return getattr(self, key)
655655

656-
def get_by_id(self, id: str) -> t.Optional[Pane]:
656+
def get_by_id(self, pane_id: str) -> t.Optional[Pane]:
657657
"""Return pane by id. Deprecated in favor of :meth:`.panes.get()`.
658658
659659
.. deprecated:: 0.16
@@ -662,7 +662,7 @@ def get_by_id(self, id: str) -> t.Optional[Pane]:
662662
663663
"""
664664
warnings.warn("Window.get_by_id() is deprecated", stacklevel=2)
665-
return self.panes.get(pane_id=id, default=None)
665+
return self.panes.get(pane_id=pane_id, default=None)
666666

667667
def where(self, kwargs: t.Dict[str, t.Any]) -> t.List[Pane]:
668668
"""Filter through panes, return list of :class:`Pane`.

0 commit comments

Comments
 (0)