* [PATCH] Fix E275 missing whitespace after keyword
@ 2022-11-21 11:01 Petr Lautrbach
2022-11-21 14:24 ` James Carter
0 siblings, 1 reply; 3+ messages in thread
From: Petr Lautrbach @ 2022-11-21 11:01 UTC (permalink / raw)
To: selinux; +Cc: Petr Lautrbach
Fixes:
./gui/polgengui.py:484:18: E275 missing whitespace after keyword
./gui/polgengui.py:530:18: E275 missing whitespace after keyword
./python/sepolgen/src/sepolgen/policygen.py:327:19: E275 missing whitespace after keyword
./python/sepolgen/src/sepolgen/policygen.py:329:11: E275 missing whitespace after keyword
./python/sepolicy/sepolicy/__init__.py:453:15: E275 missing whitespace after keyword
./python/sepolicy/sepolicy/generate.py:1351:28: E275 missing whitespace after keyword
./python/sepolicy/sepolicy/generate.py:1353:28: E275 missing whitespace after keyword
./python/sepolicy/sepolicy/gui.py:638:24: E275 missing whitespace after keyword
./python/sepolicy/sepolicy/gui.py:863:23: E275 missing whitespace after keyword
./python/sepolicy/sepolicy/gui.py:2177:16: E275 missing whitespace after keyword
./sandbox/sandbox:114:7: E275 missing whitespace after keyword
./sandbox/sandbox:134:11: E275 missing whitespace after keyword
./sandbox/sandbox:136:7: E275 missing whitespace after keyword
Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
---
gui/polgengui.py | 4 ++--
python/sepolgen/src/sepolgen/policygen.py | 4 ++--
python/sepolicy/sepolicy/__init__.py | 4 ++--
python/sepolicy/sepolicy/generate.py | 4 ++--
python/sepolicy/sepolicy/gui.py | 6 +++---
sandbox/sandbox | 6 +++---
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/gui/polgengui.py b/gui/polgengui.py
index 7a3ecd50c91c..16116ba68b61 100644
--- a/gui/polgengui.py
+++ b/gui/polgengui.py
@@ -481,7 +481,7 @@ class childWindow:
my_policy = sepolicy.generate.policy(self.get_name(), self.get_type())
iter = self.boolean_store.get_iter_first()
- while(iter):
+ while iter:
my_policy.add_boolean(self.boolean_store.get_value(iter, 0), self.boolean_store.get_value(iter, 1))
iter = self.boolean_store.iter_next(iter)
@@ -527,7 +527,7 @@ class childWindow:
my_policy.set_out_udp(self.out_udp_all_checkbutton.get_active(), self.out_udp_entry.get_text())
iter = self.store.get_iter_first()
- while(iter):
+ while iter:
if self.store.get_value(iter, 1) == FILE:
my_policy.add_file(self.store.get_value(iter, 0))
else:
diff --git a/python/sepolgen/src/sepolgen/policygen.py b/python/sepolgen/src/sepolgen/policygen.py
index 8f0ce26e4dc7..183b41a93d50 100644
--- a/python/sepolgen/src/sepolgen/policygen.py
+++ b/python/sepolgen/src/sepolgen/policygen.py
@@ -324,9 +324,9 @@ def call_interface(interface, av):
ifcall.args.append(av.obj_class)
else:
print(params[i].type)
- assert(0)
+ assert 0
- assert(len(ifcall.args) > 0)
+ assert len(ifcall.args) > 0
return ifcall
diff --git a/python/sepolicy/sepolicy/__init__.py b/python/sepolicy/sepolicy/__init__.py
index 9c3caa05b80b..05888e5cb94a 100644
--- a/python/sepolicy/sepolicy/__init__.py
+++ b/python/sepolicy/sepolicy/__init__.py
@@ -450,9 +450,9 @@ def get_conditionals(src, dest, tclass, perm):
tlist.append(tdict)
tdict = {}
except KeyError:
- return(tlist)
+ return tlist
- return (tlist)
+ return tlist
def get_conditionals_format_text(cond):
diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py
index 3717d5d4ed78..b6df3e91160b 100644
--- a/python/sepolicy/sepolicy/generate.py
+++ b/python/sepolicy/sepolicy/generate.py
@@ -1346,9 +1346,9 @@ allow %s_t %s_t:%s_socket name_%s;
if len(temp_dirs) != 0:
for i in temp_dirs:
if i in self.dirs.keys():
- del(self.dirs[i])
+ del self.dirs[i]
elif i in self.files.keys():
- del(self.files[i])
+ del self.files[i]
else:
continue
diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
index 335be582b668..c8f33f522a2d 100644
--- a/python/sepolicy/sepolicy/gui.py
+++ b/python/sepolicy/sepolicy/gui.py
@@ -635,7 +635,7 @@ class SELinuxGui():
for k in self.cur_dict:
for j in self.cur_dict[k]:
if i == ctr:
- del(self.cur_dict[k][j])
+ del self.cur_dict[k][j]
return
i += 1
@@ -860,7 +860,7 @@ class SELinuxGui():
if val is True or val is False or val is None:
continue
# Returns true if filter_txt exists within the val
- if(val.find(self.filter_txt) != -1 or val.lower().find(self.filter_txt) != -1):
+ if val.find(self.filter_txt) != -1 or val.lower().find(self.filter_txt) != -1:
return True
except (AttributeError, TypeError):
pass
@@ -2174,7 +2174,7 @@ class SELinuxGui():
model.set_value(iter, 0, not model.get_value(iter, 0))
active = model.get_value(iter, 0)
if name in self.cur_dict["boolean"]:
- del(self.cur_dict["boolean"][name])
+ del self.cur_dict["boolean"][name]
else:
self.cur_dict["boolean"][name] = {"active": active}
self.new_updates()
diff --git a/sandbox/sandbox b/sandbox/sandbox
index 770807345858..a2762a7d215a 100644
--- a/sandbox/sandbox
+++ b/sandbox/sandbox
@@ -111,7 +111,7 @@ def copyfile(file, srcdir, dest):
def savefile(new, orig, X_ind):
copy = False
- if(X_ind):
+ if X_ind:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
@@ -131,9 +131,9 @@ def savefile(new, orig, X_ind):
except NameError:
pass
ans = input(_("Do you want to save changes to '%s' (y/N): ") % orig)
- if(re.match(_("[yY]"), ans)):
+ if re.match(_("[yY]"), ans):
copy = True
- if(copy):
+ if copy:
shutil.copy2(new, orig)
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix E275 missing whitespace after keyword
2022-11-21 11:01 [PATCH] Fix E275 missing whitespace after keyword Petr Lautrbach
@ 2022-11-21 14:24 ` James Carter
2022-11-23 15:05 ` James Carter
0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2022-11-21 14:24 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: selinux
On Mon, Nov 21, 2022 at 6:06 AM Petr Lautrbach <lautrbach@redhat.com> wrote:
>
> Fixes:
> ./gui/polgengui.py:484:18: E275 missing whitespace after keyword
> ./gui/polgengui.py:530:18: E275 missing whitespace after keyword
> ./python/sepolgen/src/sepolgen/policygen.py:327:19: E275 missing whitespace after keyword
> ./python/sepolgen/src/sepolgen/policygen.py:329:11: E275 missing whitespace after keyword
> ./python/sepolicy/sepolicy/__init__.py:453:15: E275 missing whitespace after keyword
> ./python/sepolicy/sepolicy/generate.py:1351:28: E275 missing whitespace after keyword
> ./python/sepolicy/sepolicy/generate.py:1353:28: E275 missing whitespace after keyword
> ./python/sepolicy/sepolicy/gui.py:638:24: E275 missing whitespace after keyword
> ./python/sepolicy/sepolicy/gui.py:863:23: E275 missing whitespace after keyword
> ./python/sepolicy/sepolicy/gui.py:2177:16: E275 missing whitespace after keyword
> ./sandbox/sandbox:114:7: E275 missing whitespace after keyword
> ./sandbox/sandbox:134:11: E275 missing whitespace after keyword
> ./sandbox/sandbox:136:7: E275 missing whitespace after keyword
>
> Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
> ---
> gui/polgengui.py | 4 ++--
> python/sepolgen/src/sepolgen/policygen.py | 4 ++--
> python/sepolicy/sepolicy/__init__.py | 4 ++--
> python/sepolicy/sepolicy/generate.py | 4 ++--
> python/sepolicy/sepolicy/gui.py | 6 +++---
> sandbox/sandbox | 6 +++---
> 6 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/gui/polgengui.py b/gui/polgengui.py
> index 7a3ecd50c91c..16116ba68b61 100644
> --- a/gui/polgengui.py
> +++ b/gui/polgengui.py
> @@ -481,7 +481,7 @@ class childWindow:
> my_policy = sepolicy.generate.policy(self.get_name(), self.get_type())
>
> iter = self.boolean_store.get_iter_first()
> - while(iter):
> + while iter:
> my_policy.add_boolean(self.boolean_store.get_value(iter, 0), self.boolean_store.get_value(iter, 1))
> iter = self.boolean_store.iter_next(iter)
>
> @@ -527,7 +527,7 @@ class childWindow:
> my_policy.set_out_udp(self.out_udp_all_checkbutton.get_active(), self.out_udp_entry.get_text())
>
> iter = self.store.get_iter_first()
> - while(iter):
> + while iter:
> if self.store.get_value(iter, 1) == FILE:
> my_policy.add_file(self.store.get_value(iter, 0))
> else:
> diff --git a/python/sepolgen/src/sepolgen/policygen.py b/python/sepolgen/src/sepolgen/policygen.py
> index 8f0ce26e4dc7..183b41a93d50 100644
> --- a/python/sepolgen/src/sepolgen/policygen.py
> +++ b/python/sepolgen/src/sepolgen/policygen.py
> @@ -324,9 +324,9 @@ def call_interface(interface, av):
> ifcall.args.append(av.obj_class)
> else:
> print(params[i].type)
> - assert(0)
> + assert 0
>
> - assert(len(ifcall.args) > 0)
> + assert len(ifcall.args) > 0
>
> return ifcall
>
> diff --git a/python/sepolicy/sepolicy/__init__.py b/python/sepolicy/sepolicy/__init__.py
> index 9c3caa05b80b..05888e5cb94a 100644
> --- a/python/sepolicy/sepolicy/__init__.py
> +++ b/python/sepolicy/sepolicy/__init__.py
> @@ -450,9 +450,9 @@ def get_conditionals(src, dest, tclass, perm):
> tlist.append(tdict)
> tdict = {}
> except KeyError:
> - return(tlist)
> + return tlist
>
> - return (tlist)
> + return tlist
>
>
> def get_conditionals_format_text(cond):
> diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py
> index 3717d5d4ed78..b6df3e91160b 100644
> --- a/python/sepolicy/sepolicy/generate.py
> +++ b/python/sepolicy/sepolicy/generate.py
> @@ -1346,9 +1346,9 @@ allow %s_t %s_t:%s_socket name_%s;
> if len(temp_dirs) != 0:
> for i in temp_dirs:
> if i in self.dirs.keys():
> - del(self.dirs[i])
> + del self.dirs[i]
> elif i in self.files.keys():
> - del(self.files[i])
> + del self.files[i]
> else:
> continue
>
> diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
> index 335be582b668..c8f33f522a2d 100644
> --- a/python/sepolicy/sepolicy/gui.py
> +++ b/python/sepolicy/sepolicy/gui.py
> @@ -635,7 +635,7 @@ class SELinuxGui():
> for k in self.cur_dict:
> for j in self.cur_dict[k]:
> if i == ctr:
> - del(self.cur_dict[k][j])
> + del self.cur_dict[k][j]
> return
> i += 1
>
> @@ -860,7 +860,7 @@ class SELinuxGui():
> if val is True or val is False or val is None:
> continue
> # Returns true if filter_txt exists within the val
> - if(val.find(self.filter_txt) != -1 or val.lower().find(self.filter_txt) != -1):
> + if val.find(self.filter_txt) != -1 or val.lower().find(self.filter_txt) != -1:
> return True
> except (AttributeError, TypeError):
> pass
> @@ -2174,7 +2174,7 @@ class SELinuxGui():
> model.set_value(iter, 0, not model.get_value(iter, 0))
> active = model.get_value(iter, 0)
> if name in self.cur_dict["boolean"]:
> - del(self.cur_dict["boolean"][name])
> + del self.cur_dict["boolean"][name]
> else:
> self.cur_dict["boolean"][name] = {"active": active}
> self.new_updates()
> diff --git a/sandbox/sandbox b/sandbox/sandbox
> index 770807345858..a2762a7d215a 100644
> --- a/sandbox/sandbox
> +++ b/sandbox/sandbox
> @@ -111,7 +111,7 @@ def copyfile(file, srcdir, dest):
>
> def savefile(new, orig, X_ind):
> copy = False
> - if(X_ind):
> + if X_ind:
> import gi
> gi.require_version('Gtk', '3.0')
> from gi.repository import Gtk
> @@ -131,9 +131,9 @@ def savefile(new, orig, X_ind):
> except NameError:
> pass
> ans = input(_("Do you want to save changes to '%s' (y/N): ") % orig)
> - if(re.match(_("[yY]"), ans)):
> + if re.match(_("[yY]"), ans):
> copy = True
> - if(copy):
> + if copy:
> shutil.copy2(new, orig)
>
>
> --
> 2.38.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix E275 missing whitespace after keyword
2022-11-21 14:24 ` James Carter
@ 2022-11-23 15:05 ` James Carter
0 siblings, 0 replies; 3+ messages in thread
From: James Carter @ 2022-11-23 15:05 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: selinux
On Mon, Nov 21, 2022 at 9:24 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Mon, Nov 21, 2022 at 6:06 AM Petr Lautrbach <lautrbach@redhat.com> wrote:
> >
> > Fixes:
> > ./gui/polgengui.py:484:18: E275 missing whitespace after keyword
> > ./gui/polgengui.py:530:18: E275 missing whitespace after keyword
> > ./python/sepolgen/src/sepolgen/policygen.py:327:19: E275 missing whitespace after keyword
> > ./python/sepolgen/src/sepolgen/policygen.py:329:11: E275 missing whitespace after keyword
> > ./python/sepolicy/sepolicy/__init__.py:453:15: E275 missing whitespace after keyword
> > ./python/sepolicy/sepolicy/generate.py:1351:28: E275 missing whitespace after keyword
> > ./python/sepolicy/sepolicy/generate.py:1353:28: E275 missing whitespace after keyword
> > ./python/sepolicy/sepolicy/gui.py:638:24: E275 missing whitespace after keyword
> > ./python/sepolicy/sepolicy/gui.py:863:23: E275 missing whitespace after keyword
> > ./python/sepolicy/sepolicy/gui.py:2177:16: E275 missing whitespace after keyword
> > ./sandbox/sandbox:114:7: E275 missing whitespace after keyword
> > ./sandbox/sandbox:134:11: E275 missing whitespace after keyword
> > ./sandbox/sandbox:136:7: E275 missing whitespace after keyword
> >
> > Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>
Merged.
Thanks,
Jim
> > ---
> > gui/polgengui.py | 4 ++--
> > python/sepolgen/src/sepolgen/policygen.py | 4 ++--
> > python/sepolicy/sepolicy/__init__.py | 4 ++--
> > python/sepolicy/sepolicy/generate.py | 4 ++--
> > python/sepolicy/sepolicy/gui.py | 6 +++---
> > sandbox/sandbox | 6 +++---
> > 6 files changed, 14 insertions(+), 14 deletions(-)
> >
> > diff --git a/gui/polgengui.py b/gui/polgengui.py
> > index 7a3ecd50c91c..16116ba68b61 100644
> > --- a/gui/polgengui.py
> > +++ b/gui/polgengui.py
> > @@ -481,7 +481,7 @@ class childWindow:
> > my_policy = sepolicy.generate.policy(self.get_name(), self.get_type())
> >
> > iter = self.boolean_store.get_iter_first()
> > - while(iter):
> > + while iter:
> > my_policy.add_boolean(self.boolean_store.get_value(iter, 0), self.boolean_store.get_value(iter, 1))
> > iter = self.boolean_store.iter_next(iter)
> >
> > @@ -527,7 +527,7 @@ class childWindow:
> > my_policy.set_out_udp(self.out_udp_all_checkbutton.get_active(), self.out_udp_entry.get_text())
> >
> > iter = self.store.get_iter_first()
> > - while(iter):
> > + while iter:
> > if self.store.get_value(iter, 1) == FILE:
> > my_policy.add_file(self.store.get_value(iter, 0))
> > else:
> > diff --git a/python/sepolgen/src/sepolgen/policygen.py b/python/sepolgen/src/sepolgen/policygen.py
> > index 8f0ce26e4dc7..183b41a93d50 100644
> > --- a/python/sepolgen/src/sepolgen/policygen.py
> > +++ b/python/sepolgen/src/sepolgen/policygen.py
> > @@ -324,9 +324,9 @@ def call_interface(interface, av):
> > ifcall.args.append(av.obj_class)
> > else:
> > print(params[i].type)
> > - assert(0)
> > + assert 0
> >
> > - assert(len(ifcall.args) > 0)
> > + assert len(ifcall.args) > 0
> >
> > return ifcall
> >
> > diff --git a/python/sepolicy/sepolicy/__init__.py b/python/sepolicy/sepolicy/__init__.py
> > index 9c3caa05b80b..05888e5cb94a 100644
> > --- a/python/sepolicy/sepolicy/__init__.py
> > +++ b/python/sepolicy/sepolicy/__init__.py
> > @@ -450,9 +450,9 @@ def get_conditionals(src, dest, tclass, perm):
> > tlist.append(tdict)
> > tdict = {}
> > except KeyError:
> > - return(tlist)
> > + return tlist
> >
> > - return (tlist)
> > + return tlist
> >
> >
> > def get_conditionals_format_text(cond):
> > diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py
> > index 3717d5d4ed78..b6df3e91160b 100644
> > --- a/python/sepolicy/sepolicy/generate.py
> > +++ b/python/sepolicy/sepolicy/generate.py
> > @@ -1346,9 +1346,9 @@ allow %s_t %s_t:%s_socket name_%s;
> > if len(temp_dirs) != 0:
> > for i in temp_dirs:
> > if i in self.dirs.keys():
> > - del(self.dirs[i])
> > + del self.dirs[i]
> > elif i in self.files.keys():
> > - del(self.files[i])
> > + del self.files[i]
> > else:
> > continue
> >
> > diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
> > index 335be582b668..c8f33f522a2d 100644
> > --- a/python/sepolicy/sepolicy/gui.py
> > +++ b/python/sepolicy/sepolicy/gui.py
> > @@ -635,7 +635,7 @@ class SELinuxGui():
> > for k in self.cur_dict:
> > for j in self.cur_dict[k]:
> > if i == ctr:
> > - del(self.cur_dict[k][j])
> > + del self.cur_dict[k][j]
> > return
> > i += 1
> >
> > @@ -860,7 +860,7 @@ class SELinuxGui():
> > if val is True or val is False or val is None:
> > continue
> > # Returns true if filter_txt exists within the val
> > - if(val.find(self.filter_txt) != -1 or val.lower().find(self.filter_txt) != -1):
> > + if val.find(self.filter_txt) != -1 or val.lower().find(self.filter_txt) != -1:
> > return True
> > except (AttributeError, TypeError):
> > pass
> > @@ -2174,7 +2174,7 @@ class SELinuxGui():
> > model.set_value(iter, 0, not model.get_value(iter, 0))
> > active = model.get_value(iter, 0)
> > if name in self.cur_dict["boolean"]:
> > - del(self.cur_dict["boolean"][name])
> > + del self.cur_dict["boolean"][name]
> > else:
> > self.cur_dict["boolean"][name] = {"active": active}
> > self.new_updates()
> > diff --git a/sandbox/sandbox b/sandbox/sandbox
> > index 770807345858..a2762a7d215a 100644
> > --- a/sandbox/sandbox
> > +++ b/sandbox/sandbox
> > @@ -111,7 +111,7 @@ def copyfile(file, srcdir, dest):
> >
> > def savefile(new, orig, X_ind):
> > copy = False
> > - if(X_ind):
> > + if X_ind:
> > import gi
> > gi.require_version('Gtk', '3.0')
> > from gi.repository import Gtk
> > @@ -131,9 +131,9 @@ def savefile(new, orig, X_ind):
> > except NameError:
> > pass
> > ans = input(_("Do you want to save changes to '%s' (y/N): ") % orig)
> > - if(re.match(_("[yY]"), ans)):
> > + if re.match(_("[yY]"), ans):
> > copy = True
> > - if(copy):
> > + if copy:
> > shutil.copy2(new, orig)
> >
> >
> > --
> > 2.38.1
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-23 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 11:01 [PATCH] Fix E275 missing whitespace after keyword Petr Lautrbach
2022-11-21 14:24 ` James Carter
2022-11-23 15:05 ` James Carter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.