GChartWrapper/encoding.py
def encode(self,  *args, **kwargs):
        """Encode wrapper for a dataset with maximum value

        Datasets can be one or two dimensional
        Strings are ignored as ordinal encoding"""
        if isinstance(args[0], str):
            return self.encode([args[0]],**kwargs)
        elif isinstance(args[0], int) or isinstance(args[0], float):
            return self.encode([[args[0]]],**kwargs)
        if len(args)>1:
            dataset = args
        else:
            dataset = args[0]
        typemap = list(map(type,dataset))
        code = self.encoding[0]
        if type('') in typemap:
            data = ','.join(map(str,dataset))
        elif type([]) in typemap or type(()) in typemap:
            data = self.codeset['char'].join(map(self.encodedata, dataset))
        elif len(dataset) == 1 and hasattr(dataset[0], '__iter__'):
            data = self.encodedata(dataset[0])
        else:
            try:
                data = self.encodedata(dataset)
            except ValueError:
                data = self.encodedata(','.join(map(unicode,dataset)))
        if not '.' in data and code == 't':
            code = 'e'
        return '%s%s:%s'%(code,self.series,data)
def encode(self,  *args, **kwargs):
        """Encode wrapper for a dataset with maximum value

        Datasets can be one or two dimensional
        Strings are ignored as ordinal encoding"""
        if isinstance(args[0], str):
            return self.encode([args[0]],**kwargs)
        elif isinstance(args[0], int) or isinstance(args[0], float):
            return self.encode([[args[0]]],**kwargs)
        if len(args)>1:
            dataset = args
        else:
            dataset = args[0]
        typemap = list(map(type,dataset))
        code = self.encoding[0]
        if type('') in typemap:
            data = ','.join(map(str,dataset))
        elif type([]) in typemap or type(()) in typemap:
            data = self.codeset['char'].join(map(self.encodedata, dataset))
        elif len(dataset) == 1 and hasattr(dataset[0], '__iter__'):
            data = self.encodedata(dataset[0])
        else:
            try:
                data = self.encodedata(dataset)
            except ValueError:
                data = self.encodedata(','.join(map(unicode,dataset)))
        if not '.' in data and code == 't':
            code = 'e'
        return '%s%s:%s'%(code,self.series,data)
def encode ( self , * args , * * kwargs ) : if isinstance ( args [ 0 ] , str ) : return self . encode ( [ args [ 0 ] ] , * * kwargs ) elif isinstance ( args [ 0 ] , int ) or isinstance ( args [ 0 ] , float ) : return self . encode ( [ [ args [ 0 ] ] ] , * * kwargs ) if len ( args ) > 1 : dataset = args else : dataset = args [ 0 ] typemap = list ( map ( type , dataset ) ) code = self . encoding [ 0 ] if type ( '' ) in typemap : data = ',' . join ( map ( str , dataset ) ) elif type ( [ ] ) in typemap or type ( ( ) ) in typemap : data = self . codeset [ 'char' ] . join ( map ( self . encodedata , dataset ) ) elif len ( dataset ) == 1 and hasattr ( dataset [ 0 ] , '__iter__' ) : data = self . encodedata ( dataset [ 0 ] ) else : try : data = self . encodedata ( dataset ) except ValueError : data = self . encodedata ( ',' . join ( map ( unicode , dataset ) ) ) if not '.' in data and code == 't' : code = 'e' return '%s%s:%s' % ( code , self . series , data )
Encode wrapper for a dataset with maximum value

        Datasets can be one or two dimensional
        Strings are ignored as ordinal encoding
Encode wrapper for a dataset with maximum value