Create a task with the given `name` and glob `pattern`
189823
function task(app, name, pattern, dependencies) {
  app.task(name, dependencies || [], function(cb) {
    app.src(pattern, {cwd: __dirname})
      .pipe(app.renderFile('*'))
      .pipe(utils.condense())
      .pipe(beautify({ indent_size: 2 }))
      .pipe(app.conflicts(app.cwd))
      .pipe(app.dest(app.cwd))
      .on('error', cb)
      .on('end', function() {
        app.build('prompt-install', cb);
      })
  });
}
382864
def run_task(self, task, source_patterns=None):
        """"""

        # Perform spell check
        self.log('Running Task: %s...' % task.get('name', ''), 1)

        # Setup filters and variables for the spell check
        self.default_encoding = task.get('default_encoding', '')
        options = self.setup_spellchecker(task)
        personal_dict = self.setup_dictionary(task)
        glob_flags = self._to_flags(task.get('glob_flags', "N|B|G"))
        self._build_pipeline(task)

        if not source_patterns:
            source_patterns = task.get('sources', [])

        for sources in self._walk_src(source_patterns, glob_flags, self.pipeline_steps):

            if self.pipeline_steps is not None:
                yield from self._spelling_pipeline(sources, options, personal_dict)
            else:
                yield from self.spell_check_no_pipeline(sources, options, personal_dict)
898639
def _glob(pattern, skip_dirs=False):
    """"""
    # Implicit recursive iff no / in pattern and starts with *
    if "/" not in pattern and pattern.startswith("*"):
        files = glob.glob(f"**/{pattern}", recursive=True)
    else:
        files = glob.glob(pattern, recursive=True)

    # Expand dirs
    all_files = set()
    for file in files:
        if os.path.isdir(file) and not skip_dirs:
            all_files.update(set(f for f in _glob(f"{file}/**/*", skip_dirs=True) if not os.path.isdir(f)))
        else:
            all_files.add(file)

    # Normalize all files
    return {str(Path(f)) for f in all_files}
1014348
def make_task(name='',
              run_name='',
              **kwargs) -> Task:
  """"""
  ncluster_globals.task_launched = True

  name = ncluster_globals.auto_assign_task_name_if_needed(name)

  # tmux can't use . for session names
  tmux_session = name.replace('.', '=')
  tmux_window_id = 0
  util.log(f'killing session {tmux_session}')

  if not util.is_set("NCLUSTER_NOKILL_TMUX"):
    os.system(f'tmux kill-session -t {tmux_session}')
  os.system(f'tmux new-session -s {tmux_session} -n {tmux_window_id} -d')

  task = Task(name,
              tmux_session=tmux_session,  # propagate optional args
              run_name=run_name,
              **kwargs)
  ncluster_globals.register_task(task, run_name)
  return task
845172
def run_task(_verbose)
      data.each do |path, string|
        opts = {}
        path = File.expand_path(path)

        if string.is_a?(Hash)
          input             = string[:input]
          opts[:patterns]   = string[:patterns] if string.key? :patterns
          opts[:color]      = string[:color] if string.key? :color
          opts[:base_color] = string[:base_color] if string.key? :base_color
        else
          raise 'Invalid data structure for Rake Task'
        end

        pattern = GeoPattern.generate(input, opts)

        logger.info "Creating pattern at \"#{path}\"."
        FileUtils.mkdir_p File.dirname(path)
        File.write(path, pattern.to_svg)
      end
    end
1335724
def glob_files_remotely(cmd, client, share_name, pattern):
    """"""
    from collections import deque
    t_dir, t_file = cmd.get_models('file.models#Directory', 'file.models#File')

    queue = deque([""])
    while queue:
        current_dir = queue.pop()
        for f in client.list_directories_and_files(share_name, current_dir):
            if isinstance(f, t_file):
                if not pattern or _match_path(os.path.join(current_dir, f.name), pattern):
                    yield current_dir, f.name
            elif isinstance(f, t_dir):
                queue.appendleft(os.path.join(current_dir, f.name))
635751
def add_task(self, name=None, desc=None):
        
        # A name is required to create a task
        for k in self.get_tasks():
            if name in keys_of(k):
                raise ValueError('Task already exists')

        if name is not None:
            # desc can be None, so we can just append whatever we have
            self.grindstone['tasks'].append( {name: desc} )
        else:
            # Raising errors is good, and makes tests easy.
            raise ValueError('Tasks `name` cannot be None')
124015
public FutureTask<Path> createTmpFile(String name, String filePath, JobID jobID) {

		synchronized (count) {
			Pair<JobID, String> key = new ImmutablePair(jobID,name);
			if (count.containsKey(key)) {
				count.put(key, count.get(key) + 1);
			} else {
				count.put(key, 1);
			}
		}
		CopyProcess cp = new CopyProcess(name, filePath, jobID);
		FutureTask<Path> copyTask = new FutureTask<Path>(cp);
		executorService.submit(copyTask);
		return copyTask;
	}
754391
function globMatch(match, file) {
    var directiveType = match[1];
    var globPattern = match[2]; // relative file

    // require all files under a directory
    if (directiveType.indexOf('_tree') !== -1) {
      globPattern = globPattern.concat('/**/*');
      directiveType = directiveType.replace('_tree', '');
    }

    // require only first level files in a directory
    if (directiveType.indexOf('_directory') !== -1) {
      globPattern = globPattern.concat('/*');
      directiveType = directiveType.replace('_directory', '');
    }

    // Only require and include directives are allowed
    if (directiveType !== 'require' && directiveType !== 'include') {
      return [];
    }

    // Add file extension to glob pattern if not already set
    var jsExt = '.js';
    if (globPattern.substr(globPattern.length-jsExt.length).indexOf(jsExt) !== 0) {
      globPattern += jsExt;
    } 

    // Append the current dir to include so we can match the glob against the file list
    var relativeDir = getRelativeDir(file);
    globPattern = relativeDir+globPattern;

    var possibleIncludes = [];
    _.each(_.keys(allFiles), function(fileName) {
      // Only process files in the current directory. ../ will not work.
      if (fileName.indexOf(relativeDir) !== 0) {
        return;
      }

      possibleIncludes.push(fileName);
    });
    
    return minimatch.match(possibleIncludes, globPattern);
  }
989645
def build_task(argv)
      arguments = argv.dup
      task_name = arguments.shift
      klazz     = Task.from_name(task_name)
      klazz.new(*klazz.parse_options!(arguments))
    rescue NameError
      task_not_found(task_name)
      exit false
    rescue ArgumentError
      bad_arguments(task_name)
      exit false
    end
1236819
def get_task(self, name):
        """"""
        if name in self.tasks.keys():
            task = self.tasks[name]
        else:
            task = Task(name)
            self.tasks[name] = task
        return task
1031056
def make(cls, obj):
        ''''''
        try:
            cls._cache.append(Task(obj))
        except Exception:
            logger.exception('Unable to make task for %s' % repr(obj))
42594
function createTask(taskId) {
	return function (done) {
		var stream = tasks[taskId].fn(gulp, done);
		if (stream) {
			if (stream.on) stream.on('end', done);
			if (stream.then) stream.then(done);
		}
	};
}
1208831
def resolve_pattern(pattern):
    ''''''
    if os.path.exists(pattern) and os.path.isdir(pattern):
        pattern = os.path.join(pattern, '**/*.bench.py')
    return recursive_glob(pattern)
1137309
def create_task(function, *args, **kwargs):
    
    name = "{}".format(uuid4())
    handler = None
    deps = set()

    if 'name' in kwargs:
        name = kwargs['name']
        del kwargs['name']
    elif function is not None:
        name = "{}-{}".format(function.__name__, name)

    if 'handler' in kwargs:
        handler = kwargs['handler']
        del kwargs['handler']

    if 'dependencies' in kwargs:
        for dep in kwargs['dependencies']:
            deps.add(dep)
        del kwargs['dependencies']

    for arg in args:
        if isinstance(arg, Task):
            deps.add(arg.name)

    for key in kwargs:
        if isinstance(kwargs[key], Task):
            deps.add(kwargs[key].name)

    return Task(name, function, handler, frozenset(deps), args, kwargs)
262251
def create_on_task(self, task_id, file_content, file_name, file_content_type=None, **options):
        """"""
        path = '/tasks/%d/attachments' % (task_id)
        return self.client.request('post', path, files=[('file', (file_name, file_content, file_content_type))], **options)
953616
def glob_files_locally(folder_path, pattern):
    """"""

    pattern = os.path.join(
        folder_path, pattern.lstrip('/')) if pattern else None

    len_folder_path = len(folder_path) + 1
    for root, _, files in os.walk(folder_path):
        for f in files:
            full_path = os.path.join(root, f)
            if not pattern or _match_path(full_path, pattern):
                yield (full_path, full_path[len_folder_path:])