1 Star 0 Fork 25

konglidong/tuned

forked from src-openEuler/tuned 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0099-Fix-checking-for-None-values.patch 2.55 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 23:18 +08:00 . Package init
From 9e6913231d307590fd6a9bc024be549aaa2d8c5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
Date: Tue, 5 Mar 2019 10:31:42 +0100
Subject: [PATCH 099/124] Fix checking for None values
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In python, 'is None' should be used instead of '== None' to check if
something is None.
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
---
experiments/kwin-stop/xlib-example.py | 2 +-
tuned/plugins/plugin_systemd.py | 2 +-
tuned/profiles/merger.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/experiments/kwin-stop/xlib-example.py b/experiments/kwin-stop/xlib-example.py
index b8477a5..a0d6206 100644
--- a/experiments/kwin-stop/xlib-example.py
+++ b/experiments/kwin-stop/xlib-example.py
@@ -32,7 +32,7 @@ def loop():
root = dpy.screen(num).root
for win in root.get_full_property(dpy.get_atom('_NET_CLIENT_LIST'), 0).value.tolist():
window = dpy.create_resource_object('window', win)
- if window.get_full_property(dpy.get_atom('_NET_WM_STATE'), Xatom.WINDOW) == None:
+ if window.get_full_property(dpy.get_atom('_NET_WM_STATE'), Xatom.WINDOW) is None:
continue
if dpy.get_atom("_NET_WM_STATE_HIDDEN") in window.get_full_property(dpy.get_atom('_NET_WM_STATE'), 0).value.tolist():
if not win in hidden:
diff --git a/tuned/plugins/plugin_systemd.py b/tuned/plugins/plugin_systemd.py
index f6857c5..8f6bbc8 100644
--- a/tuned/plugins/plugin_systemd.py
+++ b/tuned/plugins/plugin_systemd.py
@@ -61,7 +61,7 @@ class SystemdPlugin(base.Plugin):
def _read_systemd_system_conf(self):
systemd_system_conf = self._cmd.read_file(consts.SYSTEMD_SYSTEM_CONF_FILE, err_ret = None)
- if systemd_system_conf == None:
+ if systemd_system_conf is None:
log.error("error reading systemd configuration file")
return None
return systemd_system_conf
diff --git a/tuned/profiles/merger.py b/tuned/profiles/merger.py
index 7a3e05c..2364543 100644
--- a/tuned/profiles/merger.py
+++ b/tuned/profiles/merger.py
@@ -33,7 +33,7 @@ class Merger(object):
profile_a.units[unit_name].type = unit.type
profile_a.units[unit_name].enabled = unit.enabled
profile_a.units[unit_name].devices = unit.devices
- if unit.devices_udev_regex != None:
+ if unit.devices_udev_regex is not None:
profile_a.units[unit_name].devices_udev_regex = unit.devices_udev_regex
if unit.script_pre is not None:
profile_a.units[unit_name].script_pre = unit.script_pre
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/konglidong/tuned.git
git@gitee.com:konglidong/tuned.git
konglidong
tuned
tuned
master

搜索帮助