Example #1
0
def args_to_kwargs(args, kwargs):

    for arg in args:
        # get the uri 
        if "/" in arg and github.has_issues(arg):
            kwargs["repo"] = arg
        elif not "=" in arg and github.user_repo(arg):
            kwargs["repo"] = github.user_repo(arg)
        # state arguments
        elif "=" in arg: 
            # break up the pieces and then fill kwargs
            pieces = re.findall(r"[\w'=,]+", arg)
            for piece in pieces: 
                # if no equal sign - assign to state
                if not "=" in piece:
                    if piece in ("open", "closed", "state"):
                        kwargs["state"] = piece
                    continue
                # user passed in custom params for github query
                p = tuple(re.split(r"[=]+", piece))
                kwargs[p[0]] = p[1]
        else: # pass standard string arguments back to the caller
            if not kwargs.get("args"):
                kwargs["args"] = []
            kwargs["args"].append(arg)

    # no repo - try to grab from the path
    if not kwargs.get("repo"):
        kwargs["repo"] = github.repo_from_path()

    return kwargs
Example #2
0
    def show_issues(cls, *args, **kwargs):

        # normalize kwargs
        kwargs = utils.args_to_kwargs(args, kwargs)
        if not kwargs.get("repo"):
            kwargs["repo"] = github.repo_from_path()

        # case of now repo
        if not kwargs.get("repo") or not github.has_issues(kwargs.get("repo")):
            print "Unable to find repository. Please pass valid github uri or use from within a git directory"
            return

        # try to use cached il, if not, create a new one
        il = il_hash.get(kwargs.get("repo"))
        if not il or not utils.equal_dicts(il.kwargs, kwargs) and not kwargs.get("update"):
            il = cls(**kwargs)

        # update issue list
        il.update()
Example #3
0
    def test_has_issues(self):

        self.assertTrue(github.has_issues(("jonmorehouse/vim-github")))
        self.assertFalse(github.has_issues(("jonmorehouse/github-issues.vim")))