Find which file the given group is in.
506909
function getFile(group) {
  while (group) {
    if (group.file) return group.file
    group = group.parent
  }
}
469564
protected Iterator findParentGroups(IEntityGroup group) throws GroupsException {
        if (log.isDebugEnabled()) log.debug(DEBUG_CLASS_NAME + ".findParentGroups(): for " + group);

        List groups = new ArrayList();
        {
            String typeName = group.getLeafType().getName();
            File parent = getFile(group).getParentFile();
            if (!parent.getName().equals(typeName)) {
                groups.add(find(parent));
            }

            File root = getFileRoot(group.getLeafType());
            File[] files = getAllFilesBelow(root);
            try {
                for (int i = 0; i < files.length; i++) {
                    Collection ids = getGroupIdsFromFile(files[i]);
                    if (ids.contains(group.getLocalKey())) {
                        groups.add(find(files[i]));
                    }
                }
            } catch (IOException ex) {
                throw new GroupsException("Problem reading group files", ex);
            }
        }
        return groups.iterator();
    }
856528
private boolean fileContains(File file, IGroupMember member) throws GroupsException {
        Collection ids = null;
        try {
            ids = member.isGroup() ? getGroupIdsFromFile(file) : getEntityIdsFromFile(file);
        } catch (Exception ex) {
            throw new GroupsException("Error retrieving ids from file", ex);
        }
        return ids.contains(member.getKey());
    }
849840
def get_group_key_line(self, data, key):
        
        idx = -1
        for i, line in enumerate(data.splitlines()):
            if isin_start(self.groups[key], line):
                idx = i
        return idx
1079107
public static int getFilePermissions(final File file) {
        if (OsValidator.WINDOWS) {
            logger.trace("Determining 'group' is skipped for file [{}] on [{}]", file, OsValidator.OS);
            return -1;
        }
        try {
            final Path path = Paths.get(file.getAbsolutePath());
            PosixFileAttributes attrs = Files.getFileAttributeView(path, PosixFileAttributeView.class).readAttributes();
            Set<PosixFilePermission> permissions = attrs.permissions();
            int user = toOctalPermission(
                    permissions.contains(PosixFilePermission.OWNER_READ),
                    permissions.contains(PosixFilePermission.OWNER_WRITE),
                    permissions.contains(PosixFilePermission.OWNER_EXECUTE));
            int group = toOctalPermission(
                    permissions.contains(PosixFilePermission.GROUP_READ),
                    permissions.contains(PosixFilePermission.GROUP_WRITE),
                    permissions.contains(PosixFilePermission.GROUP_EXECUTE));
            int others = toOctalPermission(
                    permissions.contains(PosixFilePermission.OTHERS_READ),
                    permissions.contains(PosixFilePermission.OTHERS_WRITE),
                    permissions.contains(PosixFilePermission.OTHERS_EXECUTE));

            return user * 100 + group * 10 + others;
        }
        catch(Exception e) {
            logger.warn("Failed to determine 'owner' of {}: {}", file, e.getMessage());
            return -1;
        }
    }
121128
public static String getGroupName(final File file) {
        if (OsValidator.WINDOWS) {
            logger.trace("Determining 'group' is skipped for file [{}] on [{}]", file, OsValidator.OS);
            return null;
        }
        try {
            final Path path = Paths.get(file.getAbsolutePath());
            final PosixFileAttributes posixFileAttributes = Files.getFileAttributeView(path, PosixFileAttributeView.class).readAttributes();
            return posixFileAttributes != null ? posixFileAttributes.group().getName() : null;
        } catch (Exception e) {
            logger.warn("Failed to determine 'group' of {}: {}", file, e.getMessage());
            return null;
        }
    }
663346
def find(self, groupid):
        
        return self.indices[self.offset[groupid]
                :self.offset[groupid]+ self.length[groupid]]
576111
private Group findExactSection(Group section) {
    for (Group s : groups) {
      if (s.isExact(section)) {
        return s;
      }
    }
    return null;
  }
1190759
def get_group(self, group_id):
    

    group = self.group_id_map.get(group_id)

    if group:
      return group

    self.logger.error('Group ID "%s" is not in datafile.' % group_id)
    self.error_handler.handle_error(exceptions.InvalidGroupException(enums.Errors.INVALID_GROUP_ID_ERROR))
    return None
1227954
def prt_outfiles_grouped(self, outfiles):
        """"""
        for outfile in outfiles:
            if outfile.endswith(".xlsx"):
                self.wr_xlsx(outfile)
            elif outfile.endswith(".txt"):
                self.wr_txt(outfile)
            else:
                self.wr_tsv(outfile)
1046930
def has_parent_group(self, group):
        """"""
        if isinstance(group, str):
            return self._has_parent_group_by_name(group)

        else:
            return self._has_parent_group_by_object(group)
303719
def get_group(self, name, default=NoGroupError):
        '''
        
        '''

        if name in self.groups:
            return self.groups[name]

        if default is NoGroupError:
            raise NoGroupError('No such group: {0}'.format(name))

        return default
1153128
public function locate($file, $group = null) {

		if (isset($this->working_group)) {
			$group = $this->working_group;
		} else if (! isset($group)) {
			throw new RuntimeException("Must set group or working group to locate file.");
		}
		
		if (isset($this->found[$group][$file])) {
			return $this->found[$group][$file];
		}

		if (! isset($this->groups[$group])) {
			throw new InvalidArgumentException("Unknown filesystem group $group.");
		}

		foreach ( $this->groups[$group] as $path => $depth ) {
			
			if ($found = $this->search($path, $file, $depth)) {
				return $this->found[$group][$file] = $found;
			}
		}
		
		return null;
	}
1227817
def _filter_group(self, group):
        
        self.metadata = [x for x in self.metadata if x.group == group]
        group_set = set([x.id for x in self.metadata])
        self.objects = [obj for obj in self.objects if id(obj) in group_set]
        self.count = len(self.metadata)
        if self.metadata == []:
            return False

        self.edges = [e for e in self.edges if e.group == group]

        del self._max_group

        return True
504334
def find_macthing_files(match):
    """"""
    last_slash = match.rfind('/')
    if last_slash == -1:
        dirname = '.'
        match_prefix = match
        result_prefix = ''
    else:
        dirname = match[0:last_slash]
        match_prefix = match[last_slash + 1:]
        result_prefix = dirname + '/'
    return [result_prefix + filename for filename in os.listdir(dirname) if filename.startswith(match_prefix)]
556433
private CmsGroup checkGroup(String groupName) {

        try {
            return getCms().readGroup(groupName);
        } catch (CmsException e) {
            throw new CmsIllegalArgumentException(e.getMessageContainer());
        }
    }
1047792
def copy_group(from_file, to_file, key):
    
    if not key in to_file:
        from_file.copy(key, to_file, key)
    else:
        # also make sure any additional attributes are copied
        for attr in from_file[key].attrs:
            to_file.attrs[attr] = from_file[key].attrs[attr]
            
        if hasattr(from_file[key], 'keys'):
            for subkey in from_file[key].keys():
                copy_group(from_file, to_file, '/'.join([key,subkey]))