Downloads the images to +pattern+
 @param [Pixiv::Illust] illust the manga to download
 @param [Array<String, Symbol, #call>] pattern pattern for {#filename_from_pattern}
 @note +illust#manga?+ must be +true+
 @todo Document +&block+
500877
def download_manga(illust, pattern, &block)
      action = DownloadActionRegistry.new(&block)
      illust.original_image_urls.each_with_index do |url, n|
        begin
          action.before_each.call(url, n) if action.before_each
          filename = filename_from_pattern(pattern, illust, url)
          FileUtils.mkdir_p(File.dirname(filename))
          @agent.download(url, filename, [], illust.original_image_referer)
          action.after_each.call(url, n) if action.after_each
        rescue
          action.on_error ? action.on_error.call($!) : raise
        end
      end
    end
429532
def extract_files_from(patterns) # rubocop:disable MethodLength
      files = []

      patterns.each do |pattern|
        if File.file?(pattern)
          files << pattern
        else
          begin
            ::Find.find(pattern) do |file|
              files << file if haml_file?(file)
            end
          rescue ::Errno::ENOENT
            # File didn't exist; it might be a file glob pattern
            matches = ::Dir.glob(pattern)
            if matches.any?
              files += matches
            else
              # One of the paths specified does not exist; raise a more
              # descriptive exception so we know which one
              raise HamlLint::Exceptions::InvalidFilePath,
                    "File path '#{pattern}' does not exist"
            end
          end
        end
      end

      files.uniq.sort.map { |file| normalize_path(file) }
    end
261449
def include?(pattern)
      self.each do |current|
        return true if File.fnmatch(pattern, current) || pattern == current
      end
      return false
    end
314213
protected void setupForFill(final Pattern pPattern) {
        graphics.setPaint(pPattern);
        graphics.setComposite(getCompositeFor(QuickDraw.PAT_COPY));
    }
1348462
function updatePoFiles(filename, pattern) {
  var merged = [];
  var searchPath = path.dirname(filename);

  pattern = pattern || '*.po';

  glob.sync(pattern, {
    cwd: path.dirname(filename)
  }).forEach(function(file) {
    var poFile = path.join(searchPath, file);
    merged.push(mergeFiles(filename, poFile));
  });

  return Promise.all(merged);
}
598421
@Override
    public final void applyPattern(String pattern)
    {

        if (hasRegistry())
        {
            super.applyPattern(pattern);
            toPattern = super.toPattern();
            return;
        }

        ArrayList<Format> foundFormats = new ArrayList<Format>();
        ArrayList<String> foundDescriptions = new ArrayList<String>();
        StringBuilder stripCustom = new StringBuilder(pattern.length());

        ParsePosition pos = new ParsePosition(0);
        char[] c = pattern.toCharArray();
        int fmtCount = 0;

        while (pos.getIndex() < pattern.length())
        {

            char charType = c[pos.getIndex()];

            if (QUOTE == charType)
            {

                appendQuotedString(pattern, pos, stripCustom, true);
                continue;

            }

            if (START_FE == charType)
            {

                fmtCount++;
                seekNonWs(pattern, pos);
                int start = pos.getIndex();
                int index = readArgumentIndex(pattern, next(pos));
                stripCustom.append(START_FE).append(index);
                seekNonWs(pattern, pos);
                Format format = null;
                String formatDescription = null;
                if (c[pos.getIndex()] == START_FMT)
                {
                    formatDescription = parseFormatDescription(pattern, next(pos));
                    format = getFormat(formatDescription);
                    if (format == null)
                    {
                        stripCustom.append(START_FMT).append(formatDescription);
                    }
                }
                foundFormats.add(format);
                foundDescriptions.add(format == null ? null : formatDescription);

                Preconditions.checkState(foundFormats.size() == fmtCount);
                Preconditions.checkState(foundDescriptions.size() == fmtCount);

                if (c[pos.getIndex()] != END_FE)
                {
                    throw new IllegalArgumentException("Unreadable format element at position " + start);
                }

            }

            //$FALL-THROUGH$
            stripCustom.append(c[pos.getIndex()]);
            next(pos);

        }

        super.applyPattern(stripCustom.toString());

        toPattern = insertFormats(super.toPattern(), foundDescriptions);

        if (containsElements(foundFormats))
        {
            Format[] origFormats = getFormats();
            // only loop over what we know we have, as MessageFormat on Java 1.3
            // seems to provide an extra format element:
            Iterator<Format> it = foundFormats.iterator();
            for (int i = 0; it.hasNext(); i++)
            {
                Format f = it.next();
                if (f != null)
                {
                    origFormats[i] = f;
                }
            }
            super.setFormats(origFormats);
        }

    }
863170
def is_pattern_valid(pattern):
        
        result = True
        translator = Globster.pattern_info[Globster.identify(pattern)]["translator"]
        tpattern = '(%s)' % translator(pattern)
        try:
            re_obj = lazy_regex.lazy_compile(tpattern, re.UNICODE)
            re_obj.search("") # force compile
        except Exception as e:
            result = False
        return result
650601
private final boolean matchPattern(byte[][] patterns, int bufferIndex)
   {
      boolean match = false;
      for (byte[] pattern : patterns)
      {
         int index = 0;
         match = true;
         for (byte b : pattern)
         {
            if (b != m_buffer[bufferIndex + index])
            {
               match = false;
               break;
            }
            ++index;
         }
         if (match)
         {
            break;
         }
      }
      return match;
   }
58268
function (pattern, options) {
    options = options || {};
    this.pattern = new Pattern(pattern, options);
    this.recurse = this.shouldRecurse(this.pattern, options);

    // if middleware are registered, use the glob, otherwise regex
    var glob = this.fns.length
      ? this.pattern.glob
      : this.pattern.regex;

    this.defaults(glob, options);
    this.include(glob, options);
    return this;
  }
791262
@SuppressWarnings("resource")
  protected synchronized List<AbstractPatternRule> getPatternRules() throws IOException {
    // use lazy loading to speed up server use case and start of stand-alone LT, where all the languages get initialized:
    if (patternRules == null) {
      List<AbstractPatternRule> rules = new ArrayList<>();
      PatternRuleLoader ruleLoader = new PatternRuleLoader();
      for (String fileName : getRuleFileNames()) {
        InputStream is = null;
        try {
          is = this.getClass().getResourceAsStream(fileName);
          boolean ignore = false;
          if (is == null) {                     // files loaded via the dialog
            try {
              is = new FileInputStream(fileName);
            } catch (FileNotFoundException e) {
              if (fileName.contains("-test-")) {
                // ignore, used for testing
                ignore = true;
              } else {
                throw e;
              }
            }
          }
          if (!ignore) {
            rules.addAll(ruleLoader.getRules(is, fileName));
            patternRules = Collections.unmodifiableList(rules);
          }
        } finally {
          if (is != null) {
            is.close();
          }
        }
      }
    }
    return patternRules;
  }
143890
public static void main(String args[]) throws Exception {
		String urlStr = "http://upload.wikimedia.org/wikipedia/commons/5/58/Sunset_2007-1.jpg";
		String id = "Sunset_2007-1";
		String downloadFolder = "images/";
		boolean saveThumb = true;
		boolean saveOriginal = true;
		boolean followRedirects = false;
		ImageDownload imdown = new ImageDownload(urlStr, id, downloadFolder, saveThumb, saveOriginal,
				followRedirects);
		imdown.setDebug(true);

		ImageDownloadResult imdr = imdown.call();
		System.out.println("Getting the BufferedImage object of the downloaded image.");
		imdr.getImage();
		System.out.println("Reading the downloaded image thumbnail into a BufferedImage object.");
		ImageIO.read(new File(downloadFolder + id + "-thumb.jpg"));
		System.out.println("Success!");

	}
1342776
def globChildren(self, pattern):
        
        import glob
        path = self.path[-1] == '/' and self.path + pattern or slash.join([self.path, pattern])
        return map(self.clonePath, glob.glob(path))
835224
public static void downloadFile() throws IOException {

		initPath();

		initServerName();

		String localName = getLocalFileName();

		String u = serverName + "/" + COMPONENTS_FILE_LOCATION;

		downloadFileFromRemote(new URL(u), new File(localName));


	}
1262496
def addPattern(self, word, vector):
        
        if word in self.patterns:
            raise NetworkError('Pattern key already in use. Call delPattern to free key.', word)
        else:
            self.patterns[word] = vector
157770
public static File[] listFiles(final File target, final List<Pattern> patterns, final boolean include) {
        if (patterns == null || patterns.isEmpty())
            return target.listFiles();

        return target.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                for (Pattern pattern : patterns) {
                    Matcher matcher = pattern.matcher(name);
                    if (matcher.matches())
                        return include;
                }
                return !include;
            }

        });

    }
84371
public void setLineDashPattern (final float [] pattern, final float phase) throws IOException
  {
    if (inTextMode)
    {
      throw new IllegalStateException ("Error: setLineDashPattern is not allowed within a text block.");
    }
    write ((byte) '[');
    for (final float value : pattern)
    {
      writeOperand (value);
    }
    write ((byte) ']', (byte) ' ');
    writeOperand (phase);
    writeOperator ((byte) 'd');
  }
337514
public void addTldSkipPatterns(String... patterns) {
		Assert.notNull(patterns, "Patterns must not be null");
		this.tldSkipPatterns.addAll(Arrays.asList(patterns));
	}