Return algorithm image URI for the given AWS region, repository name, and repository version
439146
def get_image_uri(region_name, repo_name, repo_version=1):
    """"""
    repo = '{}:{}'.format(repo_name, repo_version)
    return '{}/{}'.format(registry(region_name, repo_name), repo)
694025
def get_image(vm_):
    
    '''
    images = avail_images()
    vm_image = six.text_type(config.get_cloud_config_value(
        'image', vm_, __opts__, search_global=False
    ))
    for image in images:
        if vm_image in (images[image]['name'], images[image]['id']):
            return images[image]['id']
    raise SaltCloudNotFound(
        'The specified image, \'{0}\', could not be found.'.format(vm_image)
    )
771375
def select_uri_implementation(ecore_model_path):
    """"""
    if URL_PATTERN.match(ecore_model_path):
        return pyecore.resources.resource.HttpURI
    return pyecore.resources.URI
561570
private String getURL(String endpoint, int version, String method) {
        StringBuilder sb = new StringBuilder();
        sb.append(endpoint);
        if (!endpoint.endsWith(FORWARD_SLASH)) {
            sb.append(FORWARD_SLASH);
        }
        sb.append(VERSION_PREFIX + version + FORWARD_SLASH + method);
        return sb.toString();
    }
799907
def where(i):
    

    o=i.get('out','')

    duoa=i.get('data_uoa','')
    r=ck.find_path_to_repo({'repo_uoa':duoa})
    if r['return']>0: return r

    d=r.get('dict',{})
    url=d.get('url','')

    p=r['path']
    if p=='':
       p=url

    if o=='con':
       ck.out(p)

    return r
549124
def get_base_ami(awsclient, owners):
    
    client_ec2 = awsclient.get_client('ec2')
    image_filter = [
        {
            'Name': 'state',
            'Values': [
                'available',
            ]
        },
    ]

    latest_ts = maya.MayaDT(0).datetime(naive=True)
    latest_version = StrictVersion('0.0.0')
    latest_id = None
    for i in client_ec2.describe_images(
            Owners=owners,
            Filters=image_filter
            )['Images']:
        m = re.search(r'(Ops_Base-Image)_(\d+.\d+.\d+)_(\d+)$', i['Name'])
        if m:
            version = StrictVersion(m.group(2))
            #timestamp = m.group(3)
            creation_date = parse_ts(i['CreationDate'])

            if creation_date > latest_ts and version >=latest_version:
                latest_id = i['ImageId']
                latest_ts = creation_date
                latest_version = version

    return latest_id
804880
def get_commit_url(repo_url):
    """"""
    if "github.com" in repo_url:
        return repo_url[:-4] if repo_url.endswith(".git") else repo_url
    if "git.openstack.org" in repo_url:
        uri = '/'.join(repo_url.split('/')[-2:])
        return "https://github.com/{0}".format(uri)

    # If it didn't match these conditions, just return it.
    return repo_url
227007
def getrawfile(self, project_id, sha1, filepath):
        
        data = {'filepath': filepath}

        request = requests.get(
            '{0}/{1}/repository/blobs/{2}'.format(self.projects_url, project_id, sha1),
            params=data, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout,
            headers=self.headers)

        if request.status_code == 200:
            return request.content
        else:
            return False
1090831
def list_images(self, repository_name, registry_id=None):
        
        repository = None
        found = False
        if repository_name in self.repositories:
            repository = self.repositories[repository_name]
            if registry_id:
                if repository.registry_id == registry_id:
                    found = True
            else:
                found = True

        if not found:
            raise RepositoryNotFoundException(repository_name, registry_id or DEFAULT_REGISTRY_ID)

        images = []
        for image in repository.images:
            images.append(image)
        return images
472742
def file_uri(fname):
    """"""
    if os.name == 'nt':
        # Local file
        if re.search(r'^[a-zA-Z]:', fname):
            return 'file:///' + fname
        # UNC based path
        else:
            return 'file://' + fname
    else:
        return 'file://' + fname
544759
def _get_qemu_img_version(qemu_img_path):
        

        try:
            output = yield from subprocess_check_output(qemu_img_path, "--version")
            match = re.search("version\s+([0-9a-z\-\.]+)", output)
            if match:
                version = match.group(1)
                return version
            else:
                raise QemuError("Could not determine the Qemu-img version for {}".format(qemu_img_path))
        except subprocess.SubprocessError as e:
            raise QemuError("Error while looking for the Qemu-img version: {}".format(e))
666762
def parse_s3_uri(uri):
    
    if not isinstance(uri, string_types):
        return None

    url = urlparse(uri)
    query = parse_qs(url.query)

    if url.scheme == 's3' and url.netloc and url.path:
        s3_pointer = {
            'Bucket': url.netloc,
            'Key': url.path.lstrip('/')
        }
        if 'versionId' in query and len(query['versionId']) == 1:
            s3_pointer['Version'] = query['versionId'][0]
        return s3_pointer
    else:
        return None
951563
def get_s3_uri(m, file_names, config):
    
    bucket_name = m.group(1)
    path = m.group(2)
    bucket = get_s3_bucket(bucket_name, config)
    result = 0
    if (config.start_date or config.date_range) and ("{year" in path or "{month" in path or "{day" in path):
        for tmp_date in date_generator(config.end_date, config.date_range or ((config.end_date - config.start_date).days + 1)):
            # +1 because we want to include end_date
            for key in bucket.list(prefix=path.format(year=tmp_date.year, month=tmp_date.month, day=tmp_date.day)):
                file_names.append("s3://{}/{}".format(bucket_name, key.name))
                result += key.size
    else:
        for key in bucket.list(prefix=path):
            file_names.append("s3://{}/{}".format(bucket_name, key.name))
            result += key.size
    return result
774836
def logo_as_data_uri(self):
        """"""
        _, ext = os.path.splitext(self.logo.file.name)
        with open(self.logo.file.name, 'rb') as f:
            data = base64.b64encode(f.read())

        return 'data:image/{};base64,{}'.format(
            ext[1:],  # Remove the leading dot.
            data.decode()
        )
614709
def registry(region_name, framework=None):
    
    try:
        account_id = image_registry_map[region_name][framework]
        return get_ecr_image_uri_prefix(account_id, region_name)
    except KeyError:
        logging.error("The specific image or region does not exist")
        raise
1261027
def get_image(conn, vm_):
    '''
    
    '''
    images = conn.list_images()
    vm_image = config.get_cloud_config_value('image', vm_, __opts__)

    if not six.PY3:
        vm_image = vm_image.encode('ascii', 'salt-cloud-force-ascii')

    for img in images:
        if isinstance(img.id, six.string_types) and not six.PY3:
            img_id = img.id.encode('ascii', 'salt-cloud-force-ascii')
        else:
            img_id = str(img.id)  # future lint: disable=blacklisted-function

        if isinstance(img.name, six.string_types) and not six.PY3:
            img_name = img.name.encode('ascii', 'salt-cloud-force-ascii')
        else:
            img_name = str(img.name)  # future lint: disable=blacklisted-function

        if vm_image and vm_image in (img_id, img_name):
            return img

    raise SaltCloudNotFound(
        'The specified image, \'{0}\', could not be found.'.format(vm_image)
    )
1262174
def get_os_version(instance):
    """"""
    if instance.cloud == 'aws':
        client = boto3.client('ec2', instance.region)
        image_id = client.describe_instances(InstanceIds=[instance.id])['Reservations'][0]['Instances'][0]['ImageId']
        return '16.04' if '16.04' in client.describe_images(ImageIds=[image_id])['Images'][0]['Name'] else '14.04'
    if instance.cloud == 'gcp':
        credentials = GoogleCredentials.get_application_default()
        compute = discovery.build('compute', 'v1', credentials=credentials)
        for disk in compute.instances().get(instance=instance.name,
                                            zone=instance.zone,
                                            project=instance.project).execute()['disks']:
            if not disk.get('boot'):
                continue
            for value in disk.get('licenses', []):
                if '1604' in value:
                    return '16.04'
                if '1404' in value:
                    return '14.04'
        return '14.04'
    return '14.04'