1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-23 19:36:37 +02:00

python: remove support of Python 2.x

This commit is contained in:
Sébastien Helleu
2022-10-15 22:56:06 +02:00
parent 7a544d5fcf
commit 319abf4fd0
44 changed files with 92 additions and 575 deletions
+2 -7
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2022 Sébastien Helleu <flashcode@flashtux.org>
@@ -32,10 +32,7 @@ import ast
import inspect
import os
import select
try:
from StringIO import StringIO # python 2
except ImportError:
from io import StringIO # python 3
from io import StringIO
import sys
sys.dont_write_bytecode = True
@@ -148,8 +145,6 @@ class UnparsePython(object):
def is_number(self, node): # pylint: disable=no-self-use
"""Check if the node is a number."""
# in python 2, number -1 is Num(n=-1)
# in Python 3, number -1 is UnaryOp(op=USub(), operand=Num(n=1))
return (isinstance(node, ast.Num) or
(isinstance(node, ast.UnaryOp) and
isinstance(node.op, (ast.UAdd, ast.USub))))