bolt/spark/construct.py
def _argcheck(*args, **kwargs):
        """
        Check that arguments are consistent with spark array construction.

        Conditions are:
        (1) a positional argument is a SparkContext
        (2) keyword arg 'context' is a SparkContext
        (3) an argument is a BoltArraySpark, or
        (4) an argument is a nested list containing a BoltArraySpark
        """
        try:
            from pyspark import SparkContext
        except ImportError:
            return False

        cond1 = any([isinstance(arg, SparkContext) for arg in args])
        cond2 = isinstance(kwargs.get('context', None), SparkContext)
        cond3 = any([isinstance(arg, BoltArraySpark) for arg in args])
        cond4 = any([any([isinstance(sub, BoltArraySpark) for sub in arg])
                     if isinstance(arg, (tuple, list)) else False for arg in args])
        return cond1 or cond2 or cond3 or cond4
def _argcheck(*args, **kwargs):
        try:
            from pyspark import SparkContext
        except ImportError:
            return False

        cond1 = any([isinstance(arg, SparkContext) for arg in args])
        cond2 = isinstance(kwargs.get('context', None), SparkContext)
        cond3 = any([isinstance(arg, BoltArraySpark) for arg in args])
        cond4 = any([any([isinstance(sub, BoltArraySpark) for sub in arg])
                     if isinstance(arg, (tuple, list)) else False for arg in args])
        return cond1 or cond2 or cond3 or cond4
def _argcheck ( * args , * * kwargs ) : try : from pyspark import SparkContext except ImportError : return False cond1 = any ( [ isinstance ( arg , SparkContext ) for arg in args ] ) cond2 = isinstance ( kwargs . get ( 'context' , None ) , SparkContext ) cond3 = any ( [ isinstance ( arg , BoltArraySpark ) for arg in args ] ) cond4 = any ( [ any ( [ isinstance ( sub , BoltArraySpark ) for sub in arg ] ) if isinstance ( arg , ( tuple , list ) ) else False for arg in args ] ) return cond1 or cond2 or cond3 or cond4
Check that arguments are consistent with spark array construction.

        Conditions are:
        (1) a positional argument is a SparkContext
        (2) keyword arg 'context' is a SparkContext
        (3) an argument is a BoltArraySpark, or
        (4) an argument is a nested list containing a BoltArraySpark
Check that arguments are consistent with spark array construction .