Returns a string version of these replication options which are
        suitable for use in a CREATE KEYSPACE statement.
9930
def export_for_schema(self):
        
        if self.options_map:
            return dict((str(key), str(value)) for key, value in self.options_map.items())
        return "{'class': '%s'}" % (self.name, )
841609
def options_string_builder(option_mapping, args):
    """"""
    options_string = ""
    for option, flag in option_mapping.items():
        if option in args:
            options_string += str(" %s %s" % (flag, str(args[option])))
    return options_string
352023
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	sb.append(host);
	sb.append(" ");
	sb.append(admin);
	if (Options.check("multiline")) {
		sb.append(" (\n\t\t\t\t\t");
		sb.append(serial);
		sb.append("\t; serial\n\t\t\t\t\t");
		sb.append(refresh);
		sb.append("\t; refresh\n\t\t\t\t\t");
		sb.append(retry);
		sb.append("\t; retry\n\t\t\t\t\t");
		sb.append(expire);
		sb.append("\t; expire\n\t\t\t\t\t");
		sb.append(minimum);
		sb.append(" )\t; minimum");
	} else {
		sb.append(" ");
		sb.append(serial);
		sb.append(" ");
		sb.append(refresh);
		sb.append(" ");
		sb.append(retry);
		sb.append(" ");
		sb.append(expire);
		sb.append(" ");
		sb.append(minimum);
	}
	return sb.toString();
}
20547
function getOptions(merge) {
	var options = {
		root: null,
		schemas: {},
		add: [],
		formats: {},
		fresh: false,
		multi: false,
		timeout: 5000,
		checkRecursive: false,
		banUnknownProperties: false,
		languages: {},
		language: null
	};
	return copyProps(options, merge);
}
596932
private String description() {
        return String.format(Locale.ENGLISH, "%s[%s%s%s %s %s]",
            Replicator.class.getSimpleName(),
            isPull(config.getReplicatorType()) ? "<" : "",
            config.isContinuous() ? "*" : "-",
            isPush(config.getReplicatorType()) ? ">" : "",
            config.getDatabase(),
            config.getTarget());
    }
682591
def get_replicas(self, keyspace, token):
        
        tokens_to_hosts = self.tokens_to_hosts_by_ks.get(keyspace, None)
        if tokens_to_hosts is None:
            self.rebuild_keyspace(keyspace, build_if_absent=True)
            tokens_to_hosts = self.tokens_to_hosts_by_ks.get(keyspace, None)

        if tokens_to_hosts:
            # The values in self.ring correspond to the end of the
            # token range up to and including the value listed.
            point = bisect_left(self.ring, token)
            if point == len(self.ring):
                return tokens_to_hosts[self.ring[0]]
            else:
                return tokens_to_hosts[self.ring[point]]
        return []
805558
def replication_connection_string_and_slot_using_pgpass(target_node_info):
    """"""
    connection_info, slot = connection_info_and_slot(target_node_info)
    connection_info["dbname"] = "replication"
    connection_info["replication"] = "true"
    connection_string = create_pgpass_file(connection_info)
    return connection_string, slot
1042266
def from_string(vc):
        """"""
        try:
            # Note: this means all version controls must have
            # a title naming convention (!)
            vc = globals()[vc.title()]
            assert(issubclass(vc, VersionControl))
            return vc
        except (KeyError, AssertionError):
            raise NotImplementedError("Unknown version control system.")
491834
private Map<String, String> createScriptEnvironment() {
        Map<String, String> env = new HashMap<>();
        env.putAll(System.getenv());
        env.putAll(configuration.getScriptEnvironmentVariables());
        env.put(propertyToEnvironmentVariableName(Configuration.KUBERNETES_NAMESPACE), configuration.getNamespace());
        env.put(propertyToEnvironmentVariableName(Configuration.KUBERNETES_DOMAIN), configuration.getKubernetesDomain());
        env.put(propertyToEnvironmentVariableName(Configuration.KUBERNETES_MASTER),
            configuration.getMasterUrl().toString());
        env.put(propertyToEnvironmentVariableName(Configuration.DOCKER_REGISTY), configuration.getDockerRegistry());
        return env;
    }
289118
public List<String> getKeyspaces() {
        ArrayList<String> result = new ArrayList<String>();
        this.metadata = this.cluster.getMetadata();
        if (!(metadata.getKeyspaces().isEmpty())) {
            for (KeyspaceMetadata k : this.metadata.getKeyspaces()) {
                result.add(k.getName());
            }
        }
        return result;
    }
533237
def get_create_options(self):
        """"""
        package = self._get_package()
        # Locations
        locations = []
        for region in package['regions']:
            locations.append({
                'name': region['location']['location']['longName'],
                'key': region['location']['location']['name'],
            })
        # flavors
        dedicated_host = []
        for item in package['items']:
            if item['itemCategory']['categoryCode'] == \
                    'dedicated_virtual_hosts':
                dedicated_host.append({
                    'name': item['description'],
                    'key': item['keyName'],
                })

        return {'locations': locations, 'dedicated_host': dedicated_host}
1201028
def _options_string(self):
        
        if len(self.options) > 0:
            s = ""
            for op in self.options:
                if self._sized_op:
                    s += "{:s}={:s} ".format(*map(str, op))
                else:
                    s += "{:s} ".format(str(op))
            return s.strip()
        else:
            return ""
825866
def to_xml_string(str = '')
      str << '<?xml version="1.0" encoding="UTF-8"?>'
      str << ('<cp:coreProperties xmlns:cp="' << CORE_NS << '" xmlns:dc="' << CORE_NS_DC << '" ')
      str << ('xmlns:dcmitype="' << CORE_NS_DCMIT << '" xmlns:dcterms="' << CORE_NS_DCT << '" ')
      str << ('xmlns:xsi="' << CORE_NS_XSI << '">')
      str << ('<dc:creator>' << self.creator << '</dc:creator>')
      str << ('<dcterms:created xsi:type="dcterms:W3CDTF">' << (created || Time.now).strftime('%Y-%m-%dT%H:%M:%S') << 'Z</dcterms:created>')
      str << '<cp:revision>0</cp:revision>'
      str << '</cp:coreProperties>'
    end
253083
public void createKeySpacesThrift(StressSettings settings)
    {
        KsDef ksdef = new KsDef();

        // column family for standard columns
        CfDef standardCfDef = new CfDef(keyspace, "standard1");
        Map<String, String> compressionOptions = new HashMap<>();
        if (compression != null)
            compressionOptions.put("sstable_compression", compression);

        String comparator = settings.columns.comparator;
        standardCfDef.setComparator_type(comparator)
                .setDefault_validation_class(DEFAULT_VALIDATOR)
                .setCompression_options(compressionOptions);

        for (int i = 0; i < settings.columns.names.size(); i++)
            standardCfDef.addToColumn_metadata(new ColumnDef(settings.columns.names.get(i), "BytesType"));

        // column family for standard counters
        CfDef counterCfDef = new CfDef(keyspace, "counter1")
                .setComparator_type(comparator)
                .setDefault_validation_class("CounterColumnType")
                .setCompression_options(compressionOptions);

        ksdef.setName(keyspace);
        ksdef.setStrategy_class(replicationStrategy);

        if (!replicationStrategyOptions.isEmpty())
        {
            ksdef.setStrategy_options(replicationStrategyOptions);
        }

        if (compactionStrategy != null)
        {
            standardCfDef.setCompaction_strategy(compactionStrategy);
            counterCfDef.setCompaction_strategy(compactionStrategy);
            if (!compactionStrategyOptions.isEmpty())
            {
                standardCfDef.setCompaction_strategy_options(compactionStrategyOptions);
                counterCfDef.setCompaction_strategy_options(compactionStrategyOptions);
            }
        }

        ksdef.setCf_defs(new ArrayList<>(Arrays.asList(standardCfDef, counterCfDef)));

        Cassandra.Client client = settings.getRawThriftClient(false);

        try
        {
            client.system_add_keyspace(ksdef);

            /* CQL3 counter cf */
            client.set_cql_version("3.0.0"); // just to create counter cf for cql3

            client.set_keyspace(keyspace);
            client.execute_cql3_query(createCounterCFStatementForCQL3(settings), Compression.NONE, ConsistencyLevel.ONE);

            if (settings.mode.cqlVersion.isCql())
                client.set_cql_version(settings.mode.cqlVersion.connectVersion);
            /* end */

            System.out.println(String.format("Created keyspaces. Sleeping %ss for propagation.", settings.node.nodes.size()));
            Thread.sleep(settings.node.nodes.size() * 1000L); // seconds
        }
        catch (InvalidRequestException e)
        {
            System.err.println("Unable to create stress keyspace: " + e.getWhy());
        }
        catch (Exception e)
        {
            System.err.println("!!!! " + e.getMessage());
        }
    }
603800
def get_string(self, key):
        """"""

        # Massive hack, lol
        if key.startswith("lambda."):
            key = "lambda.items.{0}".format(key[7:])
        if key.startswith("apigateway."):
            key = "apigateway.items.{0}".format(key[11:])

        # Make sure key is in all_options
        if key not in self.all_options:
            kwargs = {}
            if len(self.chain) > 1:
                kwargs['source'] = Meta(self.all_options, self.chain[-2]).source
            raise BadOptionFormat("Can't find key in options", key=key, chain=self.chain, **kwargs)

        return super(MergedOptionStringFormatter, self).get_string(key)
233104
private String createString(String f)
    {
        StringBuilder sb = new StringBuilder();
        sb.append("p2pToken="+p2pToken+f);
        sb.append("vaSpaceToken="+vaSpaceToken+f);
        return sb.toString();
    }
332978
function(callback){

        var client = this._get_system_client();
        var keyspace_name = this._connection.keyspace,
            replication_text = '',
            options = this._options;

        replication_text = this._generate_replication_text(options.replication_strategy);

        var query = util.format(
            "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = %s;",
            keyspace_name,
            replication_text
        );
        client.execute(query, function(err,result){
            client.shutdown(function(){
                callback(err,result);
            });
        });
    }