Creates a MediaWikiParser with the configurations which has been set.
491850
public MediaWikiParser createParser(){
		logger.debug( "Selected Parser: {}", parserClass );

		if( parserClass == ModularParser.class ){
			ModularParser mwgp = new ModularParser(
//					resolveLineSeparator(),
					"\n",
					languageIdentifers,
					categoryIdentifers,
					imageIdentifers,
					showImageText,
					deleteTags,
					showMathTagContent,
					calculateSrcSpans,
					null );

			StringBuilder sb = new StringBuilder();
			sb.append( lineSeparator + "languageIdentifers: ");
			for( String s: languageIdentifers ) {
				sb.append( s + " ");
			}
			sb.append( lineSeparator + "categoryIdentifers: ");
			for( String s: categoryIdentifers ) {
				sb.append( s + " ");
			}
			sb.append( lineSeparator + "imageIdentifers: ");
			for( String s: imageIdentifers ) {
				sb.append( s + " ");
			}
			logger.debug( sb.toString() );

			MediaWikiTemplateParser mwtp;

			logger.debug( "Selected TemplateParser: {}", templateParserClass);
			if( templateParserClass == GermanTemplateParser.class ){
				for( String s: deleteTemplates) {
					logger.debug( "DeleteTemplate: '{}'", s);
				}
				for( String s: parseTemplates) {
					logger.debug( "ParseTemplate: '{}'", s);
				}
				mwtp = new GermanTemplateParser( mwgp, deleteTemplates, parseTemplates );
			}
			else if( templateParserClass == FlushTemplates.class ) {
				mwtp = new FlushTemplates();
			} else if( templateParserClass == ShowTemplateNamesAndParameters.class ){
				mwtp = new ShowTemplateNamesAndParameters();
			}
			else{
				logger.error("TemplateParser Class Not Found!");
				return null;
			}

			mwgp.setTemplateParser( mwtp );

			return mwgp;
		}
		else{
			logger.error("Parser Class Not Found!");
			return null;
		}
	}
779567
public NonBlockingParser createNonBlockingParser(SurfingConfiguration configuration) {
        ensureSetting(configuration);
        return jsonParserAdapter.createNonBlockingParser(new SurfingContext(configuration));
    }
545371
public function buildParserConfiguration()
    {
        if ($this->parserConfiguration === null) {
            $this->parserConfiguration = parent::buildParserConfiguration();
            $this->parserConfiguration->addInterceptor(new ResourceInterceptor());
        }

        return $this->parserConfiguration;
    }
1066405
public static JedisPool create(final PippoSettings settings) {
        String host = settings.getString(HOST, Protocol.DEFAULT_HOST).trim();
        int minIdle = settings.getInteger(MIN_IDLE, GenericObjectPoolConfig.DEFAULT_MIN_IDLE);
        int maxIdle = settings.getInteger(MAX_IDLE, GenericObjectPoolConfig.DEFAULT_MAX_IDLE);
        int maxTotal = settings.getInteger(MAX_TOTAL, GenericObjectPoolConfig.DEFAULT_MAX_TOTAL);
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMinIdle(minIdle);
        config.setMaxIdle(maxIdle);
        config.setMaxTotal(maxTotal);

        try {
            return new JedisPool(config, new URI(host));
        } catch (URISyntaxException e) {
            throw new PippoRuntimeException("Malformed redis URI", e);
        }
    }
178141
def setup_parser():
    ''''''
    parser = argparse.ArgumentParser(description='Add random pages to existing site.')
    parser.add_argument('-d','--directory', action='store', default= os.getcwd(),
                                 help='Site directory (must be a valid s2 structure).')
    parser.add_argument('-n','--number', action='store', type=int, default = 20,
                                 help='Number of pages to generate.')

    return parser
297668
def load_config():
    
    configuration = MyParser()
    configuration.read(_config)

    d = configuration.as_dict()

    if 'jira' not in d:
        raise custom_exceptions.NotConfigured

    # Special handling of the boolean for error reporting
    d['jira']['error_reporting'] = configuration.getboolean('jira', 'error_reporting')

    return d
473038
def generate_results_subparser(subparsers):
    """"""
    parser = subparsers.add_parser(
        'results', description=constants.RESULTS_DESCRIPTION,
        epilog=constants.RESULTS_EPILOG, formatter_class=ParagraphFormatter,
        help=constants.RESULTS_HELP)
    utils.add_common_arguments(parser)
    parser.set_defaults(func=results)
    be_group = parser.add_argument_group('bifurcated extend')
    be_group.add_argument('-b', '--bifurcated-extend',
                          dest='bifurcated_extend', metavar='CORPUS',
                          help=constants.RESULTS_BIFURCATED_EXTEND_HELP)
    be_group.add_argument('--max-be-count', dest='bifurcated_extend_size',
                          help=constants.RESULTS_BIFURCATED_EXTEND_MAX_HELP,
                          metavar='COUNT', type=int)
    parser.add_argument('-e', '--extend', dest='extend',
                        help=constants.RESULTS_EXTEND_HELP, metavar='CORPUS')
    parser.add_argument('--excise', help=constants.RESULTS_EXCISE_HELP,
                        metavar='NGRAM', type=str)
    parser.add_argument('-l', '--label', dest='label',
                        help=constants.RESULTS_LABEL_HELP, metavar='LABEL')
    parser.add_argument('--min-count', dest='min_count',
                        help=constants.RESULTS_MINIMUM_COUNT_HELP,
                        metavar='COUNT', type=int)
    parser.add_argument('--max-count', dest='max_count',
                        help=constants.RESULTS_MAXIMUM_COUNT_HELP,
                        metavar='COUNT', type=int)
    parser.add_argument('--min-count-work', dest='min_count_work',
                        help=constants.RESULTS_MINIMUM_COUNT_WORK_HELP,
                        metavar='COUNT', type=int)
    parser.add_argument('--max-count-work', dest='max_count_work',
                        help=constants.RESULTS_MAXIMUM_COUNT_WORK_HELP,
                        metavar='COUNT', type=int)
    parser.add_argument('--min-size', dest='min_size',
                        help=constants.RESULTS_MINIMUM_SIZE_HELP,
                        metavar='SIZE', type=int)
    parser.add_argument('--max-size', dest='max_size',
                        help=constants.RESULTS_MAXIMUM_SIZE_HELP,
                        metavar='SIZE', type=int)
    parser.add_argument('--min-works', dest='min_works',
                        help=constants.RESULTS_MINIMUM_WORK_HELP,
                        metavar='COUNT', type=int)
    parser.add_argument('--max-works', dest='max_works',
                        help=constants.RESULTS_MAXIMUM_WORK_HELP,
                        metavar='COUNT', type=int)
    parser.add_argument('--ngrams', dest='ngrams',
                        help=constants.RESULTS_NGRAMS_HELP, metavar='NGRAMS')
    parser.add_argument('--reciprocal', action='store_true',
                        help=constants.RESULTS_RECIPROCAL_HELP)
    parser.add_argument('--reduce', action='store_true',
                        help=constants.RESULTS_REDUCE_HELP)
    parser.add_argument('--relabel', help=constants.RESULTS_RELABEL_HELP,
                        metavar='CATALOGUE')
    parser.add_argument('--remove', help=constants.RESULTS_REMOVE_HELP,
                        metavar='LABEL', type=str)
    parser.add_argument('--sort', action='store_true',
                        help=constants.RESULTS_SORT_HELP)
    utils.add_tokenizer_argument(parser)
    parser.add_argument('-z', '--zero-fill', dest='zero_fill',
                        help=constants.RESULTS_ZERO_FILL_HELP,
                        metavar='CORPUS')
    parser.add_argument('results', help=constants.RESULTS_RESULTS_HELP,
                        metavar='RESULTS')
    unsafe_group = parser.add_argument_group(
        constants.RESULTS_UNSAFE_GROUP_TITLE,
        constants.RESULTS_UNSAFE_GROUP_DESCRIPTION)
    unsafe_group.add_argument('--add-label-count', action='store_true',
                              help=constants.RESULTS_ADD_LABEL_COUNT_HELP)
    unsafe_group.add_argument('--add-label-work-count', action='store_true',
                              help=constants.RESULTS_ADD_LABEL_WORK_COUNT_HELP)
    unsafe_group.add_argument('--collapse-witnesses', action='store_true',
                              help=constants.RESULTS_COLLAPSE_WITNESSES_HELP)
    unsafe_group.add_argument('--group-by-ngram', dest='group_by_ngram',
                              help=constants.RESULTS_GROUP_BY_NGRAM_HELP,
                              metavar='CATALOGUE')
    unsafe_group.add_argument('--group-by-witness', action='store_true',
                              help=constants.RESULTS_GROUP_BY_WITNESS_HELP)
1107463
private function configureParser()
    {
        $renderer = $parser = null;
        $model = new \RunBB\Model\Admin\Parser();

        $configurator = new \s9e\TextFormatter\Configurator();
        $plugins = unserialize(User::get()->g_parser_plugins);

        $useSmilies = false;
        foreach ($plugins as $k => $plugin) {
            $configurator->plugins->load($plugin);
            if ($plugin === 'Emoticons') {
                $useSmilies = true;
            }
        }

        if ($useSmilies) {
            foreach ($model->getSmilies() as $k => $v) {
                $configurator->Emoticons->add($k, $v['html']);
            }
        }

        $configurator->registeredVars['cacheDir'] = ForumEnv::get('FORUM_CACHE_DIR');

        // Get an instance of the parser and the renderer
        extract($configurator->finalize());

        // We save the parser and the renderer to the disk for easy reuse
        Utils::checkDir($this->cacheDir);

        file_put_contents($this->cacheDir.'/'.User::get()->g_title.'Parser.php', serialize($parser));
        file_put_contents($this->cacheDir.'/'.User::get()->g_title.'Renderer.php', serialize($renderer));

        $this->parser = $parser;
        $this->renderer = $renderer;
    }
151156
private Map<String, String> generateCommonConfigPart() {

        Map<String, String> result = new HashMap<>();
        if (m_category != null) {
            result.put(CONFIGURATION_CATEGORY, m_category);
        }
        // append 'only leafs' to configuration
        if (m_onlyLeafs) {
            result.put(CONFIGURATION_ONLYLEAFS, null);
        }
        // append 'property' to configuration
        if (m_property != null) {
            result.put(CONFIGURATION_PROPERTY, m_property);
        }
        // append 'selectionType' to configuration
        if (m_selectiontype != null) {
            result.put(CONFIGURATION_SELECTIONTYPE, m_selectiontype);
        }
        return result;
    }
1354436
def create_config(cls, params, prefix=None, name=None):
        
        if isinstance(cls.cfg, Config):
            cfg = cls.cfg.copy(name=name, prefix=prefix)
        else:
            cfg = cls.cfg.copy()
            if name:
                cfg[name] = name
            if prefix:
                cfg[prefix] = prefix
            cfg = Config(**cfg)
        cfg.update_settings()
        cfg.update(params, True)
        return cfg
967745
private void parseConfiguration(String configuration) {

        Map<String, String> configOptions = CmsWidgetUtil.parsePipeSeparatedConfigString(configuration);
        if (!configOptions.isEmpty()) {
            m_category = CmsWidgetUtil.getStringOption(configOptions, CONFIGURATION_CATEGORY, m_category);
            m_isSingleValue = !("multi".equals(
                CmsWidgetUtil.getStringOption(configOptions, CONFIGURATION_SELECTIONTYPE, "single")));
            m_children = CmsWidgetUtil.getBooleanOption(configOptions, CONFIGURATION_PARENTSELECTION);
            m_collapsed = CmsWidgetUtil.getBooleanOption(configOptions, CONFIGURATION_COLLAPSED);
            m_showWithRepository = CmsWidgetUtil.getBooleanOption(configOptions, CONFIGURATION_SHOW_WITH_REPOSITORY);
            m_refPath = CmsWidgetUtil.getStringOption(configOptions, CONFIGURATION_REFPATH, m_refPath);
        }
    }
1281304
private static SAXParser makeSAXParser() throws ParserConfigurationException, SAXException {
    SAXParser parser = _saxParser.get();
    if (parser != null) {
      try {
        parser.reset();
      } catch (UnsupportedOperationException uoe) {
        parser = null;
      }
    }
    if (parser == null) {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      parser = factory.newSAXParser();
      _saxParser.set( parser );
    }
    return parser;
  }
166410
static Settings create(final ConfigItemSet viewSettings, final ConfigItemMapEntrySet firstView,
                                 final ConfigItemSet configurationSettings) {
        final List<ConfigBlock> rootBlocks = new ArrayList<ConfigBlock>();
        final ConfigItemMapIndexed views = new ConfigItemMapIndexed("Views");
        final Map<String, ConfigItemMapEntrySet> viewById = new HashMap<String, ConfigItemMapEntrySet>();
        final ConfigItemMapNamed tablesMap = new ConfigItemMapNamed("Tables");

        return new Settings(rootBlocks, viewSettings, views, viewById, firstView, tablesMap, configurationSettings);
    }
659368
def init_dataset_prepare_args(self, parser):
        ''' '''
        parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH,
                            help='the path to the configuration file to use -- ./config.yaml by default')
        parser.add_argument('-c', '--corpus-name', help='the name of the corpus to process')
        parser.add_argument('-n', '--dataset-name', help='the name to assign the newly processed dataset')
853170
public MediaType withParameters(Map<String, ? extends Iterable<String>> parameters) {
        final ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
        for (Map.Entry<String, ? extends Iterable<String>> e : parameters.entrySet()) {
            final String k = e.getKey();
            for (String v : e.getValue()) {
                builder.put(k, v);
            }
        }
        return create(type, subtype, builder.build());
    }
473946
public static void createIniFile(String... args) {
    try {
      // open up standard input
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String wikiid = null;
      if (args.length > 0)
        wikiid = args[0];
      else
        wikiid = getInput("wiki id", br);
      String username = null;
      if (args.length > 1)
        username = args[1];
      else
        username = getInput("username", br);
      String password = null;
      if (args.length > 2)
        password = args[2];
      else
        password = getInput("password", br);
      String email = null;
      if (args.length > 3)
        email = args[3];
      else
        email = getInput("email", br);
      File propFile = getPropertyFile(wikiid, username);
      String remember = null;
      if (args.length > 4)
        remember = args[4];
      else
        remember = getInput("shall i store " + username
            + "'s credentials encrypted in " + propFile.getName() + " y/n?",
            br);
      if (remember.trim().toLowerCase().startsWith("y")) {
        Crypt lCrypt = Crypt.getRandomCrypt();
        Properties props = new Properties();
        props.setProperty("cypher", lCrypt.getCypher());
        props.setProperty("salt", lCrypt.getSalt());
        props.setProperty("user", username);
        props.setProperty("email", email);
        props.setProperty("secret", lCrypt.encrypt(password));
        if (!propFile.getParentFile().exists()) {
          propFile.getParentFile().mkdirs();
        }
        FileOutputStream propsStream = new FileOutputStream(propFile);
        props.store(propsStream, "Mediawiki JAPI credentials for " + wikiid);
        propsStream.close();
      }
    } catch (IOException e1) {
      LOGGER.log(Level.SEVERE, e1.getMessage());
    } catch (GeneralSecurityException e1) {
      LOGGER.log(Level.SEVERE, e1.getMessage());
    }
  }
696504
def generate_parser():
    """"""
    parser = argparse.ArgumentParser(
        description=constants.TACL_DESCRIPTION,
        formatter_class=ParagraphFormatter)
    subparsers = parser.add_subparsers(title='subcommands')
    generate_align_subparser(subparsers)
    generate_catalogue_subparser(subparsers)
    generate_counts_subparser(subparsers)
    generate_diff_subparser(subparsers)
    generate_excise_subparser(subparsers)
    generate_highlight_subparser(subparsers)
    generate_intersect_subparser(subparsers)
    generate_lifetime_subparser(subparsers)
    generate_ngrams_subparser(subparsers)
    generate_prepare_subparser(subparsers)
    generate_results_subparser(subparsers)
    generate_supplied_diff_subparser(subparsers)
    generate_search_subparser(subparsers)
    generate_supplied_intersect_subparser(subparsers)
    generate_statistics_subparser(subparsers)
    generate_strip_subparser(subparsers)
    return parser