Skip to content

Commit e7ddf82

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 71145a1 commit e7ddf82

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
@@ -139,17 +139,17 @@ def show_environment(self) -> Dict[str, Union[bool, str]]:
139139
tmux_args += [self._add_option]
140140
cmd = self.cmd(*tmux_args)
141141
output = cmd.stdout
142-
vars = [tuple(item.split("=", 1)) for item in output]
143-
vars_dict: t.Dict[str, t.Union[str, bool]] = {}
144-
for _t in vars:
142+
opts = [tuple(item.split("=", 1)) for item in output]
143+
opts_dict: t.Dict[str, t.Union[str, bool]] = {}
144+
for _t in opts:
145145
if len(_t) == 2:
146-
vars_dict[_t[0]] = _t[1]
146+
opts_dict[_t[0]] = _t[1]
147147
elif len(_t) == 1:
148-
vars_dict[_t[0]] = True
148+
opts_dict[_t[0]] = True
149149
else:
150150
raise exc.VariableUnpackingError(variable=_t)
151151

152-
return vars_dict
152+
return opts_dict
153153

154154
def getenv(self, name: str) -> Optional[t.Union[str, bool]]:
155155
"""Show environment variable ``$ tmux show-environment -t [session] <name>``.
@@ -176,17 +176,17 @@ def getenv(self, name: str) -> Optional[t.Union[str, bool]]:
176176
tmux_args += (name,)
177177
cmd = self.cmd(*tmux_args)
178178
output = cmd.stdout
179-
vars = [tuple(item.split("=", 1)) for item in output]
180-
vars_dict: t.Dict[str, t.Union[str, bool]] = {}
181-
for _t in vars:
179+
opts = [tuple(item.split("=", 1)) for item in output]
180+
opts_dict: t.Dict[str, t.Union[str, bool]] = {}
181+
for _t in opts:
182182
if len(_t) == 2:
183-
vars_dict[_t[0]] = _t[1]
183+
opts_dict[_t[0]] = _t[1]
184184
elif len(_t) == 1:
185-
vars_dict[_t[0]] = True
185+
opts_dict[_t[0]] = True
186186
else:
187187
raise exc.VariableUnpackingError(variable=_t)
188188

189-
return vars_dict.get(name)
189+
return opts_dict.get(name)
190190

191191

192192
class tmux_cmd:

src/libtmux/server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def _update_panes(self) -> "Server":
615615
self._list_panes()
616616
return self
617617

618-
def get_by_id(self, id: str) -> t.Optional[Session]:
618+
def get_by_id(self, session_id: str) -> t.Optional[Session]:
619619
"""Return session by id. Deprecated in favor of :meth:`.sessions.get()`.
620620
621621
.. deprecated:: 0.16
@@ -624,7 +624,7 @@ def get_by_id(self, id: str) -> t.Optional[Session]:
624624
625625
"""
626626
warnings.warn("Server.get_by_id() is deprecated", stacklevel=2)
627-
return self.sessions.get(session_id=id, default=None)
627+
return self.sessions.get(session_id=session_id, default=None)
628628

629629
def where(self, kwargs: t.Dict[str, t.Any]) -> t.List[Session]:
630630
"""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)