Commit 81dfefa0 authored by Kirill Smelkov's avatar Kirill Smelkov

*: __future__ += absolute_imports; Use unified __future__ everywhere

- we are going to introduce golang.time, and from inside there without
  `from __future__ import absolute_imports` it won't be possible to import
  needed stdlib's time.

- we were already doing `from __future__ import print_function`, but
  only in some files.

-> It makes sense to apply updated __future__ usage uniformly.
parent 1172e39f
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
... ...
""" """
from __future__ import print_function, absolute_import
__version__ = "0.0.1.post1" __version__ = "0.0.1.post1"
__all__ = ['go', 'chan', 'select', 'default', 'nilchan', 'defer', 'panic', 'recover', 'func', 'gimport'] __all__ = ['go', 'chan', 'select', 'default', 'nilchan', 'defer', 'panic', 'recover', 'func', 'gimport']
......
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -30,6 +30,8 @@ will import either ...@@ -30,6 +30,8 @@ will import either
located in src/ under $GOPATH. located in src/ under $GOPATH.
""" """
from __future__ import print_function, absolute_import
import os, os.path import os, os.path
import sys import sys
import imp import imp
......
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
import os, os.path import os, os.path
from golang._gopath import gimport from golang._gopath import gimport
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""compatibility in between py2/py3""" """compatibility in between py2/py3"""
from __future__ import print_function, absolute_import
from six import PY2 from six import PY2
if PY2: if PY2:
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2014-2018 Nexedi SA and Contributors. # Copyright (C) 2014-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -40,7 +40,8 @@ gives something like:: ...@@ -40,7 +40,8 @@ gives something like::
Benchmarkadd 50000000 0.020 µs/op Benchmarkadd 50000000 0.020 µs/op
Benchmarkadd 50000000 0.020 µs/op Benchmarkadd 50000000 0.020 µs/op
""" """
from __future__ import print_function
from __future__ import print_function, absolute_import
import sys import sys
......
...@@ -25,7 +25,7 @@ See the following links about Go contexts: ...@@ -25,7 +25,7 @@ See the following links about Go contexts:
https://golang.org/pkg/context https://golang.org/pkg/context
""" """
from __future__ import print_function from __future__ import print_function, absolute_import
from golang import go, chan, select, default, nilchan from golang import go, chan, select, default, nilchan
import threading import threading
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
from golang import context, nilchan from golang import context, nilchan
from golang.context import _ready as ready from golang.context import _ready as ready
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""Package gcompat provides Go-compatibility layer for Python""" """Package gcompat provides Go-compatibility layer for Python"""
from __future__ import print_function, absolute_import
from golang import strconv from golang import strconv
import six import six
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -19,3 +19,5 @@ ...@@ -19,3 +19,5 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
# qq is tested as part of strconv. # qq is tested as part of strconv.
from __future__ import print_function, absolute_import
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
from golang import go, chan, select, default, nilchan, _PanicError, func, panic, defer, recover from golang import go, chan, select, default, nilchan, _PanicError, func, panic, defer, recover
from pytest import raises from pytest import raises
from os.path import dirname from os.path import dirname
......
#!/usr/bin/env python #!/usr/bin/env python
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""This program tests that leaked goroutines don't prevent program to exit""" """This program tests that leaked goroutines don't prevent program to exit"""
from __future__ import print_function from __future__ import print_function, absolute_import
from golang import go, chan from golang import go, chan
import os, sys, time import os, sys, time
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""Package strconv provides Go-compatible string conversions""" """Package strconv provides Go-compatible string conversions"""
from __future__ import print_function, absolute_import
import six, unicodedata, codecs import six, unicodedata, codecs
from six.moves import range as xrange from six.moves import range as xrange
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
from golang.strconv import quote, unquote, unquote_next from golang.strconv import quote, unquote, unquote_next
from golang.gcompat import qq from golang.gcompat import qq
......
...@@ -24,6 +24,8 @@ See the following link about Go sync package: ...@@ -24,6 +24,8 @@ See the following link about Go sync package:
https://golang.org/pkg/sync https://golang.org/pkg/sync
""" """
from __future__ import print_function, absolute_import
import threading, sys import threading, sys
from golang import go, defer, func, panic from golang import go, defer, func, panic
from golang import context from golang import context
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
from golang import go, chan, _PanicError from golang import go, chan, _PanicError
from golang import sync, context from golang import sync, context
import time, threading import time, threading
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2017-2018 Nexedi SA and Contributors. # Copyright (C) 2017-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""Package testing mirrors Go testing package for things missed in Python""" """Package testing mirrors Go testing package for things missed in Python"""
from __future__ import print_function from __future__ import print_function, absolute_import
from time import time from time import time
from math import ceil, log10 from math import ceil, log10
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md
""" """
from __future__ import print_function from __future__ import print_function, absolute_import
import re, io, numpy as np import re, io, numpy as np
from collections import OrderedDict from collections import OrderedDict
......
...@@ -35,7 +35,7 @@ differences: ...@@ -35,7 +35,7 @@ differences:
# work correctly with `pip install` (gpython script is installed, but gpython module is not). # work correctly with `pip install` (gpython script is installed, but gpython module is not).
# NOTE don't import anything at global scope - we need gevent to be imported first. # NOTE don't import anything at global scope - we need gevent to be imported first.
from __future__ import print_function from __future__ import print_function, absolute_import
# pymain mimics `python ...` # pymain mimics `python ...`
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
import sys, os, golang, subprocess import sys, os, golang, subprocess
from six import PY2, PY3 from six import PY2, PY3
from six.moves import builtins from six.moves import builtins
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment