<commit_before>from __future__ import print_function

import json
import logging

from argh import *
from ghtools.api import GithubAPIClient

log = logging.getLogger(__name__)
parser = ArghParser(description="Interact with GitHub repos")
parser.add_argument('-n', '--nickname', default='public', help='GitHub instance nickname')
parser.add_argument('repo', help='Repo name, e.g. defunkt/resque')


def delete(args):
    """
    Delete the specified repository
    """
    c = GithubAPIClient(nickname=args.nickname)

    res = c.delete('/repos/{0}'.format(args.repo))
    res.raise_for_status()


def get(args):
    """
    Print the JSON representation of the specified repository to STDOUT
    """
    c = GithubAPIClient(nickname=args.nickname)

    res = c.get('/repos/{0}'.format(args.repo))
    return json.dumps(res.json, indent=2)


parser.add_commands([delete, get])

<commit_msg>Remove nickname option from gh-repo command<commit_after>from __future__ import print_function

import json
import logging

from argh import *
from ghtools.api import GithubAPIClient
from ghtools.identifier import Identifier

log = logging.getLogger(__name__)
parser = ArghParser(description="Interact with GitHub repos")
parser.add_argument('repo', help='Repo identifier, e.g. defunkt/resque, enterprise:mycorp/myproj')


def delete(args):
    """
    Delete the specified repository
    """
    ident = Identifier.from_string(args.repo)
    c = GithubAPIClient(nickname=ident.github)

    res = c.delete('/repos/{0}/{1}'.format(ident.org, ident.repo))
    res.raise_for_status()


def get(args):
    """
    Print the JSON representation of the specified repository to STDOUT
    """
    ident = Identifier.from_string(args.repo)
    c = GithubAPIClient(nickname=ident.github)

    res = c.get('/repos/{0}/{1}'.format(ident.org, ident.repo))
    return json.dumps(res.json, indent=2)


parser.add_commands([delete, get])


{'fraction_non_alphanumeric': 0.12650287506534239, 'fraction_numerical': 0.004181913225300575, 'mean_word_length': 4.4375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '5864969', 'n_tokens_mistral': 618, 'n_tokens_neox': 608, 'n_words': 140}