mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-19 12:44:32 +00:00
python/sepolgen: do not import twice the modules
util.py starts by importing "locale" and "sys", so there is no need to import these modules again in the functions. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
646bdeb939
commit
03c708d28d
@ -90,7 +90,6 @@ def first(s, sorted=False):
|
|||||||
return x
|
return x
|
||||||
|
|
||||||
def encode_input(text):
|
def encode_input(text):
|
||||||
import locale
|
|
||||||
"""Encode given text via preferred system encoding"""
|
"""Encode given text via preferred system encoding"""
|
||||||
# locale will often find out the correct encoding
|
# locale will often find out the correct encoding
|
||||||
encoding = locale.getpreferredencoding()
|
encoding = locale.getpreferredencoding()
|
||||||
@ -104,7 +103,6 @@ def encode_input(text):
|
|||||||
return encoded_text
|
return encoded_text
|
||||||
|
|
||||||
def decode_input(text):
|
def decode_input(text):
|
||||||
import locale
|
|
||||||
"""Decode given text via preferred system encoding"""
|
"""Decode given text via preferred system encoding"""
|
||||||
# locale will often find out the correct encoding
|
# locale will often find out the correct encoding
|
||||||
encoding = locale.getpreferredencoding()
|
encoding = locale.getpreferredencoding()
|
||||||
@ -172,11 +170,9 @@ def cmp(first, second):
|
|||||||
return (first > second) - (second > first)
|
return (first > second) - (second > first)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
p = ConsoleProgressBar(sys.stdout, steps=999)
|
p = ConsoleProgressBar(sys.stdout, steps=999)
|
||||||
p.start("computing pi")
|
p.start("computing pi")
|
||||||
for i in range(999):
|
for i in range(999):
|
||||||
p.step()
|
p.step()
|
||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user