Do basic parsing of the source parameter.  If the source is hosted on
 GitHub, we can predict sensible defaults for both project_page and
 issues_url.
426082
def process_source(data)
      if data['source'] =~ %r[://]
        source_uri = URI.parse(data['source'])
      else
        source_uri = URI.parse("http://#{data['source']}")
      end

      if source_uri.host =~ /^(www\.)?github\.com$/
        source_uri.scheme = 'https'
        source_uri.path.sub!(/\.git$/, '')
        data['project_page'] ||= @data['project_page'] || source_uri.to_s
        data['issues_url'] ||= @data['issues_url'] || source_uri.to_s.sub(/\/*$/, '') + '/issues'
      end

    rescue URI::Error
      return
    end
464811
def extract_source_params(src):
    
    tags = get_taglist(src)
    data = []
    for key, param, vtype in BASE_PARAMS:
        if key in src.attrib:
            if vtype == "c":
                data.append((param, src.attrib[key]))
            elif vtype == "f":
                data.append((param, float(src.attrib[key])))
            else:
                data.append((param, None))
        elif key in tags:
            if vtype == "c":
                data.append((param, src.nodes[tags.index(key)].text))
            elif vtype == "f":
                data.append((param, float(src.nodes[tags.index(key)].text)))
            else:
                data.append((param, None))
        else:
            data.append((param, None))
    return dict(data)
1213285
def compile(source, options = {})
      source  = prepare_source(source)
      options = prepare_options(options)
      command = ["node", "--eval"]
      command.push compilation_snippet \
        method:    "compile#{ "Client" if options[:client] }",
        arguments: [source, options],
        locals:    options.fetch(:locals, {}),
        options:   options
      stdout, stderr, exit_status = Open3.capture3(*command)
      raise engine::CompilationError, stderr unless exit_status.success?
      process_result(source, stdout, options)
    end
74122
def get_perceval_params_from_url(cls, url):
        
        params = []

        tokens = url.split(' ')
        repo = tokens[0]

        owner = repo.split('/')[-2]
        repository = repo.split('/')[-1]

        params.append(owner)
        params.append(repository)

        if len(tokens) > 1:
            params.extend(tokens[1:])

        return params
446662
def _parse_params(self, params=None):
        
        prm = self.default_params.copy()
        if params is not None: 
            prm.update(params)
 
        if prm["background"]:
            # Absolute path, just to be sure
            prm["background"] =  os.path.abspath(prm["background"])
            prm["background"] = " --negSet {0} ".format(
                    prm["background"])
        
        prm["strand"] = ""
        if not prm["single"]:
            prm["strand"] = " --revcomp "

        return prm
1239136
def build_from_issues(gh_token, body):
    
    if body["action"] in ["opened", "edited"]:
        github_con = Github(gh_token)
        repo = github_con.get_repo(body['repository']['full_name'])
        issue = repo.get_issue(body['issue']['number'])
        text = body['issue']['body']
        comment = issue  # It's where we update the comment: in the issue itself
        return WebhookMetadata(repo, issue, text, comment)
    return None
1158995
def _parse_args(args: List[str]) -> ProjectRunConfig:
    
    parser = argparse.ArgumentParser(prog="gitlab-get-variables", description="Tool for getting a GitLab project's "
                                                                              "build variables")
    add_common_arguments(parser, project=True)
    arguments = parser.parse_args(args)
    return ProjectRunConfig(project=arguments.project, url=arguments.url, token=arguments.token, debug=arguments.debug)
641460
def get_arthur_params_from_url(cls, url):
        # In the url the org and the repository are included

        params = url.split()
        
        params = {"owner": params[0], "repository": params[1]}

        return params
1251461
private void loadServerParameters() {
    serverParser.addArgument("-p", "--port").required(true)
        .help("Port to be assigned to the server.\n");
    serverParser.addArgument("-m", "--model").required(true)
        .help("It is required to provide a model to perform POS tagging.");
    this.serverParser.addArgument("-lm", "--lemmatizerModel")
        .required(true)
        .help("It is required to provide a lemmatizer model.");
    serverParser.addArgument("-l", "--language")
        .choices("de", "en", "es", "eu", "fr", "gl", "it", "nl")
        .required(true)
        .help("Choose a language to perform annotation with ixa-pipe-pos.");

    serverParser.addArgument("--beamSize").required(false)
        .setDefault(DEFAULT_BEAM_SIZE)
        .help("Choose beam size for decoding, it defaults to 3.");
    serverParser.addArgument("-o", "--outputFormat").required(false)
        .choices("naf", "conll")
        .setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
        .help("Choose output format; it defaults to NAF.\n");
    serverParser.addArgument("-mw", "--multiwords")
        .action(Arguments.storeTrue())
        .help("Use to detect and process multiwords.\n");
    serverParser.addArgument("-d", "--dictag")
        .action(Arguments.storeTrue())
        .help("Post process POS tagger output with a monosemic dictionary.\n");
    serverParser.addArgument("-a","--allMorphology")
        .action(Arguments.storeTrue())
        .help("Print all the POS tags and lemmas before disambiguation.\n");
  }
452309
def __main(draft, directory, project_name, project_version, project_date, answer_yes):
    
    directory = os.path.abspath(directory)
    config = load_config(directory)
    to_err = draft

    click.echo("Loading template...", err=to_err)
    if config["template"] is None:
        template = pkg_resources.resource_string(
            __name__, "templates/template.rst"
        ).decode("utf8")
    else:
        with open(config["template"], "rb") as tmpl:
            template = tmpl.read().decode("utf8")

    click.echo("Finding news fragments...", err=to_err)

    definitions = config["types"]

    if config.get("directory"):
        base_directory = os.path.abspath(config["directory"])
        fragment_directory = None
    else:
        base_directory = os.path.abspath(
            os.path.join(directory, config["package_dir"], config["package"])
        )
        fragment_directory = "newsfragments"

    fragments, fragment_filenames = find_fragments(
        base_directory, config["sections"], fragment_directory, definitions
    )

    click.echo("Rendering news fragments...", err=to_err)
    fragments = split_fragments(fragments, definitions)
    rendered = render_fragments(
        # The 0th underline is used for the top line
        template,
        config["issue_format"],
        fragments,
        definitions,
        config["underlines"][1:],
        config["wrap"],
    )

    if project_version is None:
        project_version = get_version(
            os.path.join(directory, config["package_dir"]), config["package"]
        )

    if project_name is None:
        package = config.get("package")
        if package:
            project_name = get_project_name(
                os.path.abspath(os.path.join(directory, config["package_dir"])), package
            )
        else:
            # Can't determine a project_name, but maybe it is not needed.
            project_name = ""

    if project_date is None:
        project_date = _get_date()

    top_line = config["title_format"].format(
        name=project_name, version=project_version, project_date=project_date
    )
    top_line += u"\n" + (config["underlines"][0] * len(top_line)) + u"\n"

    if draft:
        click.echo(
            "Draft only -- nothing has been written.\n"
            "What is seen below is what would be written.\n",
            err=to_err,
        )
        click.echo("%s\n%s" % (top_line, rendered))
    else:
        click.echo("Writing to newsfile...", err=to_err)
        start_line = config["start_line"]
        append_to_newsfile(
            directory, config["filename"], start_line, top_line, rendered
        )

        click.echo("Staging newsfile...", err=to_err)
        stage_newsfile(directory, config["filename"])

        click.echo("Removing news fragments...", err=to_err)
        remove_files(fragment_filenames, answer_yes)

        click.echo("Done!", err=to_err)
418214
def build_from_issue_comment(gh_token, body):
    
    if body["action"] in ["created", "edited"]:
        github_con = Github(gh_token)
        repo = github_con.get_repo(body['repository']['full_name'])
        issue = repo.get_issue(body['issue']['number'])
        text = body['comment']['body']
        try:
            comment = issue.get_comment(body['comment']['id'])
        except UnknownObjectException:
            # If the comment has already disapeared, skip the command
            return None
        return WebhookMetadata(repo, issue, text, comment)
    return None
1254382
function (buildConfig) {
        var projectRoot = buildConfig.projectRoot;
        var packageFile = path.join(projectRoot, 'package.json');

        var url = require(packageFile).repository.url;
        var prefix = 'github.com/';

        return url.substring(url.indexOf(prefix) + prefix.length, url.lastIndexOf('.git'));
    }
1326230
def _loadThreePartSource(self, sourceFName, sourceLines):
        
        lineno = 1
        for ln in sourceLines:
            lineno += 1
            try:
                stem, pubType, source = ln.split("\t", 2)
                stem = stem.strip()[-9:]
                self._addPub(stem, source)
                if pubType=="C":
                    self.confstems[stem] = 1
            except ValueError:
                sys.stderr.write("sourcematchers.py: %s (%d): skipping source line: %s"%(sourceFName,lineno,ln))
245876
def find_repo_urls(session, name, candidates):
    
    for _url in candidates:
        if validate_url(_url):
            try:
                resp = session.get(_url)
                if resp.status_code == 200:
                    tree = etree.HTML(resp.content)
                    if tree:
                        for link in frozenset([str(l) for l in tree.xpath("//a/@href")]):
                            # check if the link 1) is to github.com / bitbucket.org AND 2) somewhat
                            # contains the project name
                            if ("github.com" in link or "bitbucket.org" in link or
                                    "sourceforge.net" in link) \
                                    and contains_project_name(name, link):
                                link = validate_url(validate_repo_url(url=link))
                                if link:
                                    logger.debug("Found repo URL {}".format(link))
                                    yield link
            except ConnectionError:
                # we really don't care about connection errors here. a lot of project pages are simply
                # down because the project is no longer maintained
                pass
            except etree.XMLSyntaxError:
                # unable to parse HTML
                pass
            except UnicodeEncodeError:
                pass
1259825
private void computePublishProject() {

        String projectId = getParamProjectid();
        CmsUUID id;
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(projectId)) {
            // projectid not found in request parameter,
            id = getCms().getRequestContext().getCurrentProject().getUuid();
            setParamProjectname(getCms().getRequestContext().getCurrentProject().getName());
            setParamProjectid("" + id);
        } else {
            id = new CmsUUID(projectId);
            try {
                setParamProjectname(getCms().readProject(id).getName());
            } catch (CmsException e) {
                LOG.error(Messages.get().getBundle().key(Messages.LOG_SET_PROJECT_NAME_FAILED_0), e);
            }
        }
    }
20795
def _loadOneSource(self, sourceFName):
        
        sourceLines = open(sourceFName).readlines()
        del sourceLines[0]
        if len(sourceLines[0].split("\t"))==2:
            self._loadTwoPartSource(sourceFName, sourceLines)
        elif len(sourceLines[0].split("\t"))==3:
            self._loadThreePartSource(sourceFName, sourceLines)
        else:
            raise Error, "%s does not appear to be a source authority file"
1198987
function dependencyMatch (expected, actual) {
  // expand github:user/repo#hash to git://github.com/...
  if (expected.indexOf('github:') === 0) {
    expected = expected.replace(/^github:/, 'git://github.com/')
    var parsed = url.parse(expected)
    parsed.pathname += '.git'
    expected = url.format(parsed)
  }

    // normalize git+https prefix
  actual = actual.replace(/^git\+https/, 'git')
  expected = expected.replace(/^git\+https/, 'git')

  expected = ngu(expected)
  actual = ngu(actual)

  expected.url = expected.url.replace('https://', 'git://')
  actual.url = actual.url.replace('https://', 'git://')

  if (expected.url !== actual.url) {
    return false
  }

  if (actual.branch && actual.branch.indexOf(expected.branch) !== 0) {
    return false
  }

  return true
}