return groups for directional method
505584
def _group_directional(self, clusters, adj_list, counts):
        ''' '''

        observed = set()
        groups = []
        for cluster in clusters:
            if len(cluster) == 1:
                groups.append(list(cluster))
                observed.update(cluster)
            else:
                cluster = sorted(cluster, key=lambda x: counts[x],
                                 reverse=True)
                # need to remove any node which has already been observed
                temp_cluster = []
                for node in cluster:
                    if node not in observed:
                        temp_cluster.append(node)
                        observed.add(node)
                groups.append(temp_cluster)

        return groups
1151533
def main_group(self, i):
        """"""

        current = []
        while True:
            try:
                t = next(i)
                current.extend(self.normal(t, i))
            except StopIteration:
                break
        return current
1174461
def _getgroup(string, depth):
    
    out, comma = [], False
    while string:
        items, string = _getitem(string, depth)

        if not string:
            break
        out += items

        if string[0] == '}':
            if comma:
                return out, string[1:]
            return ['{' + a + '}' for a in out], string[1:]

        if string[0] == ',':
            comma, string = True, string[1:]

    return None
121596
def _abbrieviate_direction(ext_dir_str):
    """"""
    return (ext_dir_str
            .upper()
            .replace('_', '')
            .replace('-', '')
            .replace(' ', '')
            .replace('NORTH', 'N')
            .replace('EAST', 'E')
            .replace('SOUTH', 'S')
            .replace('WEST', 'W')
            )
1331438
def getcoords(ddtt):
    """"""
    n_vertices_index = ddtt.objls.index('Number_of_Vertices')
    first_x = n_vertices_index + 1 # X of first coordinate
    pts = ddtt.obj[first_x:]
    return list(grouper(3, pts))
440241
def layer_groups(ordering, length=2):
   
   group_orderings = defaultdict(list)
   for el in ordering:
      group_orderings[el[:length]].append(el)
   return group_orderings
185454
def centroid(data, method=median):
    ""
    out = []
    for i in range(len(data[0])):
        out.append(method([x[i] for x in data]))
    return tuple(out)
746038
def get_unique_groups(input_list):
    """"""
    out_list = []
    for item in input_list:
        if item not in out_list:
            out_list.append(item)
    return out_list
311736
function byGroup() {
    var nodes = this.spawn();
    var edges = this.spawn();

    for (var i = 0; i < this.length; i++) {
      var ele = this[i];

      if (ele.isNode()) {
        nodes.merge(ele);
      } else {
        edges.merge(ele);
      }
    }

    return {
      nodes: nodes,
      edges: edges
    };
  }
508702
def plot_groups_unplaced(self, fout_dir=".", **kws_usr):
        """"""
        # kws: go2color max_gos upper_trigger max_upper
        plotobj = PltGroupedGos(self)
        return plotobj.plot_groups_unplaced(fout_dir, **kws_usr)
1341715
def ngroups(self):
        """"""
        if self._can_use_new_school():
            return self._grouped_spark_sql.count()
        self._prep_pandas_groupby()
        return self._mergedRDD.count()
265524
def get_groups(self, load):
        '''
        
        '''
        if 'eauth' not in load:
            return False
        fstr = '{0}.groups'.format(load['eauth'])
        if fstr not in self.auth:
            return False
        fcall = salt.utils.args.format_call(
            self.auth[fstr],
            load,
            expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
        try:
            return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
        except IndexError:
            return False
        except Exception:
            return None
8817
def groups(self):
        

        # Split paths into components and take the first (group) component.
        object_paths = (
            path_components(path)
            for path in self.objects)
        group_names = (path[0] for path in object_paths if len(path) > 0)

        # Use an ordered dict as an ordered set to find unique
        # groups in order.
        groups_set = OrderedDict()
        for group in group_names:
            groups_set[group] = None
        return list(groups_set)
644237
def _findSingleMemberGroups(classDictionaries):
    
    toRemove = {}
    for classDictionaryGroup in classDictionaries:
        for classDictionary in classDictionaryGroup:
            for name, members in list(classDictionary.items()):
                if len(members) == 1:
                    toRemove[name] = list(members)[0]
                    del classDictionary[name]
    return toRemove
1306349
def direction(theta, phi):
    '''
    '''
    return np.array([np.cos(phi) * np.sin(theta), np.sin(phi) * np.sin(theta),
                     np.cos(theta)])
1245084
function Group(options) {
    this.name = options.name
    this.axis = options.axis
    this.id = this.name + '-' + this.axis
    this.waypoints = []
    this.clearTriggerQueues()
    groups[this.axis][this.name] = this
  }
544054
def group_by(iterable, key_func):
    """"""
    groups = (
        list(sub) for key, sub in groupby(iterable, key_func)
    )
    return zip(groups, groups)