How to use the uritemplate.URITemplate function in uritemplate

To help you get started, we’ve selected a few uritemplate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-hyper / uritemplate / test_uritemplate.py View on Github external
def test_default_value(self):
        uri = 'https://api.github.com/user{/user=sigmavirus24}'
        t = URITemplate(uri)
        self.assertEqual(t.expand(),
                         'https://api.github.com/user/sigmavirus24')
        self.assertEqual(t.expand(user='lukasa'),
                         'https://api.github.com/user/lukasa')
github devonfw / tools-cobigen / create_release.py View on Github external
release_text = "[ChangeLog](" + url_milestone + ")"
    if "eclipse" in branch_name:
	    for i in range(len(milestone_json_data)):
		    if "cobigen-core-v"+core_version_in_eclipse_pom == milestone_json_data[i]["title"]:
			    if not milestone_json_data[i]["state"] =="closed":
				    print_info("Core version"+core_version_in_eclipse_pom+" is not released yet,	This should be released before releasing cobigen-eclipse");
				    sys.exit()
			    else:
				    core_url_milestone = "https://github.com/"+ rep.full_name + "/milestone/" + str(milestone_json_data[i]["number"])+"?closed=1"
				    release_text=release_text+ "\n also includes \n"+ "[ChangeLog CobiGen Core](" + url_milestone + ")"					
	    
    try:
        content_type="application/java-archive"
        response=rep.create_git_release(tag_name, release_title, release_text, draft=False, prerelease=False, target_commitish="master");
        upload_url=response.upload_url
        uri_template = URITemplate(upload_url)
        if branch_name in ["dev_openapiplugin","dev_xmlplugin","dev_propertyplugin","dev_jsonplugin","dev_tempeng_velocity","dev_textmerger","dev_htmlmerger","dev_tsplugin","dev_jssenchaplugin"]:
            os.chdir("target")            			
        elif branch_name=="dev_javaplugin":
            os.chdir("cobigen-javaplugin/target")
        elif branch_name=="dev_eclipseplugin":
            content_type="application/zip"
            os.chdir("cobigen-eclipse-updatesite/target")
        else:
            print_info("New branch is not added in the script, please add it");
            sys.exit()
        for root, dirs, files in os.walk("."):
            dirs[:] = [d for d in dirs if d not in [".settings","src",]]
            for fname in files:
                fpath = os.path.join(root, fname);
				# To prevent uploading of unnecessary zip/jar files.
                if ("jar" in fname or "zip" in fname) and release_version in fname:
github sigmavirus24 / github3.py / github3 / repos / repo.py View on Github external
#: Downloads url (not a template)
        self.download_url = repo.get('downloads_url', '')

        ## Template URLS
        ie_url_t = repo.get('issue_events_url')
        #: Issue events URL Template. Expand with ``number``
        self.issue_events_urlt = URITemplate(ie_url_t) if ie_url_t else None

        assignees = repo.get('assignees_url')
        #: Assignees URL Template. Expand with ``user``
        self.assignees_urlt = URITemplate(assignees) if assignees else None

        branches = repo.get('branches_url')
        #: Branches URL Template. Expand with ``branch``
        self.branches_urlt = URITemplate(branches) if branches else None

        blobs = repo.get('blobs_url')
        #: Blobs URL Template. Expand with ``sha``
        self.blobs_urlt = URITemplate(blobs) if blobs else None

        git_tags = repo.get('git_tags_url')
        #: Git tags URL Template. Expand with ``sha``
        self.git_tags_urlt = URITemplate(git_tags) if git_tags else None

        git_refs = repo.get('git_refs_url')
        #: Git refs URL Template. Expand with ``sha``
        self.git_refs_urlt = URITemplate(git_refs) if git_refs else None

        trees = repo.get('trees_url')
        #: Trres URL Template. Expand with ``sha``
        self.trees_urlt = URITemplate(trees) if trees else None
github encode / apistar / apistar / components / schema.py View on Github external
def get_link(route: Route) -> coreapi.Link:
    """
    Given a single route, return a Link instance containing all the information
    needed to expose that route in an API Schema.
    """
    path, method, view, name = route

    fields = []  # type: typing.List[coreapi.Field]
    path_names = set(uritemplate.URITemplate(path).variable_names)
    for param in inspect.signature(view).parameters.values():
        fields += get_fields(param, method, path_names)

    if view.__doc__:
        description = textwrap.dedent(view.__doc__).strip()
    else:
        description = None

    return coreapi.Link(url=path, action=method, description=description, fields=fields)
github donnemartin / gitsome / gitsome / lib / github3 / orgs.py View on Github external
def _update_attributes(self, team):
        self._api = team.get('url', '')
        #: This team's name.
        self.name = team.get('name')
        #: Unique ID of the team.
        self.id = team.get('id')
        #: Permission level of the group.
        self.permission = team.get('permission')
        #: Number of members in this team.
        self.members_count = team.get('members_count')
        members = team.get('members_url')
        #: Members URL Template. Expands with ``member``.
        self.members_urlt = URITemplate(members) if members else None
        #: Number of repos owned by this team.
        self.repos_count = team.get('repos_count')
        #: Repositories url (not a template).
        self.repositories_url = team.get('repositories_url')
github sigmavirus24 / github3.py / github3 / repos / release.py View on Github external
self.id = release.get('id')
        #: Name given to the release
        self.name = release.get('name')
        #: Boolean whether release is a prerelease
        self.prerelease = release.get('prerelease')
        #: Date the release was published
        self.published_at = self._strptime(release.get('published_at'))
        #: Name of the tag
        self.tag_name = release.get('tag_name')
        #: URL to download a tarball of the release
        self.tarball_url = release.get('tarball_url')
        #: "Commit" that this release targets
        self.target_commitish = release.get('target_commitish')
        upload_url = release.get('upload_url')
        #: URITemplate to upload an asset with
        self.upload_urlt = URITemplate(upload_url) if upload_url else None
        #: URL to download a zipball of the release
        self.zipball_url = release.get('zipball_url')
github sigmavirus24 / github3.py / src / github3 / orgs.py View on Github external
def _update_attributes(self, org):
        self.avatar_url = org["avatar_url"]
        self.description = org["description"]
        self.events_url = org["events_url"]
        self.hooks_url = org["hooks_url"]
        self.id = org["id"]
        self.issues_url = org["issues_url"]
        self.login = org["login"]
        self.members_url = org["members_url"]
        self.public_members_urlt = URITemplate(org["public_members_url"])
        self.repos_url = org["repos_url"]
        self.url = self._api = org["url"]
        self.type = "Organization"
github sigmavirus24 / github3.py / github3 / repos / repo.py View on Github external
commits = repo.get('git_commits_url')
        #: Git commits URL Template. Expand with ``sha``
        self.git_commits_urlt = URITemplate(commits) if commits else None

        comments = repo.get('comments_url')
        #: Comments URL Template. Expand with ``number``
        self.comments_urlt = URITemplate(comments) if comments else None

        comments = repo.get('issue_comment_url')
        #: Issue comment URL Template. Expand with ``number``
        self.issue_comment_urlt = URITemplate(comments) if comments else None

        contents = repo.get('contents_url')
        #: Contents URL Template. Expand with ``path``
        self.contents_urlt = URITemplate(contents) if contents else None

        compare = repo.get('compare_url')
        #: Comparison URL Template. Expand with ``base`` and ``head``
        self.compare_urlt = URITemplate(compare) if compare else None

        archive = repo.get('archive_url')
        #: Archive URL Template. Expand with ``archive_format`` and ``ref``
        self.archive_urlt = URITemplate(archive) if archive else None

        issues = repo.get('issues_url')
        #: Issues URL Template. Expand with ``number``
        self.issues_urlt = URITemplate(issues) if issues else None

        pulls = repo.get('pulls_url')
        #: Pull Requests URL Template. Expand with ``number``
        self.pulls_urlt = URITemplate(pulls) if issues else None
github sigmavirus24 / github3.py / src / github3 / github.py View on Github external
def replace_href(feed_dict):
            if not feed_dict:
                return feed_dict
            ret_dict = {}
            # Let's pluck out what we're most interested in, the href value
            href = feed_dict.pop("href", None)
            # Then we update the return dictionary with the rest of the values
            ret_dict.update(feed_dict)
            if href is not None:
                # So long as there is something to template, let's template it
                ret_dict["href"] = uritemplate.URITemplate(href)
            return ret_dict