Get the directory with ruleset files
    First directory to check:  ./rulesets
    Second directory to check:  $HOME/.local/share/colin/rulesets
    Third directory to check: /usr/local/share/colin/rulesets
    :return: str
358791
def get_ruleset_dirs():
    

    ruleset_dirs = []

    cwd_rulesets = os.path.join(".", RULESET_DIRECTORY_NAME)
    if os.path.isdir(cwd_rulesets):
        logger.debug("Ruleset directory found in current directory ('{}').".format(cwd_rulesets))
        ruleset_dirs.append(cwd_rulesets)

    if "VIRTUAL_ENV" in os.environ:
        venv_local_share = os.path.join(os.environ["VIRTUAL_ENV"],
                                        RULESET_DIRECTORY)
        if os.path.isdir(venv_local_share):
            logger.debug("Virtual env ruleset directory found ('{}').".format(venv_local_share))
            ruleset_dirs.append(venv_local_share)

    local_share = os.path.join(os.path.expanduser("~"),
                               ".local",
                               RULESET_DIRECTORY)
    if os.path.isdir(local_share):
        logger.debug("Local ruleset directory found ('{}').".format(local_share))
        ruleset_dirs.append(local_share)

    usr_local_share = os.path.join("/usr/local", RULESET_DIRECTORY)
    if os.path.isdir(usr_local_share):
        logger.debug("Global ruleset directory found ('{}').".format(usr_local_share))
        ruleset_dirs.append(usr_local_share)

    if not ruleset_dirs:
        msg = "Ruleset directory cannot be found."
        logger.warning(msg)
        raise ColinRulesetException(msg)

    return ruleset_dirs
823089
def get_paths(directory):
    '''
    '''
    fnames = [os.path.join(directory, f)
              for f in os.listdir(directory)
              if os.path.isfile(os.path.join(directory, f))
              and not f.startswith('.')]
    return fnames
165650
def get_path_components(directory):
    
    drive, dirs = os.path.splitdrive(directory)
    folders = []
    previous = ""
    while dirs != previous and dirs != "":
        previous = dirs
        dirs, folder = os.path.split(dirs)
        if folder != "":
            folders.append(folder)
    folders.reverse()
    return drive, folders
308594
private function visitRulesetPaths($rulesetNode){

		$paths = array();
		foreach($rulesetNode->paths as $p){
			if( $p[0]->elements[0]->combinator === ' ' ){
				$p[0]->elements[0]->combinator = '';
			}

			foreach($p as $pi){
				if( $pi->getIsReferenced() && $pi->getIsOutput() ){
					$paths[] = $p;
					break;
				}
			}
		}

		return $paths;
	}
726112
def subdir_findall(dir, subdir):
    
    strip_n = len(dir.split('/'))
    path = '/'.join((dir, subdir))
    return ['/'.join(s.split('/')[strip_n:]) for s in setuptools.findall(path)]
556016
def main(self, *directories):
        
        if not self.git and len(directories) == 0:
            print ("ERROR: At least one directory must be provided (or the "
                   "--git-precommit flag must be passed.\n")
            self.help()
            return

        if len(directories) > 0:
            find = local['find']
            files = []
            for directory in directories:
                real = os.path.expanduser(directory)
                if not os.path.exists(real):
                    raise ValueError("{0} does not exist".format(directory))
                files.extend(find(real, '-name', '*.py').strip().split('\n'))
            if len(files) > 0:
                print "Linting {0} python files.\n".format(len(files))
                lint(files)
            else:
                print "No python files found to lint.\n"

        else:
            status = local['git']('status', '--porcelain', '-uno')
            root = local['git']('rev-parse', '--show-toplevel').strip()

            # get all modified or added python files
            modified = re.findall(r"^[AM]\s+\S+\.py$", status, re.MULTILINE)

            # now just get the path part, which all should be relative to the
            # root
            files = [os.path.join(root, line.split(' ', 1)[-1].strip())
                     for line in modified]
            if len(files) > 0:
                lint(files)
1320316
def rulefiles(self, acc=None):
        
        rulesdir = self.rulesdir(acc)
        rules = [os.path.join(rulesdir, x) for x in self.get('rules', acc, [])]
        if acc is not None:
            rules += self.rulefiles(acc=None)
        return rules
283311
def _get_paths():
    """"""
    import os
    base_path = os.path.dirname(os.path.abspath(__file__))
    test_data_dir = os.path.join(base_path, 'tests', 'data', 'Plate01')
    test_data_file = os.path.join(test_data_dir, 'RFP_Well_A3.fcs')
    return test_data_dir, test_data_file
1353337
def get_backup_paths(cls, block_id, impl, working_dir):
        
        backup_dir = config.get_backups_directory(impl, working_dir)
        backup_paths = []
        for p in cls.get_state_paths(impl, working_dir):
            pbase = os.path.basename(p)
            backup_path = os.path.join( backup_dir, pbase + (".bak.%s" % block_id))
            backup_paths.append( backup_path )

        return backup_paths
496248
static File getRulesDirectory(MavenProject rootModule, String rulesDirectory) {
        File rules = new File(rulesDirectory);
        return rules.isAbsolute() ? rules : new File(rootModule.getBasedir().getAbsolutePath() + File.separator + rulesDirectory);
    }
1182069
def getFilePathsWithExtensionsInDirectory(dirTree, patterns, sort=True):
    
    filePaths = []
    for root, dirs, files in os.walk(dirTree):
        for filePath in files:
            for pattern in patterns:
                if fnmatch.fnmatch(filePath, pattern):
                    fullPath = os.path.join(root, filePath)
                    filePaths.append(fullPath)
                    break
    if sort:
        filePaths.sort()
    return filePaths
728707
def _req_directory(self, cid):
        """"""
        res = self._req_files(cid=cid, offset=0, limit=1, show_dir=1)
        path = res['path']
        count = res['count']
        for d in path:
            if str(d['cid']) == str(cid):
                res = {
                    'cid': d['cid'],
                    'name': d['name'],
                    'pid': d['pid'],
                    'count': count,
                }
                return res
        else:
            raise RequestFailure('No directory found.')
321468
def _get_path(dataset_name):
  """"""
  path = _checksum_paths().get(dataset_name, None)
  if path:
    return path
  msg = ('No checksums file could be find for dataset %s. Please create one in '
         'one of: %s') % (dataset_name, ', '.join(_CHECKSUM_DIRS))
  raise AssertionError(msg)
28585
def rulesdir(self, acc=None):
        
        rootdir = self.rootdir()
        rulesdir = self.get('rulesdir', acc=acc, default=[])
        return os.path.join(rootdir, rulesdir) \
            if rootdir and rulesdir else None
1110938
def dirs(self):
        
        if self._dirs.get(connection.schema_name, None) is None:
            try:
                # Use directories configured via MULTITENANT_TEMPLATE_DIRS
                dirs = [
                    utils.parse_tenant_config_path(dir_)
                    for dir_ in settings.MULTITENANT_TEMPLATE_DIRS
                ]
            except AttributeError:
                raise ImproperlyConfigured(
                    "To use {}.{} you must define the MULTITENANT_TEMPLATE_DIRS setting.".format(
                        __name__, Loader.__name__
                    )
                )

            self.dirs = dirs

        return self._dirs[connection.schema_name]
612747
def layers_path(self):
        
        if self._layers_path is None:
            self._layers_path = os.path.join(self.tmpdir, "layers")
        return self._layers_path
1306844
function load(rulesDir) {
  var newRules = loadRules(rulesDir);
  Object.keys(newRules).forEach(function(ruleId) {
    define(ruleId, newRules[ruleId]);
  });
}