Genereate DDL from data sources named.

    :args:      String or list of strings to be parsed for arguments
    :namespace: Namespace to extract arguments from
    :file:      Write to this open file object (default stdout)
501355
def generate(args=None, namespace=None, file=None):
    
    if hasattr(args, 'split'):
        args = args.split()
    args = parser.parse_args(args, namespace)
    set_logging(args)
    logging.info(str(args))
    if args.dialect in ('pg', 'pgsql', 'postgres'):
        args.dialect = 'postgresql'
    if args.dialect.startswith('dj'):
        args.dialect = 'django'
    elif args.dialect.startswith('sqla'):
        args.dialect = 'sqlalchemy'

    if args.dialect not in dialect_names:
        raise NotImplementedError('First arg must be one of: %s' % ", ".join(dialect_names))
    if args.dialect == 'sqlalchemy':
        print(sqla_head, file=file)
    for datafile in args.datafile:
        if is_sqlalchemy_url.search(datafile):
            table_names_for_insert = []
            for tbl in sqlalchemy_table_sources(datafile):
                t = generate_one(tbl, args, table_name=tbl.generator.name, file=file)
                if t.data:
                    table_names_for_insert.append(tbl.generator.name)
            if args.inserts and args.dialect == 'sqlalchemy':
                print(sqla_inserter_call(table_names_for_insert), file=file)
            if t and args.inserts:
                for seq_update in emit_db_sequence_updates(t.source.db_engine):
                    if args.dialect == 'sqlalchemy':
                        print('    conn.execute("%s")' % seq_update, file=file)
                    elif args.dialect == 'postgresql':
                        print(seq_update, file=file)
        else:
            generate_one(datafile, args, file=file)
298129
def genargs() -> ArgumentParser:
    
    parser = ArgumentParser()
    parser.add_argument("spec", help="JSG specification - can be file name, URI or string")
    parser.add_argument("-o", "--outfile", help="Output python file - if omitted, python is not saved")
    parser.add_argument("-p", "--print", help="Print python file to stdout")
    parser.add_argument("-id", "--inputdir", help="Input directory with JSON files")
    parser.add_argument("-i", "--json", help="URL, file name or json text", nargs='*')
    return parser
1240575
def from_string(cls, string):
        
        items = shlex.split(string, **cls.split_args)
        return cls(items)
1364265
public InProcessVoltDBServer runDDLFromString(String ddl) {
        try {
            File tempDDLFile = File.createTempFile("volt_ddl_", ".sql");
            BufferedWriter writer = new BufferedWriter(new FileWriter(tempDDLFile));
            writer.write(ddl + "\n");
            writer.close();
            runDDLFromPath(tempDDLFile.getAbsolutePath());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
        return this;
    }
1107476
def create(cls, train_ds, valid_ds, test_ds=None, path:PathOrStr='.', no_check:bool=False, bs=64, val_bs:int=None,
               num_workers:int=0, device:torch.device=None, collate_fn:Callable=data_collate,
               dl_tfms:Optional[Collection[Callable]]=None, bptt:int=70, backwards:bool=False, **dl_kwargs) -> DataBunch:
        ""
        datasets = cls._init_ds(train_ds, valid_ds, test_ds)
        val_bs = ifnone(val_bs, bs)
        datasets = [LanguageModelPreLoader(ds, shuffle=(i==0), bs=(bs if i==0 else val_bs), bptt=bptt, backwards=backwards)
                    for i,ds in enumerate(datasets)]
        val_bs = bs
        dls = [DataLoader(d, b, shuffle=False, **dl_kwargs) for d,b in zip(datasets, (bs,val_bs,val_bs,val_bs)) if d is not None]
        return cls(*dls, path=path, device=device, dl_tfms=dl_tfms, collate_fn=collate_fn, no_check=no_check)
970710
def create_namespace(self):
        
        name = 'namespace-{random_string}'.format(random_string=random_str(5))

        namespace = client.V1Namespace(metadata=client.V1ObjectMeta(name=name))

        self.core_api.create_namespace(namespace)

        logger.info("Creating namespace: %s", name)

        # save all namespaces created with this backend
        self.managed_namespaces.append(name)

        # wait for namespace to be ready
        Probe(timeout=30, pause=5, expected_retval=True,
              fnc=self._namespace_ready, namespace=name).run()

        return name
362459
@Override
  public void duplicate(String fromNamespace, String fromName, String toNamespace, String toName, boolean doOverwrite)
      throws DDFException {

    IPersistible from = this.load(fromNamespace, fromName);
    if (from instanceof DDF) {
      DDF to = (DDF) from;
      // to.setNamespace(toNamespace);
      to.getManager().setDDFName(to, toName);
      to.persist();

    } else {
      throw new DDFException("Can only duplicate DDFs");
    }
  }
726570
def generate_strings(project_base_dir, localization_bundle_path, tmp_directory, exclude_dirs, include_strings_file,
                     special_ui_components_prefix):
    

    localization_directory = os.path.join(localization_bundle_path, DEFAULT_LANGUAGE_DIRECTORY_NAME)
    if not os.path.exists(localization_directory):
        os.makedirs(localization_directory)

    localization_file = os.path.join(localization_directory, LOCALIZATION_FILENAME)

    # Creating the same directory tree structure in the tmp directory
    tmp_localization_directory = os.path.join(tmp_directory, DEFAULT_LANGUAGE_DIRECTORY_NAME)
    tmp_localization_file = os.path.join(tmp_localization_directory, LOCALIZATION_FILENAME)

    if os.path.isdir(tmp_localization_directory):
        shutil.rmtree(tmp_localization_directory)
    os.mkdir(tmp_localization_directory)

    logging.info("Running genstrings")

    source_files = extract_source_files(project_base_dir, exclude_dirs)

    genstrings_cmd = 'genstrings -s JTLocalizedString -o %s %s' % (tmp_localization_directory, " ".join(
            ['"%s"' % (source_file,) for source_file in source_files]))

    genstrings_process = subprocess.Popen(genstrings_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                          stdin=subprocess.PIPE, shell=True)

    genstrings_out, genstrings_err = genstrings_process.communicate()

    remove_empty_comments_from_file(tmp_localization_file)
    add_genstrings_comments_to_file(tmp_localization_file, genstrings_err)

    genstrings_rc = genstrings_process.returncode
    if genstrings_rc != 0:
        logging.fatal("genstrings returned %d, aborting run!", genstrings_rc)
        sys.exit(genstrings_rc)

    create_localized_strings_from_ib_files(project_base_dir, exclude_dirs, tmp_localization_file,
                                           special_ui_components_prefix)

    if include_strings_file:
        target = open_strings_file(tmp_localization_file, "a")
        source = open_strings_file(include_strings_file, "r")
        target.write(source.read())
        source.close()
        target.close()

    handle_duplications(tmp_localization_file)

    if os.path.isfile(localization_file):
        logging.info("Merging old localizable with new one...")
        merge_strings_files(localization_file, tmp_localization_file)
    else:
        logging.info("No Localizable yet, moving the created file...")
        shutil.move(tmp_localization_file, localization_file)
1337640
def DEFINE_string(  # pylint: disable=invalid-name,redefined-builtin
    name, default, help, flag_values=_flagvalues.FLAGS, **args):
  """"""
  parser = _argument_parser.ArgumentParser()
  serializer = _argument_parser.ArgumentSerializer()
  DEFINE(parser, name, default, help, flag_values, serializer, **args)
870295
def CopyToString(self):
    
    if self.name is not None and self.row_identifier is not None:
      return '{0:s}.{1:d}'.format(self.name, self.row_identifier)

    return None
281626
def _to_xml_string(line_prefix, options)
      eol = options[:eol]

      s = ""
      s << line_prefix << ?<
      s << "#{namespace}:" unless namespace.empty?
      s << name

      # output namespace declarations
      uri_by_namespace = options[:uri_by_namespace]
      if uri_by_namespace
        uri_by_namespace.each_pair do |namespace, uri|
          if namespace
            s << " xmlns:#{namespace}=\"#{uri}\""
          else
            s << " xmlns=\"#{uri}\""
          end
        end
      end
      
      # output values
      unless @values.empty?
        i = 0
        @values.each do |value|
          s << " _val" << i.to_s << "=\"" << SDL4R.format(value, false) << "\""
          i += 1
        end
      end
      
      # output attributes
      if has_attribute?
        omit_null_attributes = options[:omit_null_attributes]
        attributes do |attribute_namespace, attribute_name, attribute_value|
          unless omit_null_attributes and attribute_value.nil?
            s << " "
            s << "#{attribute_namespace}:" unless attribute_namespace.empty?
            s << attribute_name << "=\"" << SDL4R.format(attribute_value, false) << ?"
          end
        end
      end
  
      if @children.empty?
        s << "/>"
      else
        s << ">" << eol
        @children.each do |child|
          s << child._to_xml_string(line_prefix + options[:indent], options) << eol
        end
        
        s << line_prefix << "</"
        s << "#{namespace}:" unless namespace.empty?
        s << name << ?>
      end
  
      return s
    end
1247293
def build_string(self, *pattern, **kwargs):
        
        set_defaults(self._string_defaults, kwargs)
        set_defaults(self._defaults, kwargs)
        return StringPattern(*pattern, **kwargs)
859361
def generate_cli_main_parser():
    """"""
    parser = argparse.ArgumentParser(
        description='Create, Update, Delete, List DNS entries')

    parser.add_argument('--version', help='show the current version of lexicon',
                        action='version', version='%(prog)s {0}'
                        .format(discovery.lexicon_version()))
    parser.add_argument('--delegated', help='specify the delegated domain')
    parser.add_argument('--config-dir', default=os.getcwd(),
                        help='specify the directory where to search lexicon.yml and '
                             'lexicon_[provider].yml configuration files '
                             '(default: current directory).')
    subparsers = parser.add_subparsers(
        dest='provider_name', help='specify the DNS provider to use')
    subparsers.required = True

    for provider, available in discovery.find_providers().items():
        provider_module = importlib.import_module(
            'lexicon.providers.' + provider)
        provider_parser = getattr(provider_module, 'provider_parser')

        subparser = subparsers.add_parser(provider, help='{0} provider'.format(provider),
                                          parents=[generate_base_provider_parser()])
        provider_parser(subparser)

        if not available:
            subparser.epilog = ('WARNING: some required dependencies for this provider are not '
                                'installed. Please install lexicon[{0}] first before using it.'
                                .format(provider))

    return parser
1335146
def _fix_example_namespace(self):
        
        example_prefix = 'example'  # Example ns prefix
        idgen_prefix = idgen.get_id_namespace_prefix()

        # If the ID namespace alias doesn't match the example alias, return.
        if idgen_prefix != example_prefix:
            return

        # If the example namespace prefix isn't in the parsed namespace
        # prefixes, return.
        if example_prefix not in self._input_namespaces:
            return

        self._input_namespaces[example_prefix] = idgen.EXAMPLE_NAMESPACE.name
510217
def write(self, string, *args, **kwargs):
        
        if self.on_new_line:
            self.on_new_line = False  # We're not on a new line anymore
            # If the string was not empty, indent; Else probably a new line
            if string.strip():
                self.indent()

        if args or kwargs:
            self.out_stream.write(string.format(*args, **kwargs))
        else:
            self.out_stream.write(string)
463189
def discover_datasources(datastore_str):
    
    
    datastore = DataStore(datastore_str)
    datasources=[]
    for ds in datastore.get_datasources():
        datasources.append({'text':ds.name, 'type':ds.type, 'id':ds.getHash(), 'leaf': True})
    return datasources
180598
def main (args):
  
  if (len(args) != 2):
    print(main.__doc__)
    sys.exit(1);

  # create the document
  doc = libsedml.SedDocument();
  doc.setLevel(1);
  doc.setVersion(3);

  # create a data description
  
  ddesc = doc.createDataDescription()
  ddesc.setId('data1')
  ddesc.setName('Oscli Timecourse data')
  ddesc.setSource('foo.numl')
  
  # create data source 
  dsource = ddesc.createDataSource()
  dsource.setId('dataS1')
  
  # create slice 
  slice = dsource.createSlice()
  slice.setReference('SpeciesIds')
  slice.setValue('S1')
  
  # specify mapping
  timeDesc = libsedml.CompositeDescription()
  timeDesc.setIndexType('double')
  timeDesc.setId('time')
  timeDesc.setName('time')
  
  speciesDesc = timeDesc.createCompositeDescription()
  speciesDesc.setIndexType('string')
  speciesDesc.setId('SpeciesIds')
  speciesDesc.setName('SpeciesIds')
  
  concentrationDesc = speciesDesc.createAtomicDescription()
  concentrationDesc.setValueType("double")
  concentrationDesc.setName("Concentrations")
  
  dimDesc = ddesc.createDimensionDescription()
  dimDesc.append(timeDesc)
  
  # write the document
  libsedml.writeSedML(doc, args[1]);