Skip to content

Commit

Permalink
Fix Flake8 "F821 undefined name" error (Python2/3)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioburdisso committed May 13, 2020
1 parent f09989b commit 731a48c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pyss3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import numpy as np

from io import open
from sys import version_info
from time import time
from tqdm import tqdm
from math import pow, tanh
Expand Down Expand Up @@ -57,6 +58,10 @@
NOISE_FR = 1
MIN_MAD_SD = .03

PY2 = version_info[0] == 2
if not PY2:
basestring = None # to avoid the Flake8 "F821 undefined name" error


class SS3:
"""
Expand Down Expand Up @@ -2589,12 +2594,8 @@ def list_hash(str_list):

def is_a_collection(o):
"""Return True when the object ``o`` is a collection."""
from sys import version_info
py2 = version_info[0] == 2
if not py2:
basestring = None # to avoid the Flake8 "F821 undefined name" error
return hasattr(o, "__getitem__") and ((py2 and not isinstance(o, basestring)) or
(not py2 and not isinstance(o, (str, bytes))))
return hasattr(o, "__getitem__") and ((PY2 and not isinstance(o, basestring)) or
(not PY2 and not isinstance(o, (str, bytes))))


def vsum(v0, v1):
Expand Down

0 comments on commit 731a48c

Please sign in to comment.