Similar to :meth:`get_input_peer`, but for photos
173539
def get_input_photo(photo):
    """"""
    try:
        if photo.SUBCLASS_OF_ID == 0x846363e0:  # crc32(b'InputPhoto'):
            return photo
    except AttributeError:
        _raise_cast_fail(photo, 'InputPhoto')

    if isinstance(photo, types.photos.Photo):
        photo = photo.photo

    if isinstance(photo, types.Photo):
        return types.InputPhoto(id=photo.id, access_hash=photo.access_hash,
                                file_reference=photo.file_reference)

    if isinstance(photo, types.PhotoEmpty):
        return types.InputPhotoEmpty()

    if isinstance(photo, types.messages.ChatFull):
        photo = photo.full_chat
    if isinstance(photo, types.ChannelFull):
        return get_input_photo(photo.chat_photo)
    elif isinstance(photo, types.UserFull):
        return get_input_photo(photo.profile_photo)
    elif isinstance(photo, (types.Channel, types.Chat, types.User)):
        return get_input_photo(photo.photo)

    if isinstance(photo, (types.UserEmpty, types.ChatEmpty,
                          types.ChatForbidden, types.ChannelForbidden)):
        return types.InputPhotoEmpty()

    _raise_cast_fail(photo, 'InputPhoto')
515203
def _connectToFlickr(self):
        """"""

        if self.connected_to_flickr:
            logger.debug("Already connected to flickr")
            return True

        logger.debug("Connecting to flickr")
        # Do flickr authentication
        _flickr = flickrapi.FlickrAPI(api_key, api_secret,format='etree')
        try:
            (token, frob) = _flickr.get_token_part_one(perms='delete')
        except:
            print("Couldn't connect to flickr")
            return False

        if not token: raw_input("Press ENTER after you authorized this program")
        _flickr.get_token_part_two((token, frob))

        self.flickr=_flickr;
        
        self.connected_to_flickr=True

        return True
1090095
def get(type=None, **ArgConfig):
  
  """
  ArgConfig.update(type=type)
  return gatherInput(**reconfigArg(ArgConfig))
1013526
def get_inputs(node, kwargs):
    """"""
    name = node["name"]
    proc_nodes = kwargs["proc_nodes"]
    index_lookup = kwargs["index_lookup"]
    inputs = node["inputs"]
    attrs = node.get("attrs", {})

    input_nodes = []
    for ip in inputs:
        input_node_id = index_lookup[ip[0]]
        input_nodes.append(proc_nodes[input_node_id].name)

    return name, input_nodes, attrs
793974
def get_img_data(f, maxsize = (1200, 850), first = False):
    
    img = Image.open(f)
    img.thumbnail(maxsize)
    if first:                     # tkinter is inactive the first time
        bio = io.BytesIO()
        img.save(bio, format = "PNG")
        del img
        return bio.getvalue()
    return ImageTk.PhotoImage(img)
636771
def getPeer(self, url):
        
        peers = filter(lambda x: x.getUrl() == url, self.getPeers())
        if len(peers) == 0:
            raise exceptions.PeerNotFoundException(url)
        return peers[0]
781075
def get_inputs_from_cm(index, cm):
    """"""
    return tuple(i for i in range(cm.shape[0]) if cm[i][index])
1208532
function pipePhotoPostHandler(){

    var fileNameValue =  $('#filename').val() || _photoToUse.split('/').pop() || 'photopipe_'
    var fileExtension = ''
    var hasFileExt = (/\.(gif|jpg|jpeg|png|bmp)/gi.exec(_photoToUse))
    var fileExtension = (hasFileExt && hasFileExt.length) ? hasFileExt[0] : '.jpg'

    fileNameValue = encodeURI( (fileNameValue + fileExtension) )

    // If the filebegins with a question mark, make it empty string
    if(fileNameValue.charAt(0) === '?') fileNameValue = ''
    
    console.dir(hasFileExt)
    console.log(fileExtension)    
    console.log(fileNameValue)    
    console.log(_photoToUse)
    
    $
    .post("/smoke",{
      type: _photoDestination,
      photoUrl: localStorage.imageToPipe,
      filename: fileNameValue,
      caption: $caption.val() || null
    })
    .success(function(data){ 

      $spin.hide()

      if(_photoDestination === 'download'){
        // console.dir(data)
        downloadFile(data)
      }
      else{
        // console.dir(data)
        alert('Success!')
        // window.location = "/"
      }

    })
    .error(function(e) {
      $spin.hide()
      if(e.status === 400) alert(e.responseText || 'Bad request.')
      if(e.status === 401) alert(e.responseText || 'Unauthorized request.')
      if(e.status === 402) alert(e.responseText || 'Forbidden request.')
      if(e.status === 403) alert(e.responseText || 'Forbidden request.')
      if(e.status === 404) alert(e.responseText || 'Images were not found.')
      if(e.status === 405) alert(e.responseText || 'That method is not allowed.')
      if(e.status === 408) alert(e.responseText || 'The request timed out. Try again.')
      if(e.status === 500) alert(e.responseText || 'Something went really wrong.')
      
      // TODO: RESTART AT STEP ONE? 0N 403 YES.
      if(e.status === 403 && (e.responseText.regexIndexOf(/twitter/gi) > -1)) window.location = "/twitter"
      if(e.status === 403 && (e.responseText.regexIndexOf(/facebook/gi) > -1)) window.location = "/facebook"
      if(e.status === 403 && (e.responseText.regexIndexOf(/instagram/gi) > -1)) window.location = "/instagram"
    })
    
    return false
    
  }
142658
def peer(opt_peer, opt_username, opt_password, scope="module"):
    ''''''
    p = BigIP(opt_peer, opt_username, opt_password)
    return p
60599
def people_getPublicPhotos(user_id, per_page='', page=''):
    """"""
    method = 'flickr.people.getPublicPhotos'
    data = _doget(method, user_id=user_id, per_page=per_page, page=page)
    photos = []
    if hasattr(data.rsp.photos, "photo"): # Check if there are photos at all (may be been paging too far).
        if isinstance(data.rsp.photos.photo, list):
            for photo in data.rsp.photos.photo:
                photos.append(_parse_photo(photo))
        else:
            photos = [_parse_photo(data.rsp.photos.photo)]
    return photos
390401
public Photoset getInfo(String photosetId) throws FlickrException {
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("method", METHOD_GET_INFO);

        parameters.put("photoset_id", photosetId);

        Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }
        Element photosetElement = response.getPayload();
        Photoset photoset = new Photoset();
        photoset.setId(photosetElement.getAttribute("id"));

        User owner = new User();
        owner.setId(photosetElement.getAttribute("owner"));
        photoset.setOwner(owner);

        Photo primaryPhoto = new Photo();
        primaryPhoto.setId(photosetElement.getAttribute("primary"));
        primaryPhoto.setSecret(photosetElement.getAttribute("secret")); // TODO verify that this is the secret for the photo
        primaryPhoto.setServer(photosetElement.getAttribute("server")); // TODO verify that this is the server for the photo
        primaryPhoto.setFarm(photosetElement.getAttribute("farm"));
        photoset.setPrimaryPhoto(primaryPhoto);

        // TODO remove secret/server/farm from photoset?
        // It's rather related to the primaryPhoto, then to the photoset itself.
        photoset.setSecret(photosetElement.getAttribute("secret"));
        photoset.setServer(photosetElement.getAttribute("server"));
        photoset.setFarm(photosetElement.getAttribute("farm"));
        photoset.setPhotoCount(photosetElement.getAttribute("count_photos"));
        photoset.setVideoCount(Integer.parseInt(photosetElement.getAttribute("count_videos")));
        photoset.setViewCount(Integer.parseInt(photosetElement.getAttribute("count_views")));
        photoset.setCommentCount(Integer.parseInt(photosetElement.getAttribute("count_comments")));
        photoset.setDateCreate(photosetElement.getAttribute("date_create"));
        photoset.setDateUpdate(photosetElement.getAttribute("date_update"));

        photoset.setIsCanComment("1".equals(photosetElement.getAttribute("can_comment")));

        photoset.setTitle(XMLUtilities.getChildValue(photosetElement, "title"));
        photoset.setDescription(XMLUtilities.getChildValue(photosetElement, "description"));
        photoset.setPrimaryPhoto(primaryPhoto);

        return photoset;
    }
1070007
def get_input_media(
        media, *,
        is_photo=False, attributes=None, force_document=False,
        voice_note=False, video_note=False, supports_streaming=False
):
    
    try:
        if media.SUBCLASS_OF_ID == 0xfaf846f4:  # crc32(b'InputMedia')
            return media
        elif media.SUBCLASS_OF_ID == 0x846363e0:  # crc32(b'InputPhoto')
            return types.InputMediaPhoto(media)
        elif media.SUBCLASS_OF_ID == 0xf33fdb68:  # crc32(b'InputDocument')
            return types.InputMediaDocument(media)
    except AttributeError:
        _raise_cast_fail(media, 'InputMedia')

    if isinstance(media, types.MessageMediaPhoto):
        return types.InputMediaPhoto(
            id=get_input_photo(media.photo),
            ttl_seconds=media.ttl_seconds
        )

    if isinstance(media, (types.Photo, types.photos.Photo, types.PhotoEmpty)):
        return types.InputMediaPhoto(
            id=get_input_photo(media)
        )

    if isinstance(media, types.MessageMediaDocument):
        return types.InputMediaDocument(
            id=get_input_document(media.document),
            ttl_seconds=media.ttl_seconds
        )

    if isinstance(media, (types.Document, types.DocumentEmpty)):
        return types.InputMediaDocument(
            id=get_input_document(media)
        )

    if isinstance(media, (types.InputFile, types.InputFileBig)):
        if is_photo:
            return types.InputMediaUploadedPhoto(file=media)
        else:
            attrs, mime = get_attributes(
                media,
                attributes=attributes,
                force_document=force_document,
                voice_note=voice_note,
                video_note=video_note,
                supports_streaming=supports_streaming
            )
            return types.InputMediaUploadedDocument(
                file=media, mime_type=mime, attributes=attrs)

    if isinstance(media, types.MessageMediaGame):
        return types.InputMediaGame(id=media.game.id)

    if isinstance(media, types.MessageMediaContact):
        return types.InputMediaContact(
            phone_number=media.phone_number,
            first_name=media.first_name,
            last_name=media.last_name,
            vcard=''
        )

    if isinstance(media, types.MessageMediaGeo):
        return types.InputMediaGeoPoint(geo_point=get_input_geo(media.geo))

    if isinstance(media, types.MessageMediaVenue):
        return types.InputMediaVenue(
            geo_point=get_input_geo(media.geo),
            title=media.title,
            address=media.address,
            provider=media.provider,
            venue_id=media.venue_id,
            venue_type=''
        )

    if isinstance(media, (
            types.MessageMediaEmpty, types.MessageMediaUnsupported,
            types.ChatPhotoEmpty, types.UserProfilePhotoEmpty,
            types.ChatPhoto, types.UserProfilePhoto,
            types.FileLocationToBeDeprecated)):
        return types.InputMediaEmpty()

    if isinstance(media, types.Message):
        return get_input_media(media.media, is_photo=is_photo)

    _raise_cast_fail(media, 'InputMedia')
378585
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")
        from pytgbot.api_types.receivable.media import PhotoSize
        

        data = {}
        data['total_count'] = int(array.get('total_count'))
        data['photos'] = PhotoSize.from_array_list(array.get('photos'), list_level=2)
        data['_raw'] = array
        return UserProfilePhotos(**data)
669247
def _getphotosets_forphoto(self,pid):
        """"""

        resp=self.flickr.photos_getAllContexts(photo_id=pid)
        if resp.attrib['stat']!='ok':
            logger.error("%s - flickr: photos_getAllContext failed with status: %s",\
                    resp.attrib['stat']);
            return None

        lphotosets=[]
        for element in resp.findall('set'):
            lphotosets.append(element.attrib['title'])

        logger.debug('%s - belongs to these photosets %s',pid,lphotosets)

        return lphotosets
878620
def getPhotos(self, tags='', per_page='', page=''):
        """"""
        method = 'flickr.groups.pools.getPhotos'
        data = _doget(method, group_id=self.id, tags=tags,\
                      per_page=per_page, page=page)
        photos = []
        for photo in data.rsp.photos.photo:
            photos.append(_parse_photo(photo))
        return photos
468962
def read(cls, iprot):
        '''
        
        '''

        init_kwds = {}

        iprot.read_struct_begin()
        while True:
            ifield_name, ifield_type, _ifield_id = iprot.read_field_begin()
            if ifield_type == 0:  # STOP
                break
            elif ifield_name == 'attributes':
                init_kwds['attributes'] = dict([(iprot.read_string(), iprot.read_string()) for _ in range(iprot.read_map_begin()[2])] + (iprot.read_map_end() is None and []))
            elif ifield_name == 'guid':
                init_kwds['guid'] = iprot.read_string()
            elif ifield_name == 'id':
                init_kwds['id'] = iprot.read_string()
            elif ifield_name == 'related_photos':
                init_kwds['related_photos'] = tuple([pastpy.gen.database.impl.online.online_database_object_detail_image.OnlineDatabaseObjectDetailImage.read(iprot) for _ in range(iprot.read_list_begin()[1])] + (iprot.read_list_end() is None and []))
            iprot.read_field_end()
        iprot.read_struct_end()

        return cls(**init_kwds)
379628
def get_input_location(location):
    
    try:
        if location.SUBCLASS_OF_ID == 0x1523d462:
            return None, location  # crc32(b'InputFileLocation'):
    except AttributeError:
        _raise_cast_fail(location, 'InputFileLocation')

    if isinstance(location, types.Message):
        location = location.media

    if isinstance(location, types.MessageMediaDocument):
        location = location.document
    elif isinstance(location, types.MessageMediaPhoto):
        location = location.photo

    if isinstance(location, types.Document):
        return (location.dc_id, types.InputDocumentFileLocation(
            id=location.id,
            access_hash=location.access_hash,
            file_reference=location.file_reference,
            thumb_size=''  # Presumably to download one of its thumbnails
        ))
    elif isinstance(location, types.Photo):
        return (location.dc_id, types.InputPhotoFileLocation(
            id=location.id,
            access_hash=location.access_hash,
            file_reference=location.file_reference,
            thumb_size=location.sizes[-1].type
        ))

    if isinstance(location, types.FileLocationToBeDeprecated):
        raise TypeError('Unavailable location cannot be used as input')

    _raise_cast_fail(location, 'InputFileLocation')