<commit_before>require 'octokit'

# API documentation:
# http://developer.github.com/v3/

class RepoProvider::Github

  URL_PATTERNS = [
    /^(ssh:\/\/)?git@github.com:(?<user>[^\/]+)\/(?<repo>.+)\.git$/,
    /^https:\/\/github.com\/(?<user>[^\/]+)\/(?<repo>.+)\.git$/
  ]

  def self.get_repo url
    # find the url pattern that matches the url
    URL_PATTERNS.map{|p| p.match url }.compact.first
  end

  def issues_list opts = {}
    # get open issues for this repo
    issues = github.issues gh_repo
    # get all closed issues if required
    issues += github.issues( gh_repo, state: 'closed' ) if opts[:all]
    # return issues
    format_issues( issues )
  end

  def issue_create title, content
    ret = github.create_issue gh_repo, title, content
    ret.attrs && ret.attrs[:number] || -1<commit_msg>bugfix: recognize github repos without .git ending<commit_after>require 'octokit'

# API documentation:
# http://developer.github.com/v3/

class RepoProvider::Github

  URL_PATTERNS = [
    /^(ssh:\/\/)?git@github.com:(?<user>[^\/]+)\/(?<repo>.+)(\.git)?$/,
    /^https:\/\/github.com\/(?<user>[^\/]+)\/(?<repo>.+)(\.git)?$/
  ]

  def self.get_repo url
    # find the url pattern that matches the url
    URL_PATTERNS.map{|p| p.match url }.compact.first
  end

  def issues_list opts = {}
    # get open issues for this repo
    issues = github.issues gh_repo
    # get all closed issues if required
    issues += github.issues( gh_repo, state: 'closed' ) if opts[:all]
    # return issues
    format_issues( issues )
  end

  def issue_create title, content
    ret = github.create_issue gh_repo, title, content
    ret.attrs && ret.attrs[:number] || -1
{'fraction_non_alphanumeric': 0.17156568686262746, 'fraction_numerical': 0.0023995200959808036, 'mean_word_length': 3.088235294117647, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2957360', 'n_tokens_mistral': 616, 'n_tokens_neox': 569, 'n_words': 141}