text:
package io.joern.benchmarks.securibench.micro.java

import io.joern.benchmarks.BenchmarkTags.Collections
import io.joern.benchmarks.testfixtures.BenchmarkFixture._
import io.joern.benchmarks.testfixtures.SecuribenchMicroCollectionsFixture
import io.shiftleft.semanticcpg.language._

class CollectionsBenchmark1 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "1") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark2 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "2") {

  s"Collections$benchmarkNo line 50" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(50))
  }

  s"Collections$benchmarkNo line 51" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(51))
  }

}

class CollectionsBenchmark3 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "3") {

  s"Collections$benchmarkNo line 49" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(49))
  }

  s"Collections$benchmarkNo line 51" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(51))
  }

}

class CollectionsBenchmark4 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "4") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark5 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "5") {

  s"Collections$benchmarkNo" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark6 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "6") {

  s"Collections$benchmarkNo line 47" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(47))
  }

  s"Collections$benchmarkNo line 48" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(48))
  }

}

class CollectionsBenchmark7 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "7") {

  s"Collections$benchmarkNo line 49" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(49))
  }

  s"Collections$benchmarkNo line 50" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(50))
  }

}

class CollectionsBenchmark8 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "8") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark9 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "9") {

  s"Collections$benchmarkNo" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark10 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "10") {

  s"Collections$benchmarkNo line 54" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(54))
  }

  s"Collections$benchmarkNo line 61" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(61))
  }

}

class CollectionsBenchmark11 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "11") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*foo.*"))
  }

}

class CollectionsBenchmark11b extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "11b") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.identifier("o"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark12 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "12") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}

class CollectionsBenchmark13 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "13") {

  s"Collections$benchmarkNo line 52" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(52))
  }

  s"Collections$benchmarkNo line 53" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(53))
  }

  s"Collections$benchmarkNo line 54" should "report secure" taggedAs Collections in {
    assertIsSecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*").lineNumber(54))
  }

}

class CollectionsBenchmark14 extends SecuribenchMicroCollectionsFixture(JAVA_EXT, "14") {

  s"Collections$benchmarkNo" should "report insecure" taggedAs Collections in {
    assertIsInsecure(cpg.fieldAccess.code(".*FIELD_NAME.*"), cpg.call(".*println.*"))
  }

}


text:
// Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.gerrit.server.git;

import static com.google.common.base.Preconditions.checkState;

import com.google.common.base.MoreObjects;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.gerrit.lifecycle.LifecycleModule;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.notedb.NotesMigration;
import com.google.inject.Inject;
import com.google.inject.Singleton;

import com.jcraft.jsch.Session;

import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.internal.storage.file.LockFile;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.WindowCacheConfig;
import org.eclipse.jgit.transport.JschConfigSessionFactory;
import org.eclipse.jgit.transport.OpenSshConfig;
import org.eclipse.jgit.transport.SshSessionFactory;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/** Manages Git repositories stored on the local filesystem. */
@Singleton
public class LocalDiskRepositoryManager implements GitRepositoryManager {
  private static final Logger log =
      LoggerFactory.getLogger(LocalDiskRepositoryManager.class);

  private static final String UNNAMED =
      "Unnamed repository; edit this file to name it for gitweb.";

  public static class Module extends LifecycleModule {
    @Override
    protected void configure() {
      bind(GitRepositoryManager.class).to(LocalDiskRepositoryManager.class);
      listener().to(LocalDiskRepositoryManager.Lifecycle.class);
    }
  }

  public static class Lifecycle implements LifecycleListener {
    private final Config serverConfig;

    @Inject
    Lifecycle(@GerritServerConfig final Config cfg) {
      this.serverConfig = cfg;
    }

    @Override
    public void start() {
      // Install our own factory which always runs in batch mode, as we
      // have no UI available for interactive prompting.
      SshSessionFactory.setInstance(new JschConfigSessionFactory() {
        @Override
        protected void configure(OpenSshConfig.Host hc, Session session) {
          // Default configuration is batch mode.
        }
      });

      WindowCacheConfig cfg = new WindowCacheConfig();
      cfg.fromConfig(serverConfig);
      if (serverConfig.getString("core", null, "streamFileThreshold") == null) {
        long mx = Runtime.getRuntime().maxMemory();
        int limit = (int) Math.min(
            mx / 4, // don't use more than 1/4 of the heap.
            2047 << 20); // cannot exceed array length
        if ((5 << 20) < limit && limit % (1 << 20) != 0) {
          // If the limit is at least 5 MiB but is not a whole multiple
          // of MiB round up to the next one full megabyte. This is a very
          // tiny memory increase in exchange for nice round units.
          limit = ((limit / (1 << 20)) + 1) << 20;
        }

        String desc;
        if (limit % (1 << 20) == 0) {
          desc = String.format("%dm", limit / (1 << 20));
        } else if (limit % (1 << 10) == 0) {
          desc = String.format("%dk", limit / (1 << 10));
        } else {
          desc = String.format("%d", limit);
        }
        log.info(String.format(
            "Defaulting core.streamFileThreshold to %s",
            desc));
        cfg.setStreamFileThreshold(limit);
      }
      cfg.install();
    }

    @Override
    public void stop() {
    }
  }

  private final File basePath;
  private final File noteDbPath;
  private final Lock namesUpdateLock;
  private volatile SortedSet<Project.NameKey> names;

  @Inject
  LocalDiskRepositoryManager(SitePaths site,
      @GerritServerConfig Config cfg,
      NotesMigration notesMigration) {
    basePath = site.resolve(cfg.getString("gerrit", null, "basePath"));
    if (basePath == null) {
      throw new IllegalStateException("gerrit.basePath must be configured");
    }

    if (notesMigration.enabled()) {
      noteDbPath = site.resolve(MoreObjects.firstNonNull(
          cfg.getString("gerrit", null, "noteDbPath"), "notedb"));
    } else {
      noteDbPath = null;
    }
    namesUpdateLock = new ReentrantLock(true /* fair */);
    names = list();
  }

  /** @return base directory under which all projects are stored. */
  public File getBasePath() {
    return basePath;
  }

  @Override
  public Repository openRepository(Project.NameKey name)
      throws RepositoryNotFoundException {
    return openRepository(basePath, name);
  }

  private Repository openRepository(File path, Project.NameKey name)
      throws RepositoryNotFoundException {
    if (isUnreasonableName(name)) {
      throw new RepositoryNotFoundException("Invalid name: " + name);
    }
    File gitDir = new File(path, name.get());
    if (!names.contains(name)) {
      // The this.names list does not hold the project-name but it can still exist
      // on disk; for instance when the project has been created directly on the
      // file-system through replication.
      //
      if (!name.get().endsWith(Constants.DOT_GIT_EXT)) {
        if (FileKey.resolve(gitDir, FS.DETECTED) != null) {
          onCreateProject(name);
        } else {
          throw new RepositoryNotFoundException(gitDir);
        }
      } else {
        final File directory = gitDir;
        if (FileKey.isGitRepository(new File(directory, Constants.DOT_GIT),
            FS.DETECTED)) {
          onCreateProject(name);
        } else if (FileKey.isGitRepository(new File(directory.getParentFile(),
            directory.getName() + Constants.DOT_GIT_EXT), FS.DETECTED)) {
          onCreateProject(name);
        } else {
          throw new RepositoryNotFoundException(gitDir);
        }
      }
    }
    final FileKey loc = FileKey.lenient(gitDir, FS.DETECTED);
    try {
      return RepositoryCache.open(loc);
    } catch (IOException e1) {
      final RepositoryNotFoundException e2;
      e2 = new RepositoryNotFoundException("Cannot open repository " + name);
      e2.initCause(e1);
      throw e2;
    }
  }

  @Override
  public Repository createRepository(Project.NameKey name)
      throws RepositoryNotFoundException, RepositoryCaseMismatchException {
    Repository repo = createRepository(basePath, name);
    if (noteDbPath != null) {
      createRepository(noteDbPath, name);
    }
    return repo;
  }

  private Repository createRepository(File path, Project.NameKey name)
      throws RepositoryNotFoundException, RepositoryCaseMismatchException {
    if (isUnreasonableName(name)) {
      throw new RepositoryNotFoundException("Invalid name: " + name);
    }

    File dir = FileKey.resolve(new File(path, name.get()), FS.DETECTED);
    FileKey loc;
    if (dir != null) {
      // Already exists on disk, use the repository we found.
      //
      loc = FileKey.exact(dir, FS.DETECTED);

      if (!names.contains(name)) {
        throw new RepositoryCaseMismatchException(name);
      }
    } else {
      // It doesn't exist under any of the standard permutations
      // of the repository name, so prefer the standard bare name.
      //
      String n = name.get() + Constants.DOT_GIT_EXT;
      loc = FileKey.exact(new File(path, n), FS.DETECTED);
    }

    try {
      Repository db = RepositoryCache.open(loc, false);
      db.create(true /* bare */);

      StoredConfig config = db.getConfig();
      config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION,
        null, ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true);
      config.save();

      // JGit only writes to the reflog for refs/meta/config if the log file
      // already exists.
      //
      File metaConfigLog =
          new File(db.getDirectory(), "logs/" + RefNames.REFS_CONFIG);
      if (!metaConfigLog.getParentFile().mkdirs()
          || !metaConfigLog.createNewFile()) {
        log.error(String.format(
            "Failed to create ref log for %s in repository %s",
            RefNames.REFS_CONFIG, name));
      }

      onCreateProject(name);

      return db;
    } catch (IOException e1) {
      final RepositoryNotFoundException e2;
      e2 = new RepositoryNotFoundException("Cannot create repository " + name);
      e2.initCause(e1);
      throw e2;
    }
  }

  @Override
  public Repository openMetadataRepository(Project.NameKey name)
      throws RepositoryNotFoundException, IOException {
    checkState(noteDbPath != null, "notedb disabled");
    try {
      return openRepository(noteDbPath, name);
    } catch (RepositoryNotFoundException e) {
      return createRepository(noteDbPath, name);
    }
  }

  private void onCreateProject(final Project.NameKey newProjectName) {
    namesUpdateLock.lock();
    try {
      SortedSet<Project.NameKey> n = new TreeSet<>(names);
      n.add(newProjectName);
      names = Collections.unmodifiableSortedSet(n);
    } finally {
      namesUpdateLock.unlock();
    }
  }

  @Override
  public String getProjectDescription(final Project.NameKey name)
      throws RepositoryNotFoundException, IOException {
    final Repository e = openRepository(name);
    try {
      return getProjectDescription(e);
    } finally {
      e.close();
    }
  }

  private String getProjectDescription(final Repository e) throws IOException {
    final File d = new File(e.getDirectory(), "description");

    String description;
    try {
      description = RawParseUtils.decode(IO.readFully(d));
    } catch (FileNotFoundException err) {
      return null;
    }

    if (description != null) {
      description = description.trim();
      if (description.isEmpty()) {
        description = null;
      }
      if (UNNAMED.equals(description)) {
        description = null;
      }
    }
    return description;
  }

  @Override
  public void setProjectDescription(final Project.NameKey name,
      final String description) {
    // Update git's description file, in case gitweb is being used
    //
    try {
      final Repository e = openRepository(name);
      try {
        final String old = getProjectDescription(e);
        if ((old == null && description == null)
            || (old != null && old.equals(description))) {
          return;
        }

        final LockFile f = new LockFile(new File(e.getDirectory(), "description"), FS.DETECTED);
        if (f.lock()) {
          String d = description;
          if (d != null) {
            d = d.trim();
            if (d.length() > 0) {
              d += "\n";
            }
          } else {
            d = "";
          }
          f.write(Constants.encode(d));
          f.commit();
        }
      } finally {
        e.close();
      }
    } catch (RepositoryNotFoundException e) {
      log.error("Cannot update description for " + name, e);
    } catch (IOException e) {
      log.error("Cannot update description for " + name, e);
    }
  }

  private boolean isUnreasonableName(final Project.NameKey nameKey) {
    final String name = nameKey.get();

    if (name.length() == 0) return true; // no empty paths
    if (name.charAt(name.length() -1) == '/') return true; // no suffix

    if (name.indexOf('\\') >= 0) return true; // no windows/dos style paths
    if (name.charAt(0) == '/') return true; // no absolute paths
    if (new File(name).isAbsolute()) return true; // no absolute paths

    if (name.startsWith("../")) return true; // no "l../etc/passwd"
    if (name.contains("/../")) return true; // no "foo/../etc/passwd"
    if (name.contains("/./")) return true; // "foo/./foo" is insane to ask
    if (name.contains("//")) return true; // windows UNC path can be "//..."
    if (name.contains("?")) return true; // common unix wildcard
    if (name.contains("%")) return true; // wildcard or string parameter
    if (name.contains("*")) return true; // wildcard
    if (name.contains(":")) return true; // Could be used for absolute paths in windows?
    if (name.contains("<")) return true; // redirect input
    if (name.contains(">")) return true; // redirect output
    if (name.contains("|")) return true; // pipe
    if (name.contains("$")) return true; // dollar sign
    if (name.contains("\r")) return true; // carriage return

    return false; // is a reasonable name
  }

  @Override
  public SortedSet<Project.NameKey> list() {
    // The results of this method are cached by ProjectCacheImpl. Control only
    // enters here if the cache was flushed by the administrator to force
    // scanning the filesystem. Don't rely on the cached names collection.
    namesUpdateLock.lock();
    try {
      SortedSet<Project.NameKey> n = new TreeSet<>();
      scanProjects(basePath, "", n);
      names = Collections.unmodifiableSortedSet(n);
      return n;
    } finally {
      namesUpdateLock.unlock();
    }
  }

  private void scanProjects(final File dir, final String prefix,
      final SortedSet<Project.NameKey> names) {
    final File[] ls = dir.listFiles();
    if (ls == null) {
      return;
    }

    for (File f : ls) {
      String fileName = f.getName();
      if (fileName.equals(Constants.DOT_GIT)) {
        // Skip repositories named only `.git`
      } else if (FileKey.isGitRepository(f, FS.DETECTED)) {
        Project.NameKey nameKey = getProjectName(prefix, fileName);
        if (isUnreasonableName(nameKey)) {
          log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath());
        } else {
          names.add(nameKey);
        }

      } else if (f.isDirectory()) {
        scanProjects(f, prefix + f.getName() + "/", names);
      }
    }
  }

  private Project.NameKey getProjectName(final String prefix,
      final String fileName) {
    final String projectName;
    if (fileName.endsWith(Constants.DOT_GIT_EXT)) {
      int newLen = fileName.length() - Constants.DOT_GIT_EXT.length();
      projectName = prefix + fileName.substring(0, newLen);

    } else {
      projectName = prefix + fileName;
    }

    return new Project.NameKey(projectName);
  }
}

redpajama_set_name: RedPajamaGithub


text:
package com.java110.api.components.inspectionPoint;

import com.java110.core.context.IPageData;
import com.java110.api.smo.inspection.IListInspectionRoutesSMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * 应用组件管理类
 *

 * add by wuxw
 *

 * 2019-06-29
 */
@Component("chooseInspectionRoute")
public class ChooseInspectionRouteComponent {

    @Autowired
    private IListInspectionRoutesSMO listInspectionRoutesSMOImpl;

    /**
     * 查询应用列表
     *
     * @param pd 页面数据封装
     * @return 返回 ResponseEntity 对象
     */
    public ResponseEntity<String> list(IPageData pd) {
        return listInspectionRoutesSMOImpl.listInspectionRoutes(pd);
    }

    public IListInspectionRoutesSMO getListInspectionRoutesSMOImpl() {
        return listInspectionRoutesSMOImpl;
    }

    public void setListInspectionRoutesSMOImpl(IListInspectionRoutesSMO listInspectionRoutesSMOImpl) {
        this.listInspectionRoutesSMOImpl = listInspectionRoutesSMOImpl;
    }
}


text:
'use strict';

var base = require('./karma.conf.js');

module.exports = function (config) {
  base(config);
  config.plugins.push('karma-coverage');
  config.reporters.push('coverage');
  config.preprocessors['app/js/**/*.js'] = 'coverage';
};


text:
require 'spec_helper'

describe Marta::SmartPage, :need_browser do
  before (:all) do
    @full_name = "./spec/test_data_folder/test_pageobjects/Attack.json"
    FileUtils.rm_rf(@full_name)
  end

  after(:all) do
    #Reverting monkeypatch :(
    #module Marta
      #class SmartPage
        #alias json_2_class j2c_saved
      #end
    #end
    module Marta
      class SmartPage
        alias page_edit paed_saved
      end
    end
    FileUtils.rm_rf(@full_name)
  end

  context 'when not learning' do
    before(:all) do
      @full_name = "./spec/test_data_folder/test_pageobjects/Json2Class.json"
      marta_fire(:json_2_class, @full_name, false)
      #Monkeypatch!
      module Marta
        class SmartPage
          alias paed_saved page_edit
          def page_edit(*args)
            #Nothing interesting here
          end
        end
      end
      @object = Object.new
      @object.extend(Marta)
      def @object.mars_attacks
        Attack
      end
      def @object.earth_strikes_back
        Json2Class.new.earth_strikes_back
      end
    end

    it 'unknown constant will raise an error ' do
      dance_with learn: false
      expect{@object.mars_attacks}.to raise_error(NameError, "uninitialized constant Attack")
    end

    it 'unknown method will raise an error ' do
      expect{@object.earth_strikes_back}.to raise_error(NoMethodError)
    end
  end

  context 'when in learning' do
    before (:each) do
      #module Marta
        #class SmartPage
          #alias json_2_class j2c_saved
        #end
      #end
      dance_with learn: true
      @full_name = "./spec/test_data_folder/test_pageobjects/Json2Class.json"
      marta_fire(:json_2_class, @full_name, true)
      #Monkeypatch!
      @object = Object.new
      @object.extend(Marta)
      def @object.mars_attacks
        Attack
      end
      def @object.earth_strikes_back
        my_class = Json2Class.new
        def my_class.method_edit(*args)
          'BOOM!'
        end
        my_class.earth_strikes_back
      end
    end

    it 'unknown constant will be passed' do
      expect(@object.mars_attacks).to eq Kernel::Attack
      expect(File.exists?(@full_name)).to be true
    end

    it 'unknown method will be passed ' do
      expect(@object.earth_strikes_back).to eq 'BOOM!'
    end
  end

end


text:
package net.silentchaos512.lib.registry;

import net.minecraft.world.item.Item;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.registries.RegistryObject;

public class ItemRegistryObject<T extends Item> extends RegistryObjectWrapper<T> implements ItemLike {
    public ItemRegistryObject(RegistryObject<T> item) {
        super(item);
    }

    @Override
    public Item asItem() {
        return registryObject.get();
    }
}


text:
// NOTE: This file was generated by the ServiceGenerator.

// ----------------------------------------------------------------------------
// API:
//   Fusion Tables API (fusiontables/v2)
// Description:
//   API for working with Fusion Tables data.
// Documentation:
//   https://developers.google.com/fusiontables

#if GTLR_BUILT_AS_FRAMEWORK
  #import "GTLR/GTLRQuery.h"
#else
  #import "GTLRQuery.h"
#endif

#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif

@class GTLRFusionTables_Column;
@class GTLRFusionTables_StyleSetting;
@class GTLRFusionTables_Table;
@class GTLRFusionTables_Template;

NS_ASSUME_NONNULL_BEGIN

/**
 *  Parent class for other FusionTables query classes.
 */
@interface GTLRFusionTablesQuery : GTLRQuery

/** Selector specifying which fields to include in a partial response. */
@property(nonatomic, copy, nullable) NSString *fields;

@end

/**
 *  Deletes the specified column.
 *
 *  Method: fusiontables.column.delete
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_ColumnDelete : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForColumnDeleteWithtableId:columnId:]

/** Name or identifier for the column being deleted. */
@property(nonatomic, copy, nullable) NSString *columnId;

/** Table from which the column is being deleted. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Upon successful completion, the callback's object and error parameters will
 *  be nil. This query does not fetch an object.
 *
 *  Deletes the specified column.
 *
 *  @param tableId Table from which the column is being deleted.
 *  @param columnId Name or identifier for the column being deleted.
 *
 *  @returns GTLRFusionTablesQuery_ColumnDelete
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                        columnId:(NSString *)columnId;

@end

/**
 *  Retrieves a specific column by its ID.
 *
 *  Method: fusiontables.column.get
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_ColumnGet : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForColumnGetWithtableId:columnId:]

/** Name or identifier for the column that is being requested. */
@property(nonatomic, copy, nullable) NSString *columnId;

/** Table to which the column belongs. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Column.
 *
 *  Retrieves a specific column by its ID.
 *
 *  @param tableId Table to which the column belongs.
 *  @param columnId Name or identifier for the column that is being requested.
 *
 *  @returns GTLRFusionTablesQuery_ColumnGet
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                        columnId:(NSString *)columnId;

@end

/**
 *  Adds a new column to the table.
 *
 *  Method: fusiontables.column.insert
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_ColumnInsert : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForColumnInsertWithObject:tableId:]

/** Table for which a new column is being added. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Column.
 *
 *  Adds a new column to the table.
 *
 *  @param object The @c GTLRFusionTables_Column to include in the query.
 *  @param tableId Table for which a new column is being added.
 *
 *  @returns GTLRFusionTablesQuery_ColumnInsert
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Column *)object
                        tableId:(NSString *)tableId;

@end

/**
 *  Retrieves a list of columns.
 *
 *  Method: fusiontables.column.list
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_ColumnList : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForColumnListWithtableId:]

/** Maximum number of columns to return. Default is 5. */
@property(nonatomic, assign) NSUInteger maxResults;

/** Continuation token specifying which result page to return. */
@property(nonatomic, copy, nullable) NSString *pageToken;

/** Table whose columns are being listed. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_ColumnList.
 *
 *  Retrieves a list of columns.
 *
 *  @param tableId Table whose columns are being listed.
 *
 *  @returns GTLRFusionTablesQuery_ColumnList
 *
 *  @note Automatic pagination will be done when @c shouldFetchNextPages is
 *        enabled. See @c shouldFetchNextPages on @c GTLRService for more
 *        information.
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Updates the name or type of an existing column. This method supports patch
 *  semantics.
 *
 *  Method: fusiontables.column.patch
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_ColumnPatch : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForColumnPatchWithObject:tableId:columnId:]

/** Name or identifier for the column that is being updated. */
@property(nonatomic, copy, nullable) NSString *columnId;

/** Table for which the column is being updated. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Column.
 *
 *  Updates the name or type of an existing column. This method supports patch
 *  semantics.
 *
 *  @param object The @c GTLRFusionTables_Column to include in the query.
 *  @param tableId Table for which the column is being updated.
 *  @param columnId Name or identifier for the column that is being updated.
 *
 *  @returns GTLRFusionTablesQuery_ColumnPatch
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Column *)object
                        tableId:(NSString *)tableId
                       columnId:(NSString *)columnId;

@end

/**
 *  Updates the name or type of an existing column.
 *
 *  Method: fusiontables.column.update
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_ColumnUpdate : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForColumnUpdateWithObject:tableId:columnId:]

/** Name or identifier for the column that is being updated. */
@property(nonatomic, copy, nullable) NSString *columnId;

/** Table for which the column is being updated. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Column.
 *
 *  Updates the name or type of an existing column.
 *
 *  @param object The @c GTLRFusionTables_Column to include in the query.
 *  @param tableId Table for which the column is being updated.
 *  @param columnId Name or identifier for the column that is being updated.
 *
 *  @returns GTLRFusionTablesQuery_ColumnUpdate
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Column *)object
                        tableId:(NSString *)tableId
                       columnId:(NSString *)columnId;

@end

/**
 *  Executes a Fusion Tables SQL statement, which can be any of
 *  - SELECT
 *  - INSERT
 *  - UPDATE
 *  - DELETE
 *  - SHOW
 *  - DESCRIBE
 *  - CREATE statement.
 *
 *  Method: fusiontables.query.sql
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_QuerySql : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForQuerySqlWithsql:]

/** Whether column names are included in the first row. Default is true. */
@property(nonatomic, assign) BOOL hdrs;

/**
 *  A Fusion Tables SQL statement, which can be any of
 *  - SELECT
 *  - INSERT
 *  - UPDATE
 *  - DELETE
 *  - SHOW
 *  - DESCRIBE
 *  - CREATE
 */
@property(nonatomic, copy, nullable) NSString *sql;

/**
 *  Whether typed values are returned in the (JSON) response: numbers for
 *  numeric values and parsed geometries for KML values. Default is true.
 */
@property(nonatomic, assign) BOOL typed;

/**
 *  Fetches a @c GTLRFusionTables_Sqlresponse.
 *
 *  Executes a Fusion Tables SQL statement, which can be any of
 *  - SELECT
 *  - INSERT
 *  - UPDATE
 *  - DELETE
 *  - SHOW
 *  - DESCRIBE
 *  - CREATE statement.
 *
 *  @param sql A Fusion Tables SQL statement, which can be any of
 *    - SELECT
 *    - INSERT
 *    - UPDATE
 *    - DELETE
 *    - SHOW
 *    - DESCRIBE
 *    - CREATE
 *
 *  @returns GTLRFusionTablesQuery_QuerySql
 */
+ (instancetype)queryWithSql:(NSString *)sql;

/**
 *  Fetches the requested resource data as a @c GTLRDataObject.
 *
 *  Executes a Fusion Tables SQL statement, which can be any of
 *  - SELECT
 *  - INSERT
 *  - UPDATE
 *  - DELETE
 *  - SHOW
 *  - DESCRIBE
 *  - CREATE statement.
 *
 *  @param sql A Fusion Tables SQL statement, which can be any of
 *    - SELECT
 *    - INSERT
 *    - UPDATE
 *    - DELETE
 *    - SHOW
 *    - DESCRIBE
 *    - CREATE
 *
 *  @returns GTLRFusionTablesQuery_QuerySql
 */
+ (instancetype)queryForMediaWithSql:(NSString *)sql;

@end

/**
 *  Executes a SQL statement which can be any of
 *  - SELECT
 *  - SHOW
 *  - DESCRIBE
 *
 *  Method: fusiontables.query.sqlGet
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_QuerySqlGet : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForQuerySqlGetWithsql:]

/** Whether column names are included (in the first row). Default is true. */
@property(nonatomic, assign) BOOL hdrs;

/**
 *  A SQL statement which can be any of
 *  - SELECT
 *  - SHOW
 *  - DESCRIBE
 */
@property(nonatomic, copy, nullable) NSString *sql;

/**
 *  Whether typed values are returned in the (JSON) response: numbers for
 *  numeric values and parsed geometries for KML values. Default is true.
 */
@property(nonatomic, assign) BOOL typed;

/**
 *  Fetches a @c GTLRFusionTables_Sqlresponse.
 *
 *  Executes a SQL statement which can be any of
 *  - SELECT
 *  - SHOW
 *  - DESCRIBE
 *
 *  @param sql A SQL statement which can be any of
 *    - SELECT
 *    - SHOW
 *    - DESCRIBE
 *
 *  @returns GTLRFusionTablesQuery_QuerySqlGet
 */
+ (instancetype)queryWithSql:(NSString *)sql;

/**
 *  Fetches the requested resource data as a @c GTLRDataObject.
 *
 *  Executes a SQL statement which can be any of
 *  - SELECT
 *  - SHOW
 *  - DESCRIBE
 *
 *  @param sql A SQL statement which can be any of
 *    - SELECT
 *    - SHOW
 *    - DESCRIBE
 *
 *  @returns GTLRFusionTablesQuery_QuerySqlGet
 */
+ (instancetype)queryForMediaWithSql:(NSString *)sql;

@end

/**
 *  Deletes a style.
 *
 *  Method: fusiontables.style.delete
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_StyleDelete : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForStyleDeleteWithtableId:styleId:]

/** Identifier (within a table) for the style being deleted */
@property(nonatomic, assign) NSInteger styleId;

/** Table from which the style is being deleted */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Upon successful completion, the callback's object and error parameters will
 *  be nil. This query does not fetch an object.
 *
 *  Deletes a style.
 *
 *  @param tableId Table from which the style is being deleted
 *  @param styleId Identifier (within a table) for the style being deleted
 *
 *  @returns GTLRFusionTablesQuery_StyleDelete
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                         styleId:(NSInteger)styleId;

@end

/**
 *  Gets a specific style.
 *
 *  Method: fusiontables.style.get
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_StyleGet : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForStyleGetWithtableId:styleId:]

/** Identifier (integer) for a specific style in a table */
@property(nonatomic, assign) NSInteger styleId;

/** Table to which the requested style belongs */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_StyleSetting.
 *
 *  Gets a specific style.
 *
 *  @param tableId Table to which the requested style belongs
 *  @param styleId Identifier (integer) for a specific style in a table
 *
 *  @returns GTLRFusionTablesQuery_StyleGet
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                         styleId:(NSInteger)styleId;

@end

/**
 *  Adds a new style for the table.
 *
 *  Method: fusiontables.style.insert
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_StyleInsert : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForStyleInsertWithObject:tableId:]

/** Table for which a new style is being added */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_StyleSetting.
 *
 *  Adds a new style for the table.
 *
 *  @param object The @c GTLRFusionTables_StyleSetting to include in the query.
 *  @param tableId Table for which a new style is being added
 *
 *  @returns GTLRFusionTablesQuery_StyleInsert
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_StyleSetting *)object
                        tableId:(NSString *)tableId;

@end

/**
 *  Retrieves a list of styles.
 *
 *  Method: fusiontables.style.list
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_StyleList : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForStyleListWithtableId:]

/** Maximum number of styles to return. Optional. Default is 5. */
@property(nonatomic, assign) NSUInteger maxResults;

/** Continuation token specifying which result page to return. Optional. */
@property(nonatomic, copy, nullable) NSString *pageToken;

/** Table whose styles are being listed */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_StyleSettingList.
 *
 *  Retrieves a list of styles.
 *
 *  @param tableId Table whose styles are being listed
 *
 *  @returns GTLRFusionTablesQuery_StyleList
 *
 *  @note Automatic pagination will be done when @c shouldFetchNextPages is
 *        enabled. See @c shouldFetchNextPages on @c GTLRService for more
 *        information.
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Updates an existing style. This method supports patch semantics.
 *
 *  Method: fusiontables.style.patch
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_StylePatch : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForStylePatchWithObject:tableId:styleId:]

/** Identifier (within a table) for the style being updated. */
@property(nonatomic, assign) NSInteger styleId;

/** Table whose style is being updated. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_StyleSetting.
 *
 *  Updates an existing style. This method supports patch semantics.
 *
 *  @param object The @c GTLRFusionTables_StyleSetting to include in the query.
 *  @param tableId Table whose style is being updated.
 *  @param styleId Identifier (within a table) for the style being updated.
 *
 *  @returns GTLRFusionTablesQuery_StylePatch
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_StyleSetting *)object
                        tableId:(NSString *)tableId
                        styleId:(NSInteger)styleId;

@end

/**
 *  Updates an existing style.
 *
 *  Method: fusiontables.style.update
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_StyleUpdate : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForStyleUpdateWithObject:tableId:styleId:]

/** Identifier (within a table) for the style being updated. */
@property(nonatomic, assign) NSInteger styleId;

/** Table whose style is being updated. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_StyleSetting.
 *
 *  Updates an existing style.
 *
 *  @param object The @c GTLRFusionTables_StyleSetting to include in the query.
 *  @param tableId Table whose style is being updated.
 *  @param styleId Identifier (within a table) for the style being updated.
 *
 *  @returns GTLRFusionTablesQuery_StyleUpdate
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_StyleSetting *)object
                        tableId:(NSString *)tableId
                        styleId:(NSInteger)styleId;

@end

/**
 *  Copies a table.
 *
 *  Method: fusiontables.table.copy
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TableCopy : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableCopyWithtableId:]

/** Whether to also copy tabs, styles, and templates. Default is false. */
@property(nonatomic, assign) BOOL copyPresentation;

/** ID of the table that is being copied. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Table.
 *
 *  Copies a table.
 *
 *  @param tableId ID of the table that is being copied.
 *
 *  @returns GTLRFusionTablesQuery_TableCopy
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Deletes a table.
 *
 *  Method: fusiontables.table.delete
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TableDelete : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableDeleteWithtableId:]

/** ID of the table to be deleted. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Upon successful completion, the callback's object and error parameters will
 *  be nil. This query does not fetch an object.
 *
 *  Deletes a table.
 *
 *  @param tableId ID of the table to be deleted.
 *
 *  @returns GTLRFusionTablesQuery_TableDelete
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Retrieves a specific table by its ID.
 *
 *  Method: fusiontables.table.get
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TableGet : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableGetWithtableId:]

/** Identifier for the table being requested. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Table.
 *
 *  Retrieves a specific table by its ID.
 *
 *  @param tableId Identifier for the table being requested.
 *
 *  @returns GTLRFusionTablesQuery_TableGet
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Imports more rows into a table.
 *
 *  Method: fusiontables.table.importRows
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TableImportRows : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableImportRowsWithtableId:]

/**
 *  The delimiter used to separate cell values. This can only consist of a
 *  single character. Default is ,.
 */
@property(nonatomic, copy, nullable) NSString *delimiter;

/**
 *  The encoding of the content. Default is UTF-8. Use auto-detect if you are
 *  unsure of the encoding.
 */
@property(nonatomic, copy, nullable) NSString *encoding;

/**
 *  The index of the line up to which data will be imported. Default is to
 *  import the entire file. If endLine is negative, it is an offset from the end
 *  of the file; the imported content will exclude the last endLine lines.
 */
@property(nonatomic, assign) NSInteger endLine;

/**
 *  Whether the imported CSV must have the same number of values for each row.
 *  If false, rows with fewer values will be padded with empty values. Default
 *  is true.
 */
@property(nonatomic, assign) BOOL isStrict;

/**
 *  The index of the first line from which to start importing, inclusive.
 *  Default is 0.
 */
@property(nonatomic, assign) NSInteger startLine;

/** The table into which new rows are being imported. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Import.
 *
 *  Imports more rows into a table.
 *
 *  @param tableId The table into which new rows are being imported.
 *  @param uploadParameters The media to include in this query. Maximum size
 *    250MB. Accepted MIME type: application/octet-stream
 *
 *  @returns GTLRFusionTablesQuery_TableImportRows
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                uploadParameters:(nullable GTLRUploadParameters *)uploadParameters;

@end

/**
 *  Imports a new table.
 *
 *  Method: fusiontables.table.importTable
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TableImportTable : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableImportTableWithname:]

/**
 *  The delimiter used to separate cell values. This can only consist of a
 *  single character. Default is ,.
 */
@property(nonatomic, copy, nullable) NSString *delimiter;

/**
 *  The encoding of the content. Default is UTF-8. Use auto-detect if you are
 *  unsure of the encoding.
 */
@property(nonatomic, copy, nullable) NSString *encoding;

/** The name to be assigned to the new table. */
@property(nonatomic, copy, nullable) NSString *name;

/**
 *  Fetches a @c GTLRFusionTables_Table.
 *
 *  Imports a new table.
 *
 *  @param name The name to be assigned to the new table.
 *  @param uploadParameters The media to include in this query. Maximum size
 *    250MB. Accepted MIME type: application/octet-stream
 *
 *  @returns GTLRFusionTablesQuery_TableImportTable
 */
+ (instancetype)queryWithName:(NSString *)name
             uploadParameters:(nullable GTLRUploadParameters *)uploadParameters;

@end

/**
 *  Creates a new table.
 *
 *  Method: fusiontables.table.insert
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TableInsert : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableInsertWithObject:]

/**
 *  Fetches a @c GTLRFusionTables_Table.
 *
 *  Creates a new table.
 *
 *  @param object The @c GTLRFusionTables_Table to include in the query.
 *
 *  @returns GTLRFusionTablesQuery_TableInsert
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Table *)object;

@end

/**
 *  Retrieves a list of tables a user owns.
 *
 *  Method: fusiontables.table.list
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TableList : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableList]

/** Maximum number of tables to return. Default is 5. */
@property(nonatomic, assign) NSUInteger maxResults;

/** Continuation token specifying which result page to return. */
@property(nonatomic, copy, nullable) NSString *pageToken;

/**
 *  Fetches a @c GTLRFusionTables_TableList.
 *
 *  Retrieves a list of tables a user owns.
 *
 *  @returns GTLRFusionTablesQuery_TableList
 *
 *  @note Automatic pagination will be done when @c shouldFetchNextPages is
 *        enabled. See @c shouldFetchNextPages on @c GTLRService for more
 *        information.
 */
+ (instancetype)query;

@end

/**
 *  Updates an existing table. Unless explicitly requested, only the name,
 *  description, and attribution will be updated. This method supports patch
 *  semantics.
 *
 *  Method: fusiontables.table.patch
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TablePatch : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTablePatchWithObject:tableId:]

/**
 *  Whether the view definition is also updated. The specified view definition
 *  replaces the existing one. Only a view can be updated with a new definition.
 */
@property(nonatomic, assign) BOOL replaceViewDefinition;

/** ID of the table that is being updated. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Table.
 *
 *  Updates an existing table. Unless explicitly requested, only the name,
 *  description, and attribution will be updated. This method supports patch
 *  semantics.
 *
 *  @param object The @c GTLRFusionTables_Table to include in the query.
 *  @param tableId ID of the table that is being updated.
 *
 *  @returns GTLRFusionTablesQuery_TablePatch
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Table *)object
                        tableId:(NSString *)tableId;

@end

/**
 *  Replaces rows of an existing table. Current rows remain visible until all
 *  replacement rows are ready.
 *
 *  Method: fusiontables.table.replaceRows
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TableReplaceRows : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableReplaceRowsWithtableId:]

/**
 *  The delimiter used to separate cell values. This can only consist of a
 *  single character. Default is ,.
 */
@property(nonatomic, copy, nullable) NSString *delimiter;

/**
 *  The encoding of the content. Default is UTF-8. Use 'auto-detect' if you are
 *  unsure of the encoding.
 */
@property(nonatomic, copy, nullable) NSString *encoding;

/**
 *  The index of the line up to which data will be imported. Default is to
 *  import the entire file. If endLine is negative, it is an offset from the end
 *  of the file; the imported content will exclude the last endLine lines.
 */
@property(nonatomic, assign) NSInteger endLine;

/**
 *  Whether the imported CSV must have the same number of column values for each
 *  row. If true, throws an exception if the CSV does not have the same number
 *  of columns. If false, rows with fewer column values will be padded with
 *  empty values. Default is true.
 */
@property(nonatomic, assign) BOOL isStrict;

/**
 *  The index of the first line from which to start importing, inclusive.
 *  Default is 0.
 */
@property(nonatomic, assign) NSInteger startLine;

/** Table whose rows will be replaced. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Task.
 *
 *  Replaces rows of an existing table. Current rows remain visible until all
 *  replacement rows are ready.
 *
 *  @param tableId Table whose rows will be replaced.
 *  @param uploadParameters The media to include in this query. Maximum size
 *    250MB. Accepted MIME type: application/octet-stream
 *
 *  @returns GTLRFusionTablesQuery_TableReplaceRows
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                uploadParameters:(nullable GTLRUploadParameters *)uploadParameters;

@end

/**
 *  Updates an existing table. Unless explicitly requested, only the name,
 *  description, and attribution will be updated.
 *
 *  Method: fusiontables.table.update
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TableUpdate : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTableUpdateWithObject:tableId:]

/**
 *  Whether the view definition is also updated. The specified view definition
 *  replaces the existing one. Only a view can be updated with a new definition.
 */
@property(nonatomic, assign) BOOL replaceViewDefinition;

/** ID of the table that is being updated. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Table.
 *
 *  Updates an existing table. Unless explicitly requested, only the name,
 *  description, and attribution will be updated.
 *
 *  @param object The @c GTLRFusionTables_Table to include in the query.
 *  @param tableId ID of the table that is being updated.
 *
 *  @returns GTLRFusionTablesQuery_TableUpdate
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Table *)object
                        tableId:(NSString *)tableId;

@end

/**
 *  Deletes a specific task by its ID, unless that task has already started
 *  running.
 *
 *  Method: fusiontables.task.delete
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TaskDelete : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTaskDeleteWithtableId:taskId:]

/** Table from which the task is being deleted. */
@property(nonatomic, copy, nullable) NSString *tableId;

/** The identifier of the task to delete. */
@property(nonatomic, copy, nullable) NSString *taskId;

/**
 *  Upon successful completion, the callback's object and error parameters will
 *  be nil. This query does not fetch an object.
 *
 *  Deletes a specific task by its ID, unless that task has already started
 *  running.
 *
 *  @param tableId Table from which the task is being deleted.
 *  @param taskId The identifier of the task to delete.
 *
 *  @returns GTLRFusionTablesQuery_TaskDelete
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                          taskId:(NSString *)taskId;

@end

/**
 *  Retrieves a specific task by its ID.
 *
 *  Method: fusiontables.task.get
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TaskGet : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTaskGetWithtableId:taskId:]

/** Table to which the task belongs. */
@property(nonatomic, copy, nullable) NSString *tableId;

/** The identifier of the task to get. */
@property(nonatomic, copy, nullable) NSString *taskId;

/**
 *  Fetches a @c GTLRFusionTables_Task.
 *
 *  Retrieves a specific task by its ID.
 *
 *  @param tableId Table to which the task belongs.
 *  @param taskId The identifier of the task to get.
 *
 *  @returns GTLRFusionTablesQuery_TaskGet
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                          taskId:(NSString *)taskId;

@end

/**
 *  Retrieves a list of tasks.
 *
 *  Method: fusiontables.task.list
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TaskList : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTaskListWithtableId:]

/** Maximum number of tasks to return. Default is 5. */
@property(nonatomic, assign) NSUInteger maxResults;

/** Continuation token specifying which result page to return. */
@property(nonatomic, copy, nullable) NSString *pageToken;

/** Index of the first result returned in the current page. */
@property(nonatomic, assign) NSUInteger startIndex;

/** Table whose tasks are being listed. */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_TaskList.
 *
 *  Retrieves a list of tasks.
 *
 *  @param tableId Table whose tasks are being listed.
 *
 *  @returns GTLRFusionTablesQuery_TaskList
 *
 *  @note Automatic pagination will be done when @c shouldFetchNextPages is
 *        enabled. See @c shouldFetchNextPages on @c GTLRService for more
 *        information.
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Deletes a template
 *
 *  Method: fusiontables.template.delete
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TemplateDelete : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTemplateDeleteWithtableId:templateId:]

/** Table from which the template is being deleted */
@property(nonatomic, copy, nullable) NSString *tableId;

/** Identifier for the template which is being deleted */
@property(nonatomic, assign) NSInteger templateId;

/**
 *  Upon successful completion, the callback's object and error parameters will
 *  be nil. This query does not fetch an object.
 *
 *  Deletes a template
 *
 *  @param tableId Table from which the template is being deleted
 *  @param templateId Identifier for the template which is being deleted
 *
 *  @returns GTLRFusionTablesQuery_TemplateDelete
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                      templateId:(NSInteger)templateId;

@end

/**
 *  Retrieves a specific template by its id
 *
 *  Method: fusiontables.template.get
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TemplateGet : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTemplateGetWithtableId:templateId:]

/** Table to which the template belongs */
@property(nonatomic, copy, nullable) NSString *tableId;

/** Identifier for the template that is being requested */
@property(nonatomic, assign) NSInteger templateId;

/**
 *  Fetches a @c GTLRFusionTables_Template.
 *
 *  Retrieves a specific template by its id
 *
 *  @param tableId Table to which the template belongs
 *  @param templateId Identifier for the template that is being requested
 *
 *  @returns GTLRFusionTablesQuery_TemplateGet
 */
+ (instancetype)queryWithTableId:(NSString *)tableId
                      templateId:(NSInteger)templateId;

@end

/**
 *  Creates a new template for the table.
 *
 *  Method: fusiontables.template.insert
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TemplateInsert : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTemplateInsertWithObject:tableId:]

/** Table for which a new template is being created */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_Template.
 *
 *  Creates a new template for the table.
 *
 *  @param object The @c GTLRFusionTables_Template to include in the query.
 *  @param tableId Table for which a new template is being created
 *
 *  @returns GTLRFusionTablesQuery_TemplateInsert
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Template *)object
                        tableId:(NSString *)tableId;

@end

/**
 *  Retrieves a list of templates.
 *
 *  Method: fusiontables.template.list
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 *    @c kGTLRAuthScopeFusionTablesReadonly
 */
@interface GTLRFusionTablesQuery_TemplateList : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTemplateListWithtableId:]

/** Maximum number of templates to return. Optional. Default is 5. */
@property(nonatomic, assign) NSUInteger maxResults;

/** Continuation token specifying which results page to return. Optional. */
@property(nonatomic, copy, nullable) NSString *pageToken;

/** Identifier for the table whose templates are being requested */
@property(nonatomic, copy, nullable) NSString *tableId;

/**
 *  Fetches a @c GTLRFusionTables_TemplateList.
 *
 *  Retrieves a list of templates.
 *
 *  @param tableId Identifier for the table whose templates are being requested
 *
 *  @returns GTLRFusionTablesQuery_TemplateList
 *
 *  @note Automatic pagination will be done when @c shouldFetchNextPages is
 *        enabled. See @c shouldFetchNextPages on @c GTLRService for more
 *        information.
 */
+ (instancetype)queryWithTableId:(NSString *)tableId;

@end

/**
 *  Updates an existing template. This method supports patch semantics.
 *
 *  Method: fusiontables.template.patch
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TemplatePatch : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTemplatePatchWithObject:tableId:templateId:]

/** Table to which the updated template belongs */
@property(nonatomic, copy, nullable) NSString *tableId;

/** Identifier for the template that is being updated */
@property(nonatomic, assign) NSInteger templateId;

/**
 *  Fetches a @c GTLRFusionTables_Template.
 *
 *  Updates an existing template. This method supports patch semantics.
 *
 *  @param object The @c GTLRFusionTables_Template to include in the query.
 *  @param tableId Table to which the updated template belongs
 *  @param templateId Identifier for the template that is being updated
 *
 *  @returns GTLRFusionTablesQuery_TemplatePatch
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Template *)object
                        tableId:(NSString *)tableId
                     templateId:(NSInteger)templateId;

@end

/**
 *  Updates an existing template
 *
 *  Method: fusiontables.template.update
 *
 *  Authorization scope(s):
 *    @c kGTLRAuthScopeFusionTables
 */
@interface GTLRFusionTablesQuery_TemplateUpdate : GTLRFusionTablesQuery
// Previous library name was
//   +[GTLQueryFusionTables queryForTemplateUpdateWithObject:tableId:templateId:]

/** Table to which the updated template belongs */
@property(nonatomic, copy, nullable) NSString *tableId;

/** Identifier for the template that is being updated */
@property(nonatomic, assign) NSInteger templateId;

/**
 *  Fetches a @c GTLRFusionTables_Template.
 *
 *  Updates an existing template
 *
 *  @param object The @c GTLRFusionTables_Template to include in the query.
 *  @param tableId Table to which the updated template belongs
 *  @param templateId Identifier for the template that is being updated
 *
 *  @returns GTLRFusionTablesQuery_TemplateUpdate
 */
+ (instancetype)queryWithObject:(GTLRFusionTables_Template *)object
                        tableId:(NSString *)tableId
                     templateId:(NSInteger)templateId;

@end

NS_ASSUME_NONNULL_END


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _04.Rotate_Array_of_Strings
{
    class RotateArrayOfString
    {
        static void Main(string[] args)
        {
            //string[] arr = Console.ReadLine()
            //    .Split(new char[] { ' ' },StringSplitOptions.RemoveEmptyEntries);
            //      ---> razdelq ot interval , i premahva praznite poleta !!!
            //for (int cnt = 0; cnt < arr.Length; cnt++)
            //{
            //    Console.WriteLine(arr[cnt]);
            //}
            string[] arr = Console.ReadLine().Split(' ');
            string[] resultArr = new string[arr.Length];

            for (int cnt = 0; cnt < arr.Length ; cnt++)
            {
                resultArr[(cnt +1  ) % arr.Length] = arr[cnt];
            }
            //resultArr[0] = arr[arr.Length - 1];

            Console.WriteLine(string.Join(" ", resultArr));
        }
    }
}


text:
import React from 'react';

export default class PlantListAddBox extends React.Component {
    static get propTypes() {
        return {
            onAdd: React.PropTypes.func.isRequired
        };
    }

    handleAdd() {
        const addInput = this.refs.addInput;
        const name = addInput.value.trim().toLowerCase();

        if (name.length < 2) {
            addInput.setCustomValidity('Name must be at least two characters');
        } else {
            addInput.setCustomValidity('');
        }

        if (addInput.checkValidity()) {
            this.props.onAdd(name);
            addInput.value = '';
        }
    }

    render() {
        return (
            <div className="plantListAddBox">
                <input
                    maxLength="100"
                    placeholder="Plant name"
                    ref="addInput"
                    size="12"
                    type="text" />
                <button
                    onClick={this.handleAdd.bind(this)}
                    type="button">
                    Add
                </button>
            </div>
        );
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.cassandra;

import com.facebook.presto.tests.AbstractTestIntegrationSmokeTest;
import org.testng.annotations.Test;

import java.util.Date;

import static com.facebook.presto.cassandra.CassandraQueryRunner.createCassandraQueryRunner;
import static com.facebook.presto.cassandra.CassandraQueryRunner.createCassandraSession;
import static com.facebook.presto.cassandra.CassandraTestingUtils.initializeTestData;
import static io.airlift.tpch.TpchTable.ORDERS;

@Test(singleThreaded = true)
public class TestCassandraIntegrationSmokeTest
        extends AbstractTestIntegrationSmokeTest
{
    public TestCassandraIntegrationSmokeTest()
            throws Exception
    {
        super(createCassandraQueryRunner(ORDERS));
    }

    @Test
    public void testStringPartitionKey()
    {
        String keyspace = "smoke_test";
        initializeTestData(new Date(), keyspace);

        queryRunner.execute(createCassandraSession(keyspace), "select * from presto_test where key='key 1'");
        queryRunner.execute(createCassandraSession(keyspace), "select * from presto_test where key='key 2'");
        queryRunner.execute(createCassandraSession(keyspace), "select * from presto_test where key='key 3'");
    }
}


text:
"""Utility methods for scheduling."""

import sys

from nova.compute import flavors
from nova.compute import utils as compute_utils
from nova import db
from nova import notifications
from nova import notifier as notify
from nova.objects import base as obj_base
from nova.objects import instance as instance_obj
from nova.openstack.common.gettextutils import _
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging

LOG = logging.getLogger(__name__)

def build_request_spec(ctxt, image, instances, instance_type=None):
    """Build a request_spec for the scheduler.

    The request_spec assumes that all instances to be scheduled are the same
    type.
    """
    instance = instances[0]
    if isinstance(instance, instance_obj.Instance):
        instance = obj_base.obj_to_primitive(instance)

    if instance_type is None:
        instance_type = flavors.extract_flavor(instance)
    # NOTE(comstud): This is a bit ugly, but will get cleaned up when
    # we're passing an InstanceType internal object.
    extra_specs = db.flavor_extra_specs_get(ctxt, instance_type['flavorid'])
    instance_type['extra_specs'] = extra_specs
    request_spec = {
            'image': image or {},
            'instance_properties': instance,
            'instance_type': instance_type,
            'num_instances': len(instances),
            # NOTE(alaski): This should be removed as logic moves from the
            # scheduler to conductor.  Provides backwards compatibility now.
            'instance_uuids': [inst['uuid'] for inst in instances]}
    return jsonutils.to_primitive(request_spec)

def set_vm_state_and_notify(context, service, method, updates, ex,
                            request_spec, db):
    """changes VM state and notifies."""
    LOG.warning(_("Failed to %(service)s_%(method)s: %(ex)s"),
                {'service': service, 'method': method, 'ex': ex})

    vm_state = updates['vm_state']
    properties = request_spec.get('instance_properties', {})
    # NOTE(vish): We shouldn't get here unless we have a catastrophic
    #             failure, so just set all instances to error. if uuid
    #             is not set, instance_uuids will be set to [None], this
    #             is solely to preserve existing behavior and can
    #             be removed along with the 'if instance_uuid:' if we can
    #             verify that uuid is always set.
    uuids = [properties.get('uuid')]
    from nova.conductor import api as conductor_api
    conductor = conductor_api.LocalAPI()
    notifier = notify.get_notifier(service)
    for instance_uuid in request_spec.get('instance_uuids') or uuids:
        if instance_uuid:
            state = vm_state.upper()
            LOG.warning(_('Setting instance to %s state.'), state,
                        instance_uuid=instance_uuid)

            # update instance state and notify on the transition
            (old_ref, new_ref) = db.instance_update_and_get_original(
                    context, instance_uuid, updates)
            notifications.send_update(context, old_ref, new_ref,
                    service=service)
            compute_utils.add_instance_fault_from_exc(context,
                    conductor,
                    new_ref, ex, sys.exc_info())

        payload = dict(request_spec=request_spec,
                        instance_properties=properties,
                        instance_id=instance_uuid,
                        state=vm_state,
                        method=method,
                        reason=ex)

        event_type = '%s.%s' % (service, method)
        notifier.error(context, event_type, payload)

def populate_filter_properties(filter_properties, host_state):
    """Add additional information to the filter properties after a node has
    been selected by the scheduling process.
    """
    if isinstance(host_state, dict):
        host = host_state['host']
        nodename = host_state['nodename']
        limits = host_state['limits']
    else:
        host = host_state.host
        nodename = host_state.nodename
        limits = host_state.limits

    # Adds a retry entry for the selected compute host and node:
    _add_retry_host(filter_properties, host, nodename)

    # Adds oversubscription policy
    if not filter_properties.get('force_hosts'):
        filter_properties['limits'] = limits

def _add_retry_host(filter_properties, host, node):
    """Add a retry entry for the selected compute node. In the event that
    the request gets re-scheduled, this entry will signal that the given
    node has already been tried.
    """
    retry = filter_properties.get('retry', None)
    force_hosts = filter_properties.get('force_hosts', [])
    force_nodes = filter_properties.get('force_nodes', [])
    if not retry or force_hosts or force_nodes:
        return
    hosts = retry['hosts']
    hosts.append([host, node])


text:
#ifndef DEFS_HEADER_DEFINED
#define	DEFS_HEADER_DEFINED

#include "wsman_config.h"

#ifdef SHTTPD_GSS
#include <gssapi/gssapi_generic.h>
#endif

#include "std_includes.h"
#include "llist.h"
#include "io.h"
#include "shttpd.h"
#include "adapter.h"
#include "md5.h"
#include "u/libu.h"
#include <dlfcn.h>

#undef VERSION
#define	VERSION		"1.39"		/* Version			*/

#ifndef CONFIG
#define	CONFIG		"shttpd.conf"	/* Configuration file		*/
#endif /* CONFIG */

#define	HTPASSWD	".htpasswd"	/* Passwords file name		*/
#define	DFLT_IO_SIZ	"16384"		/* Default max request size	*/
#define	LISTENING_PORTS	"80"		/* Default listening ports	*/
#define	INDEX_FILES	"index.html index.htm index.php index.cgi"
#define	CGI_EXT		".cgi .pl .php"	/* Default CGI extensions	*/
#define	SSI_EXT		".shtml .shtm"	/* Default SSI extensions	*/
#define	REALM		"mydomain.com"	/* Default authentication realm	*/
#define	DELIM_CHARS	" ,"		/* Separators for lists		*/

#define	EXPIRE_TIME	3600		/* Expiration time, seconds	*/
#define	ENV_MAX		4096		/* Size of environment block	*/
#define	CGI_ENV_VARS	64		/* Maximum vars passed to CGI	*/
#define	URI_MAX		32768		/* Maximum URI size		*/
#define	MIN_REQ_LEN	16		/* "GET / HTTP/1.1\n\n"		*/

#define	NELEMS(ar)	(sizeof(ar) / sizeof(ar[0]))

#define GLOBAL_DEBUG
#ifdef GLOBAL_DEBUG
#ifdef _DEBUG
#define	DBG(x)	do { printf x ; putchar('\n'); fflush(stdout); } while (0)
#else
#define	DBG(x) do { debug x; } while(0)
#endif /* DEBUG */
#else
#define DBG(x)
#endif

#ifdef EMBEDDED
#include "shttpd.h"
#endif /* EMBEDDED */

/*
 * Darwin prior to 7.0 and Win32 do not have socklen_t
 */
#ifdef NO_SOCKLEN_T
typedef int socklen_t;
#endif /* NO_SOCKLEN_T */

/*
 * For parsing. This guy represents a substring.
 */
struct vec {
	const char	*ptr;
	int		len;
};

enum {BASIC_AUTH, DIGEST_AUTH};
enum {METHOD_GET, METHOD_POST, METHOD_PUT, METHOD_DELETE, METHOD_HEAD};
enum {HDR_DATE, HDR_INT, HDR_STRING};	/* HTTP header types		*/
enum {E_FATAL = 1, E_LOG = 2};		/* Flags for elog() function	*/
typedef unsigned long big_int_t;	/* Type for Content-Length	*/

/*
 * Unified socket address
 */
struct usa {
	socklen_t len;
	union {
		struct sockaddr	sa;
#ifdef ENABLE_IPV6
		struct sockaddr_in6 sin6;
#endif
		struct sockaddr_in sin;
	} u;
};

/*
 * This thing is aimed to hold values of any type.
 * Used to store parsed headers' values.
 */
union variant {
	char		*v_str;
	int		v_int;
	big_int_t	v_big_int;
	time_t		v_time;
	void		(*v_func)(void);
	void		*v_void;
	struct vec	v_vec;
};

/*
 * This structure is used to hold mime types and associated file extensions.
 */
struct mime_type {
	const char	*ext;
	int		ext_len;
	const char	*mime;
};

struct mime_type_link {
	struct llhead	link;
	char		*ext;
	int		ext_len;
	char		*mime;
};

/*
 * This is used only in embedded configuration. This structure holds a
 * registered URI, associated callback function with callback data.
 * For non-embedded compilation shttpd_callback_t is not defined, so
 * we use union variant to keep the compiler silent.
 */
struct registered_uri {
	struct llhead	link;
	const char	*uri;
	union variant	callback;
	void		*callback_data;
};

/*
 * User may bind a passwords file to any URI. This makes that URI password
 * protected: anybody who accesses that URI will be asked to authorize.
 */
struct uri_auth {
	struct llhead	link;
	const char	*uri;
	const char	*file_name;
	int type;
	size_t		uri_len;
	union variant callback;
	void *callback_data;
};

/*
 * User may want to handle certain errors. This structure holds the
 * handlers for corresponding error codes.
 */
struct error_handler {
	struct llhead	link;
	int		code;
	union variant	callback;
	void		*callback_data;
};

struct http_header {
	int		len;		/* Header name length		*/
	int		type;		/* Header type			*/
	size_t		offset;		/* Value placeholder		*/
	const char	*name;		/* Header name			*/
};

/*
 * This guy holds parsed HTTP headers
 */
struct headers {
	union variant	cl;		/* Content-Length:		*/
	union variant	ct;		/* Content-Type:		*/
	union variant	connection;	/* Connection:			*/
	union variant	ims;		/* If-Modified-Since:		*/
	union variant	user;		/* Remote user name		*/
	union variant	auth;		/* Authorization		*/
	union variant	useragent;	/* User-Agent:			*/
	union variant	referer;	/* Referer:			*/
	union variant	cookie;		/* Cookie:			*/
	union variant	location;	/* Location:			*/
	union variant	range;		/* Range:			*/
	union variant	status;		/* Status:			*/
	union variant	transenc;	/* Transfer-Encoding:		*/
};

/* Must go after union variant definition */
#include "ssl.h"
#include <openssl/err.h>

/*
 * The communication channel
 */
union channel {
	int		fd;		/* Regular static file		*/
	int		sock;		/* Connected socket		*/
	struct {
		int		sock;	/* XXX important. must be first	*/
		SSL		*ssl;	/* shttpd_poll() assumes that	*/
	} ssl;				/* SSL-ed socket		*/
	struct {
		DIR	*dirp;
		char	*path;
	} dir;				/* Opened directory		*/
	struct {
		void		*state;	/* For keeping state		*/
		union variant	func;	/* User callback function	*/
		void		*data;	/* User defined parameters	*/
	} emb;				/* Embedded, user callback	*/
};

struct stream;

/*
 * IO class descriptor (file, directory, socket, SSL, CGI, etc)
 * These classes are defined in io_*.c files.
 */
struct io_class {
	const char *name;
	int (*read)(struct stream *, void *buf, size_t len);
	int (*write)(struct stream *, const void *buf, size_t len);
	void (*close)(struct stream *);
};

/*
 * Data exchange stream. It is backed by some communication channel:
 * opened file, socket, etc. The 'read' and 'write' methods are
 * determined by a communication channel.
 */
struct stream {
	struct conn		*conn;
	union channel		chan;		/* Descriptor		*/
	struct io		io;		/* IO buffer		*/
	const struct io_class	*io_class;	/* IO class		*/
	int			nread_last;	/* Bytes last read	*/
	int			headers_len;
	big_int_t		content_len;
	unsigned int		flags;
#define	FLAG_HEADERS_PARSED	1
#define	FLAG_SSL_ACCEPTED	2
#define	FLAG_R			4		/* Can read in general	*/
#define	FLAG_W			8		/* Can write in general	*/
#define	FLAG_CLOSED		16
#define	FLAG_DONT_CLOSE		32
#define	FLAG_ALWAYS_READY	64		/* File, dir, user_func	*/
#define	FLAG_SSL_SHOULD_SELECT_ON_WRITE	128	/* ssl should select on write next time  */
#define	FLAG_SSL_SHOULD_SELECT_ON_READ	256	/*  ssl should select on read next time */
#define FLAG_RESPONSE_COMPLETE 512
};

struct conn {
	struct llhead	link;		/* Connections chain		*/
	struct shttpd_ctx *ctx;		/* Context this conn belongs to */
	struct usa	sa;		/* Remote socket address	*/
	time_t		birth_time;	/* Creation time		*/
	time_t		expire_time;	/* Expiration time		*/

	int		loc_port;	/* Local port			*/
	int		status;		/* Reply status code		*/
	int		method;		/* Request method		*/
	char		*uri;		/* Decoded URI			*/
	unsigned long	major_version;	/* Major HTTP version number    */
	unsigned long	minor_version;	/* Minor HTTP version number    */
	char		*request;	/* Request line			*/
	char		*headers;	/* Request headers		*/
	char		*query;		/* QUERY_STRING part of the URI	*/
	char		*path_info;	/* PATH_INFO thing		*/
	const char	*mime_type;	/* Mime type			*/

	struct headers	ch;		/* Parsed client headers	*/

	struct stream	loc;		/* Local stream			*/
	struct stream	rem;		/* Remote stream		*/
#ifdef SHTTPD_GSS
	gss_ctx_id_t gss_ctx;    /* GSS context */
#endif

#if !defined(NO_SSI)
	void			*ssi;	/* SSI descriptor		*/
#endif /* NO_SSI */
};

/*
 * SHTTPD context
 */
struct shttpd_ctx {
	time_t		start_time;	/* Start time			*/
	int		nactive;	/* # of connections now		*/
	unsigned long	nrequests;	/* Requests made		*/
	uint64_t	in, out;	/* IN/OUT traffic counters	*/
	SSL_CTX		*ssl_ctx;	/* SSL context			*/
	struct llhead	connections;	/* List of connections		*/

	struct llhead	mime_types;	/* Known mime types		*/
	struct llhead	registered_uris;/* User urls			*/
	struct llhead	uri_auths;	/* User auth files		*/
	struct llhead	error_handlers;	/* Embedded error handlers	*/
	struct llhead	acl;		/* Access control list		*/

	FILE	*access_log;		/* Access log stream		*/
	FILE	*error_log;		/* Error log stream		*/
	char	*put_auth_file;		/* PUT auth file		*/
	char	*document_root;		/* Document root		*/
	char	*index_files;		/* Index files			*/
	char	*aliases;		/* Aliases			*/
	char	*mime_file;		/* Mime types file		*/
#if !defined(NO_CGI)
	char	*cgi_vars;		/* CGI environment variables	*/
	char	*cgi_extensions;	/* CGI extensions		*/
	char	*cgi_interpreter;	/* CGI script interpreter	*/
#endif /* NO_CGI */
#if !defined(NO_SSI)
	char	*ssi_extensions;	/* SSI file extensions		*/
	struct llhead	ssi_funcs;	/* SSI callback functions	*/
#endif /* NO_SSI */
	char	*auth_realm;		/* Auth realm			*/
	char	*global_passwd_file;	/* Global passwords file	*/
	char	*uid;			/* Run as user			*/
	char	*ports;			/* Listening ports		*/
	int	dirlist;		/* Directory listing		*/
	int	gui;			/* Show GUI flag		*/
	int	auto_start;		/* Start on OS boot		*/
	int	io_buf_size;		/* IO buffer size		*/
	int	inetd_mode;		/* Inetd flag			*/
#if defined(_WIN32)
	CRITICAL_SECTION mutex;		/* For MT case			*/
	HANDLE		ev[2];		/* For thread synchronization */
#elif defined(__rtems__)
	rtems_id         mutex;
#endif /* _WIN32 */
};

/* Option setter function */
typedef void (*optset_t)(struct shttpd_ctx *, void *ptr, const char *string);
struct opt {
	int		sw;		/* Command line switch		*/
	const char	*name;		/* Option name in config file	*/
	const char	*desc;		/* Description			*/
	optset_t	setter;		/* Option setter function	*/
	size_t		ofs;		/* Value offset in context	*/
	const char	*arg;		/* Argument format		*/
	const char	*def;		/* Default option value		*/
	unsigned int	flags;		/* Flags			*/
#define	OPT_BOOL	1
#define	OPT_INT		2
#define	OPT_FILE	4
#define	OPT_DIR		8
#define	OPT_ADVANCED	16
};

extern const struct opt options[];

/*
 * In SHTTPD, list of values are represented as comma or space separated
 * string. For example, list of CGI extensions can be represented as
 * ".cgi,.php,.pl", or ".cgi .php .pl". The macro that follows allows to
 * loop through the individual values in that list.
 *
 * A "const char *" pointer and size_t variable must be passed to the macro.
 * Spaces or commas can be used as delimiters (macro DELIM_CHARS).
 *
 * In every iteration of the loop, "s" points to the current value, and
 * "len" specifies its length. The code inside loop must not change
 * "s" and "len" parameters.
 */
#define	FOR_EACH_WORD_IN_LIST(s,len)					\
	for (; s != NULL && (len = strcspn(s, DELIM_CHARS)) != 0;	\
			s += len, s+= strspn(s, DELIM_CHARS))

/*
 * IPv4 ACL entry. Specifies subnet with deny/allow flag
 */
struct acl {
	struct llhead	link;
	uint32_t	ip;		/* IP, in network byte order	*/
	uint32_t	mask;		/* Also in network byte order	*/
	int		flag;		/* Either '+' or '-'		*/
};

/*
 * shttpd.c
 */
extern time_t		current_time;	/* Current UTC time		*/
extern int		tz_offset;	/* Offset from GMT time zone	*/
extern const struct vec known_http_methods[];

extern void	stop_stream(struct stream *stream);
extern int	url_decode(const char *, int, char *dst, int);
extern void	send_server_error(struct conn *, int code, const char *reason);
extern int	get_headers_len(const char *buf, size_t buflen);
extern void	parse_headers(const char *s, int len, struct headers *parsed);
extern void	open_listening_ports(struct shttpd_ctx *ctx);

/*
 * mime_type.c
 */
extern const char *get_mime_type(struct shttpd_ctx *, const char *uri, int len);
extern void	set_mime_types(struct shttpd_ctx *ctx, const char *path);

/*
 * config.c
 */
extern void	usage(const char *prog);
extern struct shttpd_ctx *init_from_argc_argv(const char *, int, char *[]);

/*
 * log.c
 */
// extern void	elog(int flags, struct conn *c, const char *fmt, ...);
#define elog(level, conn, ...) \
        do { \
                debug( __VA_ARGS__ ); \
                if (level == E_FATAL) exit(EXIT_FAILURE); \
        } while (0)

// extern void	log_access(FILE *fp, const struct conn *c);

/*
 * string.c
 */
extern void	my_strlcpy(register char *, register const char *, size_t);
/*
extern int	my_strncasecmp(register const char *, register const char *, size_t);
extern char	*my_strndup(const char *ptr, size_t len);
extern char	*my_strdup(const char *str);
extern int	my_snprintf(char *buf, size_t buflen, const char *fmt, ...);
*/
extern int	match_extension(const char *path, const char *ext_list);

/*
 * compat_*.c
 */
extern void	set_close_on_exec(int fd);
extern int	set_non_blocking_mode(int fd);
extern int	my_stat(const char *, struct stat *stp);
extern int	my_open(const char *, int flags, int mode);
extern int	my_remove(const char *);
extern int	my_rename(const char *, const char *);
extern int	my_mkdir(const char *, int);
extern char *	my_getcwd(char *, int);
extern int	spawn_process(struct conn *c, const char *prog,
		char *envblk, char *envp[], int sock, const char *dir);

/*
 * io_*.c
 */
extern const struct io_class	io_file;
extern const struct io_class	io_socket;
extern const struct io_class	io_ssl;
extern const struct io_class	io_cgi;
extern const struct io_class	io_dir;
extern const struct io_class	io_embedded;
extern const struct io_class	io_ssi;

extern int	put_dir(const char *path);
extern void	get_dir(struct conn *c);
extern void	get_file(struct conn *c, struct stat *stp);
extern void	ssl_handshake(struct stream *stream);
extern void	setup_embedded_stream(struct conn *, union variant, void *);
extern struct registered_uri *is_registered_uri(struct shttpd_ctx *,
		const char *uri);
extern void	do_ssi(struct conn *);
extern void	ssi_func_destructor(struct llhead *lp);

/*
 * auth.c
 */
extern int	check_authorization(struct conn *c, const char *path);
extern int	is_authorized_for_put(struct conn *c);
extern void	send_authorization_request(struct conn *c);
extern int	edit_passwords(const char *fname, const char *domain,
		const char *user, const char *pass);

/*
 * cgi.c
 */
extern int	run_cgi(struct conn *c, const char *prog);
extern void	do_cgi(struct conn *c);

#define CGI_REPLY	"HTTP/1.1     OK\r\n"
#define	CGI_REPLY_LEN	(sizeof(CGI_REPLY) - 1)

#endif /* DEFS_HEADER_DEFINED */


text:
package org.spatch2.ctl.operators;

import org.spatch2.ctl.Formula;
import org.spatch2.ctl.IFormula;

public class AllNextOperator extends Operator {

	public AllNextOperator(IFormula... formulas) {
		super(formulas);
		this.formulas.add(new Formula(new NegationOperator(new Formula(
				new ExistsNextOperator(new Formula(new NegationOperator(
						formulas[0])))))));
	}

	@Override
	public int getCardinality() {
		return 1;
	}

}


text:
class Event < ActiveRecord::Base
  belongs_to :user

  validates_presence_of :user_id, :item_urn

  def item
    origin_classname.camelize.constantize.find(origin_id)
  end

  def origin_classname
    item_urn.split(":")[0]
  end

  def origin_id
    item_urn.split(":")[1].to_i
  end
end


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <link rel="stylesheet" href="../css/ol.css" type="text/css">
    <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="../resources/layout.css" type="text/css">
    <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">

    <title>ol3 ZoomSlider demo</title>

           OpenLayers 3 Examples

Default style

Placed between zoom controls

Horizontal and completely re-styled

ZoomSlider control

Example of various ZoomSlider controls.

              See the zoomslider.js
              source to see how this is done.

            zoom, zoomslider, slider, style, styling, css, control


text:
html,
body,
div,
nav,
ul,
li,
a,
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  padding: 0;
  font-family: "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
}
html body div.wrapper nav {
  margin: 10px;
  position: relative;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  background: #383838;
  background: -moz-linear-gradient(top, #383838 25%, #373737 49%, #2d2d2d 50%, #2b2b2b 75%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(25%, #383838), color-stop(49%, #373737), color-stop(50%, #2d2d2d), color-stop(75%, #2b2b2b));
  background: -webkit-linear-gradient(top, #383838 25%, #373737 49%, #2d2d2d 50%, #2b2b2b 75%);
  background: -o-linear-gradient(top, #383838 25%, #373737 49%, #2d2d2d 50%, #2b2b2b 75%);
  background: -ms-linear-gradient(top, #383838 25%, #373737 49%, #2d2d2d 50%, #2b2b2b 75%);
  background: linear-gradient(to bottom, #383838 25%, #373737 49%, #2d2d2d 50%, #2b2b2b 75%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='@color1', endColorstr='@color4', GradientType=0);
}
html body div.wrapper nav > ul {
  position: relative;
  display: inline-block;
  list-style-type: none;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
}
html body div.wrapper nav > ul > li {
  border-top: 0 solid;
  border-right: 1px solid;
  border-bottom: 0 solid;
  border-left: 1px solid;
  border-top-color: 0;
  border-right-color: rgba(255, 255, 255, 0.05);
  border-bottom-color: 0;
  border-left-color: #191919;
  position: relative;
}
html body div.wrapper nav > ul > li:first-of-type {
  border-top: 0 solid;
  border-right: 0 solid;
  border-bottom: 0 solid;
  border-left: 0 solid;
  border-top-left-radius: 5px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 5px;
}
html body div.wrapper nav > ul > li:hover:first-of-type {
  border-top-left-radius: 5px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 5px;
}
html body div.wrapper nav > ul > li:hover > ul {
  position: absolute;
  display: block;
  background-color: #111111;
  border-top: 0 solid;
  border-right: 1px solid;
  border-bottom: 0 solid;
  border-left: 1px solid;
  border-top-color: 0;
  border-right-color: rgba(255, 255, 255, 0.05);
  border-bottom-color: 0;
  border-left-color: #191919;
}
html body div.wrapper nav > ul > li:hover > ul li {
  display: block;
  border-radius: 0;
}
html body div.wrapper nav > ul ul {
  display: none;
  min-width: 100%;
}
html body div.wrapper nav > ul ul li {
  white-space: nowrap;
}
html body div.wrapper li {
  display: inline-block;
}
html body div.wrapper li:hover {
  background: #525252;
  background: -moz-linear-gradient(top, #525252 25%, #505050 49%, #434343 50%, #414141 75%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(25%, #525252), color-stop(49%, #505050), color-stop(50%, #434343), color-stop(75%, #414141));
  background: -webkit-linear-gradient(top, #525252 25%, #505050 49%, #434343 50%, #414141 75%);
  background: -o-linear-gradient(top, #525252 25%, #505050 49%, #434343 50%, #414141 75%);
  background: -ms-linear-gradient(top, #525252 25%, #505050 49%, #434343 50%, #414141 75%);
  background: linear-gradient(to bottom, #525252 25%, #505050 49%, #434343 50%, #414141 75%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='@color1', endColorstr='@color4', GradientType=0);
}
html body div.wrapper li.selected {
  background-color: #eabc00;
}
html body div.wrapper li.selected:hover {
  background: #eabc00;
  background: -moz-linear-gradient(top, #eabc00 25%, #eabc00 49%, #eabc00 50%, #eabc00 75%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(25%, #eabc00), color-stop(49%, #eabc00), color-stop(50%, #eabc00), color-stop(75%, #eabc00));
  background: -webkit-linear-gradient(top, #eabc00 25%, #eabc00 49%, #eabc00 50%, #eabc00 75%);
  background: -o-linear-gradient(top, #eabc00 25%, #eabc00 49%, #eabc00 50%, #eabc00 75%);
  background: -ms-linear-gradient(top, #eabc00 25%, #eabc00 49%, #eabc00 50%, #eabc00 75%);
  background: linear-gradient(to bottom, #eabc00 25%, #eabc00 49%, #eabc00 50%, #eabc00 75%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='@color1', endColorstr='@color4', GradientType=0);
}
html body div.wrapper li.selected a {
  color: #222222;
}
html body div.wrapper a {
  padding: 10px;
  display: inline-block;
  text-decoration: none;
  color: #dddddd;
}
html body div.wrapper a a:active,
html body div.wrapper a a:focus {
  outline: none;
}
html body div.wrapper div.likes {
  position: absolute;
  display: inline-block;
  height: 100%;
  border-top: 0 solid;
  border-right: 0px solid;
  border-bottom: 0 solid;
  border-left: 1px solid;
  border-top-color: 0;
  border-right-color: rgba(255, 255, 255, 0.05);
  border-bottom-color: 0;
  border-left-color: #191919;
}
html body div.wrapper div.likes h5 {
  padding: 10px;
  color: #eabc00;
}