signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
@mp4_size.setter<EOL><INDENT>def mp4_size(self, mp4_size):<DEDENT>
self._mp4_size = mp4_size<EOL>
Sets the mp4_size of this GifImagesFixedHeight. The size in bytes of the .MP4 file corresponding to this GIF. :param mp4_size: The mp4_size of this GifImagesFixedHeight. :type: str
f3080:c0:m12
@property<EOL><INDENT>def webp(self):<DEDENT>
return self._webp<EOL>
Gets the webp of this GifImagesFixedHeight. The URL for this GIF in .webp format. :return: The webp of this GifImagesFixedHeight. :rtype: str
f3080:c0:m13
@webp.setter<EOL><INDENT>def webp(self, webp):<DEDENT>
self._webp = webp<EOL>
Sets the webp of this GifImagesFixedHeight. The URL for this GIF in .webp format. :param webp: The webp of this GifImagesFixedHeight. :type: str
f3080:c0:m14
@property<EOL><INDENT>def webp_size(self):<DEDENT>
return self._webp_size<EOL>
Gets the webp_size of this GifImagesFixedHeight. The size in bytes of the .webp file corresponding to this GIF. :return: The webp_size of this GifImagesFixedHeight. :rtype: str
f3080:c0:m15
@webp_size.setter<EOL><INDENT>def webp_size(self, webp_size):<DEDENT>
self._webp_size = webp_size<EOL>
Sets the webp_size of this GifImagesFixedHeight. The size in bytes of the .webp file corresponding to this GIF. :param webp_size: The webp_size of this GifImagesFixedHeight. :type: str
f3080:c0:m16
def to_dict(self):
result = {}<EOL>for attr, _ in iteritems(self.swagger_types):<EOL><INDENT>value = getattr(self, attr)<EOL>if isinstance(value, list):<EOL><INDENT>result[attr] = list(map(<EOL>lambda x: x.to_dict() if hasattr(x, "<STR_LIT>") else x,<EOL>value<EOL>))<EOL><DEDENT>elif hasattr(value, "<STR_LIT>"):<EOL><INDENT>result[attr] = value.to_dict()<EOL><DEDENT>elif isinstance(value, dict):<EOL><INDENT>result[attr] = dict(map(<EOL>lambda item: (item[<NUM_LIT:0>], item[<NUM_LIT:1>].to_dict())<EOL>if hasattr(item[<NUM_LIT:1>], "<STR_LIT>") else item,<EOL>value.items()<EOL>))<EOL><DEDENT>else:<EOL><INDENT>result[attr] = value<EOL><DEDENT><DEDENT>return result<EOL>
Returns the model properties as a dict
f3080:c0:m17
def to_str(self):
return pformat(self.to_dict())<EOL>
Returns the string representation of the model
f3080:c0:m18
def __repr__(self):
return self.to_str()<EOL>
For `print` and `pprint`
f3080:c0:m19
def __eq__(self, other):
if not isinstance(other, GifImagesFixedHeight):<EOL><INDENT>return False<EOL><DEDENT>return self.__dict__ == other.__dict__<EOL>
Returns true if both objects are equal
f3080:c0:m20
def __ne__(self, other):
return not self == other<EOL>
Returns true if both objects are not equal
f3080:c0:m21
def __init__(self, url=None, width=None, height=None, size=None, mp4=None, mp4_size=None, webp=None, webp_size=None):
self.swagger_types = {<EOL>'<STR_LIT:url>': '<STR_LIT:str>',<EOL>'<STR_LIT:width>': '<STR_LIT:str>',<EOL>'<STR_LIT>': '<STR_LIT:str>',<EOL>'<STR_LIT:size>': '<STR_LIT:str>',<EOL>'<STR_LIT>': '<STR_LIT:str>',<EOL>'<STR_LIT>': '<STR_LIT:str>',<EOL>'<STR_LIT>': '<STR_LIT:str>',<EOL>'<STR_LIT>': '<STR_LIT:str>'<EOL>}<EOL>self.attribute_map = {<EOL>'<STR_LIT:url>': '<STR_LIT:url>',<EOL>'<STR_LIT:width>': '<STR_LIT:width>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT:size>': '<STR_LIT:size>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>'<EOL>}<EOL>self._url = url<EOL>self._width = width<EOL>self._height = height<EOL>self._size = size<EOL>self._mp4 = mp4<EOL>self._mp4_size = mp4_size<EOL>self._webp = webp<EOL>self._webp_size = webp_size<EOL>
GifImagesFixedHeightSmall - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
f3081:c0:m0
@property<EOL><INDENT>def url(self):<DEDENT>
return self._url<EOL>
Gets the url of this GifImagesFixedHeightSmall. The publicly-accessible direct URL for this GIF. :return: The url of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m1
@url.setter<EOL><INDENT>def url(self, url):<DEDENT>
self._url = url<EOL>
Sets the url of this GifImagesFixedHeightSmall. The publicly-accessible direct URL for this GIF. :param url: The url of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m2
@property<EOL><INDENT>def width(self):<DEDENT>
return self._width<EOL>
Gets the width of this GifImagesFixedHeightSmall. The width of this GIF in pixels. :return: The width of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m3
@width.setter<EOL><INDENT>def width(self, width):<DEDENT>
self._width = width<EOL>
Sets the width of this GifImagesFixedHeightSmall. The width of this GIF in pixels. :param width: The width of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m4
@property<EOL><INDENT>def height(self):<DEDENT>
return self._height<EOL>
Gets the height of this GifImagesFixedHeightSmall. The height of this GIF in pixels. :return: The height of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m5
@height.setter<EOL><INDENT>def height(self, height):<DEDENT>
self._height = height<EOL>
Sets the height of this GifImagesFixedHeightSmall. The height of this GIF in pixels. :param height: The height of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m6
@property<EOL><INDENT>def size(self):<DEDENT>
return self._size<EOL>
Gets the size of this GifImagesFixedHeightSmall. The size of this GIF in bytes. :return: The size of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m7
@size.setter<EOL><INDENT>def size(self, size):<DEDENT>
self._size = size<EOL>
Sets the size of this GifImagesFixedHeightSmall. The size of this GIF in bytes. :param size: The size of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m8
@property<EOL><INDENT>def mp4(self):<DEDENT>
return self._mp4<EOL>
Gets the mp4 of this GifImagesFixedHeightSmall. The URL for this GIF in .MP4 format. :return: The mp4 of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m9
@mp4.setter<EOL><INDENT>def mp4(self, mp4):<DEDENT>
self._mp4 = mp4<EOL>
Sets the mp4 of this GifImagesFixedHeightSmall. The URL for this GIF in .MP4 format. :param mp4: The mp4 of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m10
@property<EOL><INDENT>def mp4_size(self):<DEDENT>
return self._mp4_size<EOL>
Gets the mp4_size of this GifImagesFixedHeightSmall. The size in bytes of the .MP4 file corresponding to this GIF. :return: The mp4_size of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m11
@mp4_size.setter<EOL><INDENT>def mp4_size(self, mp4_size):<DEDENT>
self._mp4_size = mp4_size<EOL>
Sets the mp4_size of this GifImagesFixedHeightSmall. The size in bytes of the .MP4 file corresponding to this GIF. :param mp4_size: The mp4_size of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m12
@property<EOL><INDENT>def webp(self):<DEDENT>
return self._webp<EOL>
Gets the webp of this GifImagesFixedHeightSmall. The URL for this GIF in .webp format. :return: The webp of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m13
@webp.setter<EOL><INDENT>def webp(self, webp):<DEDENT>
self._webp = webp<EOL>
Sets the webp of this GifImagesFixedHeightSmall. The URL for this GIF in .webp format. :param webp: The webp of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m14
@property<EOL><INDENT>def webp_size(self):<DEDENT>
return self._webp_size<EOL>
Gets the webp_size of this GifImagesFixedHeightSmall. The size in bytes of the .webp file corresponding to this GIF. :return: The webp_size of this GifImagesFixedHeightSmall. :rtype: str
f3081:c0:m15
@webp_size.setter<EOL><INDENT>def webp_size(self, webp_size):<DEDENT>
self._webp_size = webp_size<EOL>
Sets the webp_size of this GifImagesFixedHeightSmall. The size in bytes of the .webp file corresponding to this GIF. :param webp_size: The webp_size of this GifImagesFixedHeightSmall. :type: str
f3081:c0:m16
def to_dict(self):
result = {}<EOL>for attr, _ in iteritems(self.swagger_types):<EOL><INDENT>value = getattr(self, attr)<EOL>if isinstance(value, list):<EOL><INDENT>result[attr] = list(map(<EOL>lambda x: x.to_dict() if hasattr(x, "<STR_LIT>") else x,<EOL>value<EOL>))<EOL><DEDENT>elif hasattr(value, "<STR_LIT>"):<EOL><INDENT>result[attr] = value.to_dict()<EOL><DEDENT>elif isinstance(value, dict):<EOL><INDENT>result[attr] = dict(map(<EOL>lambda item: (item[<NUM_LIT:0>], item[<NUM_LIT:1>].to_dict())<EOL>if hasattr(item[<NUM_LIT:1>], "<STR_LIT>") else item,<EOL>value.items()<EOL>))<EOL><DEDENT>else:<EOL><INDENT>result[attr] = value<EOL><DEDENT><DEDENT>return result<EOL>
Returns the model properties as a dict
f3081:c0:m17
def to_str(self):
return pformat(self.to_dict())<EOL>
Returns the string representation of the model
f3081:c0:m18
def __repr__(self):
return self.to_str()<EOL>
For `print` and `pprint`
f3081:c0:m19
def __eq__(self, other):
if not isinstance(other, GifImagesFixedHeightSmall):<EOL><INDENT>return False<EOL><DEDENT>return self.__dict__ == other.__dict__<EOL>
Returns true if both objects are equal
f3081:c0:m20
def __ne__(self, other):
return not self == other<EOL>
Returns true if both objects are not equal
f3081:c0:m21
def __init__(self, name=None, gif=None):
self.swagger_types = {<EOL>'<STR_LIT:name>': '<STR_LIT:str>',<EOL>'<STR_LIT>': '<STR_LIT>'<EOL>}<EOL>self.attribute_map = {<EOL>'<STR_LIT:name>': '<STR_LIT:name>',<EOL>'<STR_LIT>': '<STR_LIT>'<EOL>}<EOL>self._name = name<EOL>self._gif = gif<EOL>
Tag - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
f3082:c0:m0
@property<EOL><INDENT>def name(self):<DEDENT>
return self._name<EOL>
Gets the name of this Tag. Category name :return: The name of this Tag. :rtype: str
f3082:c0:m1
@name.setter<EOL><INDENT>def name(self, name):<DEDENT>
self._name = name<EOL>
Sets the name of this Tag. Category name :param name: The name of this Tag. :type: str
f3082:c0:m2
@property<EOL><INDENT>def gif(self):<DEDENT>
return self._gif<EOL>
Gets the gif of this Tag. A gif which can be used as the icon for this category. :return: The gif of this Tag. :rtype: Gif
f3082:c0:m3
@gif.setter<EOL><INDENT>def gif(self, gif):<DEDENT>
self._gif = gif<EOL>
Sets the gif of this Tag. A gif which can be used as the icon for this category. :param gif: The gif of this Tag. :type: Gif
f3082:c0:m4
def to_dict(self):
result = {}<EOL>for attr, _ in iteritems(self.swagger_types):<EOL><INDENT>value = getattr(self, attr)<EOL>if isinstance(value, list):<EOL><INDENT>result[attr] = list(map(<EOL>lambda x: x.to_dict() if hasattr(x, "<STR_LIT>") else x,<EOL>value<EOL>))<EOL><DEDENT>elif hasattr(value, "<STR_LIT>"):<EOL><INDENT>result[attr] = value.to_dict()<EOL><DEDENT>elif isinstance(value, dict):<EOL><INDENT>result[attr] = dict(map(<EOL>lambda item: (item[<NUM_LIT:0>], item[<NUM_LIT:1>].to_dict())<EOL>if hasattr(item[<NUM_LIT:1>], "<STR_LIT>") else item,<EOL>value.items()<EOL>))<EOL><DEDENT>else:<EOL><INDENT>result[attr] = value<EOL><DEDENT><DEDENT>return result<EOL>
Returns the model properties as a dict
f3082:c0:m5
def to_str(self):
return pformat(self.to_dict())<EOL>
Returns the string representation of the model
f3082:c0:m6
def __repr__(self):
return self.to_str()<EOL>
For `print` and `pprint`
f3082:c0:m7
def __eq__(self, other):
if not isinstance(other, Tag):<EOL><INDENT>return False<EOL><DEDENT>return self.__dict__ == other.__dict__<EOL>
Returns true if both objects are equal
f3082:c0:m8
def __ne__(self, other):
return not self == other<EOL>
Returns true if both objects are not equal
f3082:c0:m9
def __init__(self):
<EOL>self.host = "<STR_LIT>"<EOL>self.api_client = None<EOL>self.temp_folder_path = None<EOL>self.api_key = {}<EOL>self.api_key_prefix = {}<EOL>self.username = "<STR_LIT>"<EOL>self.password = "<STR_LIT>"<EOL>self.logger = {}<EOL>self.logger["<STR_LIT>"] = logging.getLogger("<STR_LIT>")<EOL>self.logger["<STR_LIT>"] = logging.getLogger("<STR_LIT>")<EOL>self.logger_format = '<STR_LIT>'<EOL>self.logger_stream_handler = None<EOL>self.logger_file_handler = None<EOL>self.logger_file = None<EOL>self.debug = False<EOL>self.verify_ssl = True<EOL>self.ssl_ca_cert = None<EOL>self.cert_file = None<EOL>self.key_file = None<EOL>
Constructor
f3083:c0:m0
@property<EOL><INDENT>def logger_file(self):<DEDENT>
return self.__logger_file<EOL>
Gets the logger_file.
f3083:c0:m1
@logger_file.setter<EOL><INDENT>def logger_file(self, value):<DEDENT>
self.__logger_file = value<EOL>if self.__logger_file:<EOL><INDENT>self.logger_file_handler = logging.FileHandler(self.__logger_file)<EOL>self.logger_file_handler.setFormatter(self.logger_formatter)<EOL>for _, logger in iteritems(self.logger):<EOL><INDENT>logger.addHandler(self.logger_file_handler)<EOL>if self.logger_stream_handler:<EOL><INDENT>logger.removeHandler(self.logger_stream_handler)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>self.logger_stream_handler = logging.StreamHandler()<EOL>self.logger_stream_handler.setFormatter(self.logger_formatter)<EOL>for _, logger in iteritems(self.logger):<EOL><INDENT>logger.addHandler(self.logger_stream_handler)<EOL>if self.logger_file_handler:<EOL><INDENT>logger.removeHandler(self.logger_file_handler)<EOL><DEDENT><DEDENT><DEDENT>
Sets the logger_file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str
f3083:c0:m2
@property<EOL><INDENT>def debug(self):<DEDENT>
return self.__debug<EOL>
Gets the debug status.
f3083:c0:m3
@debug.setter<EOL><INDENT>def debug(self, value):<DEDENT>
self.__debug = value<EOL>if self.__debug:<EOL><INDENT>for _, logger in iteritems(self.logger):<EOL><INDENT>logger.setLevel(logging.DEBUG)<EOL><DEDENT>httplib.HTTPConnection.debuglevel = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>for _, logger in iteritems(self.logger):<EOL><INDENT>logger.setLevel(logging.WARNING)<EOL><DEDENT>httplib.HTTPConnection.debuglevel = <NUM_LIT:0><EOL><DEDENT>
Sets the debug status. :param value: The debug status, True or False. :type: bool
f3083:c0:m4
@property<EOL><INDENT>def logger_format(self):<DEDENT>
return self.__logger_format<EOL>
Gets the logger_format.
f3083:c0:m5
@logger_format.setter<EOL><INDENT>def logger_format(self, value):<DEDENT>
self.__logger_format = value<EOL>self.logger_formatter = logging.Formatter(self.__logger_format)<EOL>
Sets the logger_format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str
f3083:c0:m6
def get_api_key_with_prefix(self, identifier):
if self.api_key.get(identifier) and self.api_key_prefix.get(identifier):<EOL><INDENT>return self.api_key_prefix[identifier] + '<STR_LIT:U+0020>' + self.api_key[identifier]<EOL><DEDENT>elif self.api_key.get(identifier):<EOL><INDENT>return self.api_key[identifier]<EOL><DEDENT>
Gets API key (with prefix if set). :param identifier: The identifier of apiKey. :return: The token for api key authentication.
f3083:c0:m7
def get_basic_auth_token(self):
return urllib3.util.make_headers(basic_auth=self.username + '<STR_LIT::>' + self.password).get('<STR_LIT>')<EOL>
Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication.
f3083:c0:m8
def auth_settings(self):
return {<EOL>}<EOL>
Gets Auth Settings dict for api client. :return: The Auth Settings information dict.
f3083:c0:m9
def to_debug_report(self):
return "<STR_LIT>""<STR_LIT>""<STR_LIT>""<STR_LIT>""<STR_LIT>".format(env=sys.platform, pyversion=sys.version)<EOL>
Gets the essential information for debugging. :return: The report for debugging.
f3083:c0:m10
def gifs_categories_category_get(self, api_key, category, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_categories_category_get_with_http_info(api_key, category, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_categories_category_get_with_http_info(api_key, category, **kwargs)<EOL>return data<EOL><DEDENT>
Category Tags Endpoint. Returns a list of tags for a given category. NOTE `limit` and `offset` must both be set; otherwise they're ignored. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_categories_category_get(api_key, category, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str category: Filters results by category. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :return: InlineResponse2004 If the method is called asynchronously, returns the request thread.
f3085:c0:m1
def gifs_categories_category_get_with_http_info(self, api_key, category, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>path_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Category Tags Endpoint. Returns a list of tags for a given category. NOTE `limit` and `offset` must both be set; otherwise they're ignored. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_categories_category_get_with_http_info(api_key, category, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str category: Filters results by category. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :return: InlineResponse2004 If the method is called asynchronously, returns the request thread.
f3085:c0:m2
def gifs_categories_category_tag_get(self, api_key, category, tag, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_categories_category_tag_get_with_http_info(api_key, category, tag, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_categories_category_tag_get_with_http_info(api_key, category, tag, **kwargs)<EOL>return data<EOL><DEDENT>
Tagged Gifs Endpoint. Returns a list of gifs for a given tag (alias to `/gif/search`). This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_categories_category_tag_get(api_key, category, tag, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str category: Filters results by category. (required) :param str tag: Filters results by tag. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :return: InlineResponse2005 If the method is called asynchronously, returns the request thread.
f3085:c0:m3
def gifs_categories_category_tag_get_with_http_info(self, api_key, category, tag, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>path_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>path_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Tagged Gifs Endpoint. Returns a list of gifs for a given tag (alias to `/gif/search`). This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_categories_category_tag_get_with_http_info(api_key, category, tag, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str category: Filters results by category. (required) :param str tag: Filters results by tag. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :return: InlineResponse2005 If the method is called asynchronously, returns the request thread.
f3085:c0:m4
def gifs_categories_get(self, api_key, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_categories_get_with_http_info(api_key, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_categories_get_with_http_info(api_key, **kwargs)<EOL>return data<EOL><DEDENT>
Categories Endpoint. Returns a list of categories. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_categories_get(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param int limit: The maximum number of records to return. :return: InlineResponse2003 If the method is called asynchronously, returns the request thread.
f3085:c0:m5
def gifs_categories_get_with_http_info(self, api_key, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Categories Endpoint. Returns a list of categories. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_categories_get_with_http_info(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param int limit: The maximum number of records to return. :return: InlineResponse2003 If the method is called asynchronously, returns the request thread.
f3085:c0:m6
def gifs_get(self, api_key, ids, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_get_with_http_info(api_key, ids, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_get_with_http_info(api_key, ids, **kwargs)<EOL>return data<EOL><DEDENT>
Get GIFs by ID Endpoint A multiget version of the get GIF by ID endpoint. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_get(api_key, ids, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str ids: Filters results by specified GIF IDs, separated by commas. (required) :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m7
def gifs_get_with_http_info(self, api_key, ids, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Get GIFs by ID Endpoint A multiget version of the get GIF by ID endpoint. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_get_with_http_info(api_key, ids, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str ids: Filters results by specified GIF IDs, separated by commas. (required) :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m8
def gifs_gif_id_get(self, api_key, gif_id, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_gif_id_get_with_http_info(api_key, gif_id, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_gif_id_get_with_http_info(api_key, gif_id, **kwargs)<EOL>return data<EOL><DEDENT>
Get GIF by ID Endpoint Returns a GIF given that GIF's unique ID This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_gif_id_get(api_key, gif_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str gif_id: Filters results by specified GIF ID. (required) :return: InlineResponse2001 If the method is called asynchronously, returns the request thread.
f3085:c0:m9
def gifs_gif_id_get_with_http_info(self, api_key, gif_id, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>path_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Get GIF by ID Endpoint Returns a GIF given that GIF's unique ID This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_gif_id_get_with_http_info(api_key, gif_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str gif_id: Filters results by specified GIF ID. (required) :return: InlineResponse2001 If the method is called asynchronously, returns the request thread.
f3085:c0:m10
def gifs_random_get(self, api_key, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_random_get_with_http_info(api_key, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_random_get_with_http_info(api_key, **kwargs)<EOL>return data<EOL><DEDENT>
Random Endpoint Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_random_get(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str tag: Filters results by specified tag. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse2002 If the method is called asynchronously, returns the request thread.
f3085:c0:m11
def gifs_random_get_with_http_info(self, api_key, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Random Endpoint Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_random_get_with_http_info(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str tag: Filters results by specified tag. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse2002 If the method is called asynchronously, returns the request thread.
f3085:c0:m12
def gifs_search_get(self, api_key, q, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_search_get_with_http_info(api_key, q, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_search_get_with_http_info(api_key, q, **kwargs)<EOL>return data<EOL><DEDENT>
Search Endpoint Search all Giphy GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_search_get(api_key, q, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str q: Search query term or prhase. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :param str rating: Filters results by specified rating. :param str lang: Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m13
def gifs_search_get_with_http_info(self, api_key, q, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT:q>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT:q>' not in params) or (params['<STR_LIT:q>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:q>' in params:<EOL><INDENT>query_params['<STR_LIT:q>'] = params['<STR_LIT:q>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Search Endpoint Search all Giphy GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_search_get_with_http_info(api_key, q, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str q: Search query term or prhase. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :param str rating: Filters results by specified rating. :param str lang: Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m14
def gifs_translate_get(self, api_key, s, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_translate_get_with_http_info(api_key, s, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_translate_get_with_http_info(api_key, s, **kwargs)<EOL>return data<EOL><DEDENT>
Translate Endpoint The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_translate_get(api_key, s, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str s: Search term. (required) :return: InlineResponse2001 If the method is called asynchronously, returns the request thread.
f3085:c0:m15
def gifs_translate_get_with_http_info(self, api_key, s, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT:s>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT:s>' not in params) or (params['<STR_LIT:s>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:s>' in params:<EOL><INDENT>query_params['<STR_LIT:s>'] = params['<STR_LIT:s>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Translate Endpoint The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_translate_get_with_http_info(api_key, s, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str s: Search term. (required) :return: InlineResponse2001 If the method is called asynchronously, returns the request thread.
f3085:c0:m16
def gifs_trending_get(self, api_key, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.gifs_trending_get_with_http_info(api_key, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.gifs_trending_get_with_http_info(api_key, **kwargs)<EOL>return data<EOL><DEDENT>
Trending GIFs Endpoint Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_trending_get(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param int limit: The maximum number of records to return. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m17
def gifs_trending_get_with_http_info(self, api_key, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Trending GIFs Endpoint Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.gifs_trending_get_with_http_info(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param int limit: The maximum number of records to return. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m18
def stickers_random_get(self, api_key, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.stickers_random_get_with_http_info(api_key, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.stickers_random_get_with_http_info(api_key, **kwargs)<EOL>return data<EOL><DEDENT>
Random Sticker Endpoint Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_random_get(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str tag: Filters results by specified tag. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse2002 If the method is called asynchronously, returns the request thread.
f3085:c0:m19
def stickers_random_get_with_http_info(self, api_key, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Random Sticker Endpoint Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_random_get_with_http_info(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str tag: Filters results by specified tag. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse2002 If the method is called asynchronously, returns the request thread.
f3085:c0:m20
def stickers_search_get(self, api_key, q, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.stickers_search_get_with_http_info(api_key, q, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.stickers_search_get_with_http_info(api_key, q, **kwargs)<EOL>return data<EOL><DEDENT>
Sticker Search Endpoint Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_search_get(api_key, q, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str q: Search query term or prhase. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :param str rating: Filters results by specified rating. :param str lang: Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m21
def stickers_search_get_with_http_info(self, api_key, q, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT:q>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT:q>' not in params) or (params['<STR_LIT:q>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:q>' in params:<EOL><INDENT>query_params['<STR_LIT:q>'] = params['<STR_LIT:q>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Sticker Search Endpoint Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_search_get_with_http_info(api_key, q, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str q: Search query term or prhase. (required) :param int limit: The maximum number of records to return. :param int offset: An optional results offset. Defaults to 0. :param str rating: Filters results by specified rating. :param str lang: Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m22
def stickers_translate_get(self, api_key, s, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.stickers_translate_get_with_http_info(api_key, s, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.stickers_translate_get_with_http_info(api_key, s, **kwargs)<EOL>return data<EOL><DEDENT>
Sticker Translate Endpoint The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_translate_get(api_key, s, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str s: Search term. (required) :return: InlineResponse2001 If the method is called asynchronously, returns the request thread.
f3085:c0:m23
def stickers_translate_get_with_http_info(self, api_key, s, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT:s>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ('<STR_LIT:s>' not in params) or (params['<STR_LIT:s>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:s>' in params:<EOL><INDENT>query_params['<STR_LIT:s>'] = params['<STR_LIT:s>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Sticker Translate Endpoint The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_translate_get_with_http_info(api_key, s, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param str s: Search term. (required) :return: InlineResponse2001 If the method is called asynchronously, returns the request thread.
f3085:c0:m24
def stickers_trending_get(self, api_key, **kwargs):
kwargs['<STR_LIT>'] = True<EOL>if kwargs.get('<STR_LIT>'):<EOL><INDENT>return self.stickers_trending_get_with_http_info(api_key, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>(data) = self.stickers_trending_get_with_http_info(api_key, **kwargs)<EOL>return data<EOL><DEDENT>
Trending Stickers Endpoint Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_trending_get(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param int limit: The maximum number of records to return. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m25
def stickers_trending_get_with_http_info(self, api_key, **kwargs):
all_params = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>all_params.append('<STR_LIT>')<EOL>params = locals()<EOL>for key, val in iteritems(params['<STR_LIT>']):<EOL><INDENT>if key not in all_params:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % key<EOL>)<EOL><DEDENT>params[key] = val<EOL><DEDENT>del params['<STR_LIT>']<EOL>if ('<STR_LIT>' not in params) or (params['<STR_LIT>'] is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' in params and params['<STR_LIT>'] < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>collection_formats = {}<EOL>resource_path = '<STR_LIT>'.replace('<STR_LIT>', '<STR_LIT>')<EOL>path_params = {}<EOL>query_params = {}<EOL>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>query_params['<STR_LIT>'] = params['<STR_LIT>']<EOL><DEDENT>header_params = {}<EOL>form_params = []<EOL>local_var_files = {}<EOL>body_params = None<EOL>header_params['<STR_LIT>'] = self.api_client.select_header_accept(['<STR_LIT:application/json>'])<EOL>header_params['<STR_LIT:Content-Type>'] = self.api_client.select_header_content_type(['<STR_LIT:application/json>'])<EOL>auth_settings = []<EOL>return self.api_client.call_api(resource_path, '<STR_LIT:GET>',<EOL>path_params,<EOL>query_params,<EOL>header_params,<EOL>body=body_params,<EOL>post_params=form_params,<EOL>files=local_var_files,<EOL>response_type='<STR_LIT>',<EOL>auth_settings=auth_settings,<EOL>callback=params.get('<STR_LIT>'),<EOL>_return_http_data_only=params.get('<STR_LIT>'),<EOL>_preload_content=params.get('<STR_LIT>', True),<EOL>_request_timeout=params.get('<STR_LIT>'),<EOL>collection_formats=collection_formats)<EOL>
Trending Stickers Endpoint Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.stickers_trending_get_with_http_info(api_key, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str api_key: Giphy API Key. (required) :param int limit: The maximum number of records to return. :param str rating: Filters results by specified rating. :param str fmt: Used to indicate the expected response format. Default is Json. :return: InlineResponse200 If the method is called asynchronously, returns the request thread.
f3085:c0:m26
def flatten(value, key="<STR_LIT>", sep="<STR_LIT:.>"):
def unhandled_type():<EOL><INDENT>raise Exception("<STR_LIT>" + str(type(value)))<EOL><DEDENT>return (<EOL>({<EOL>str: lambda: [(key, value)],<EOL>unicode: lambda: [(key, value)],<EOL>int: lambda: [(key, value)],<EOL>float: lambda: [(key, value)],<EOL>NoneType: lambda: [(key, value)],<EOL>bool: lambda: [(key, value)],<EOL>list:<EOL>lambda: [<EOL>item<EOL>for sublist in [<EOL>flatten(v, key="<STR_LIT>")<EOL>for v in value<EOL>]<EOL>for item in sublist<EOL>],<EOL>dict:<EOL>lambda: [<EOL>item<EOL>for sublist in [<EOL>flatten(v, key="<STR_LIT:.>".join([key, k]))<EOL>for k,v in value.items()<EOL>]<EOL>for item in sublist<EOL>],<EOL>}).get(type(value), unhandled_type)()<EOL>)<EOL>
Flattens potentially nested dictionaries into a single flat list of key/value pairs. Similiar to dict.items() except it works for nested dictionaries, and all keys start with ".".
f3087:m0
def _validate(self, obj):
exclude_keys = [<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>]<EOL>items = flatten(obj.to_dict() if (type(obj) is not dict) else obj)<EOL>for key, value in items:<EOL><INDENT>if (key not in exclude_keys) and (value is None):<EOL><INDENT>raise AssertionError("<STR_LIT>" % key, json.dumps(obj, default=lambda _: _.to_dict()))<EOL><DEDENT><DEDENT>
Looks through every key in every object to check for null values. If a null value is found where it shouldn't be we raise an exception and the test fails. Keys included in `exclude_keys` are ignored, meaning they may be null.
f3087:c0:m2
def main(argv=None):
if argv is None:<EOL><INDENT>argv = sys.argv[<NUM_LIT:1>:]<EOL><DEDENT>usage = '<STR_LIT>'.join(__doc__.split('<STR_LIT>')[<NUM_LIT:1>:])<EOL>version = '<STR_LIT>' + __version__<EOL>args = docopt(usage, argv=argv, version=version)<EOL>return watch(args['<STR_LIT>'], args['<STR_LIT>'])<EOL>
The entry point of the application.
f3090:m0
def watch(directory=None, auto_clear=False, extensions=[]):
if directory and not os.path.isdir(directory):<EOL><INDENT>raise ValueError('<STR_LIT>' + directory)<EOL><DEDENT>directory = os.path.abspath(directory)<EOL>event_handler = ChangeHandler(directory, auto_clear, extensions)<EOL>event_handler.run()<EOL>observer = Observer()<EOL>observer.schedule(event_handler, path=directory, recursive=True)<EOL>observer.start()<EOL>try:<EOL><INDENT>while True:<EOL><INDENT>time.sleep(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>observer.stop()<EOL><DEDENT>observer.join()<EOL>
Starts a server to render the specified file or directory containing a README.
f3092:m0
def run(self):
if self.auto_clear:<EOL><INDENT>os.system('<STR_LIT>' if os.name == '<STR_LIT>' else '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>print()<EOL><DEDENT>print('<STR_LIT>')<EOL>if self.auto_clear:<EOL><INDENT>print()<EOL><DEDENT>subprocess.call('<STR_LIT>', cwd=self.directory)<EOL>
Called when a file is changed to re-run the tests with nose.
f3092:c0:m2
def __init__(self, rect=None, caption='<STR_LIT>', bgcolor=LIGHTGRAY, fgcolor=BLACK, font=None, normal=None, down=None, highlight=None):
if rect is None:<EOL><INDENT>self._rect = pygame.Rect(<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:30>, <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>self._rect = pygame.Rect(rect)<EOL><DEDENT>self._caption = caption<EOL>self._bgcolor = bgcolor<EOL>self._fgcolor = fgcolor<EOL>if font is None:<EOL><INDENT>self._font = PYGBUTTON_FONT<EOL><DEDENT>else:<EOL><INDENT>self._font = font<EOL><DEDENT>self.buttonDown = False <EOL>self.mouseOverButton = False <EOL>self.lastMouseDownOverButton = False <EOL>self._visible = True <EOL>self.customSurfaces = False <EOL>if normal is None:<EOL><INDENT>self.surfaceNormal = pygame.Surface(self._rect.size)<EOL>self.surfaceDown = pygame.Surface(self._rect.size)<EOL>self.surfaceHighlight = pygame.Surface(self._rect.size)<EOL>self._update() <EOL><DEDENT>else:<EOL><INDENT>self.setSurfaces(normal, down, highlight)<EOL><DEDENT>
Create a new button object. Parameters: rect - The size and position of the button as a pygame.Rect object or 4-tuple of integers. caption - The text on the button (default is blank) bgcolor - The background color of the button (default is a light gray color) fgcolor - The foreground color (i.e. the color of the text). Default is black. font - The pygame.font.Font object for the font of the text. Default is freesansbold in point 14. normal - A pygame.Surface object for the button's normal appearance. down - A pygame.Surface object for the button's pushed down appearance. highlight - A pygame.Surface object for the button's appearance when the mouse is over it. If the Surface objects are used, then the caption, bgcolor, fgcolor, and font parameters are ignored (and vice versa). Specifying the Surface objects lets the user use a custom image for the button. The normal, down, and highlight Surface objects must all be the same size as each other. Only the normal Surface object needs to be specified. The others, if left out, will default to the normal surface.
f3098:c0:m0
def handleEvent(self, eventObj):
if eventObj.type not in (MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN) or not self._visible:<EOL><INDENT>return []<EOL><DEDENT>retVal = []<EOL>hasExited = False<EOL>if not self.mouseOverButton and self._rect.collidepoint(eventObj.pos):<EOL><INDENT>self.mouseOverButton = True<EOL>self.mouseEnter(eventObj)<EOL>retVal.append('<STR_LIT>')<EOL><DEDENT>elif self.mouseOverButton and not self._rect.collidepoint(eventObj.pos):<EOL><INDENT>self.mouseOverButton = False<EOL>hasExited = True <EOL><DEDENT>if self._rect.collidepoint(eventObj.pos):<EOL><INDENT>if eventObj.type == MOUSEMOTION:<EOL><INDENT>self.mouseMove(eventObj)<EOL>retVal.append('<STR_LIT>')<EOL><DEDENT>elif eventObj.type == MOUSEBUTTONDOWN:<EOL><INDENT>self.buttonDown = True<EOL>self.lastMouseDownOverButton = True<EOL>self.mouseDown(eventObj)<EOL>retVal.append('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if eventObj.type in (MOUSEBUTTONUP, MOUSEBUTTONDOWN):<EOL><INDENT>self.lastMouseDownOverButton = False<EOL><DEDENT><DEDENT>doMouseClick = False<EOL>if eventObj.type == MOUSEBUTTONUP:<EOL><INDENT>if self.lastMouseDownOverButton:<EOL><INDENT>doMouseClick = True<EOL><DEDENT>self.lastMouseDownOverButton = False<EOL>if self.buttonDown:<EOL><INDENT>self.buttonDown = False<EOL>self.mouseUp(eventObj)<EOL>retVal.append('<STR_LIT>')<EOL><DEDENT>if doMouseClick:<EOL><INDENT>self.buttonDown = False<EOL>self.mouseClick(eventObj)<EOL>retVal.append('<STR_LIT>')<EOL><DEDENT><DEDENT>if hasExited:<EOL><INDENT>self.mouseExit(eventObj)<EOL>retVal.append('<STR_LIT>')<EOL><DEDENT>return retVal<EOL>
All MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN event objects created by Pygame should be passed to this method. handleEvent() will detect if the event is relevant to this button and change its state. There are two ways that your code can respond to button-events. One is to inherit the PygButton class and override the mouse*() methods. The other is to have the caller of handleEvent() check the return value for the strings 'enter', 'move', 'down', 'up', 'click', or 'exit'. Note that mouseEnter() is always called before mouseMove(), and mouseMove() is always called before mouseExit(). Also, mouseUp() is always called before mouseClick(). buttonDown is always True when mouseDown() is called, and always False when mouseUp() or mouseClick() is called. lastMouseDownOverButton is always False when mouseUp() or mouseClick() is called.
f3098:c0:m1
def draw(self, surfaceObj):
if self._visible:<EOL><INDENT>if self.buttonDown:<EOL><INDENT>surfaceObj.blit(self.surfaceDown, self._rect)<EOL><DEDENT>elif self.mouseOverButton:<EOL><INDENT>surfaceObj.blit(self.surfaceHighlight, self._rect)<EOL><DEDENT>else:<EOL><INDENT>surfaceObj.blit(self.surfaceNormal, self._rect)<EOL><DEDENT><DEDENT>
Blit the current button's appearance to the surface object.
f3098:c0:m2
def _update(self):
if self.customSurfaces:<EOL><INDENT>self.surfaceNormal = pygame.transform.smoothscale(self.origSurfaceNormal, self._rect.size)<EOL>self.surfaceDown = pygame.transform.smoothscale(self.origSurfaceDown, self._rect.size)<EOL>self.surfaceHighlight = pygame.transform.smoothscale(self.origSurfaceHighlight, self._rect.size)<EOL>return<EOL><DEDENT>w = self._rect.width <EOL>h = self._rect.height <EOL>self.surfaceNormal.fill(self.bgcolor)<EOL>self.surfaceDown.fill(self.bgcolor)<EOL>self.surfaceHighlight.fill(self.bgcolor)<EOL>captionSurf = self._font.render(self._caption, True, self.fgcolor, self.bgcolor)<EOL>captionRect = captionSurf.get_rect()<EOL>captionRect.center = int(w / <NUM_LIT:2>), int(h / <NUM_LIT:2>)<EOL>self.surfaceNormal.blit(captionSurf, captionRect)<EOL>self.surfaceDown.blit(captionSurf, captionRect)<EOL>pygame.draw.rect(self.surfaceNormal, BLACK, pygame.Rect((<NUM_LIT:0>, <NUM_LIT:0>, w, h)), <NUM_LIT:1>) <EOL>pygame.draw.line(self.surfaceNormal, WHITE, (<NUM_LIT:1>, <NUM_LIT:1>), (w - <NUM_LIT:2>, <NUM_LIT:1>))<EOL>pygame.draw.line(self.surfaceNormal, WHITE, (<NUM_LIT:1>, <NUM_LIT:1>), (<NUM_LIT:1>, h - <NUM_LIT:2>))<EOL>pygame.draw.line(self.surfaceNormal, DARKGRAY, (<NUM_LIT:1>, h - <NUM_LIT:1>), (w - <NUM_LIT:1>, h - <NUM_LIT:1>))<EOL>pygame.draw.line(self.surfaceNormal, DARKGRAY, (w - <NUM_LIT:1>, <NUM_LIT:1>), (w - <NUM_LIT:1>, h - <NUM_LIT:1>))<EOL>pygame.draw.line(self.surfaceNormal, GRAY, (<NUM_LIT:2>, h - <NUM_LIT:2>), (w - <NUM_LIT:2>, h - <NUM_LIT:2>))<EOL>pygame.draw.line(self.surfaceNormal, GRAY, (w - <NUM_LIT:2>, <NUM_LIT:2>), (w - <NUM_LIT:2>, h - <NUM_LIT:2>))<EOL>pygame.draw.rect(self.surfaceDown, BLACK, pygame.Rect((<NUM_LIT:0>, <NUM_LIT:0>, w, h)), <NUM_LIT:1>) <EOL>pygame.draw.line(self.surfaceDown, WHITE, (<NUM_LIT:1>, <NUM_LIT:1>), (w - <NUM_LIT:2>, <NUM_LIT:1>))<EOL>pygame.draw.line(self.surfaceDown, WHITE, (<NUM_LIT:1>, <NUM_LIT:1>), (<NUM_LIT:1>, h - <NUM_LIT:2>))<EOL>pygame.draw.line(self.surfaceDown, DARKGRAY, (<NUM_LIT:1>, h - <NUM_LIT:2>), (<NUM_LIT:1>, <NUM_LIT:1>))<EOL>pygame.draw.line(self.surfaceDown, DARKGRAY, (<NUM_LIT:1>, <NUM_LIT:1>), (w - <NUM_LIT:2>, <NUM_LIT:1>))<EOL>pygame.draw.line(self.surfaceDown, GRAY, (<NUM_LIT:2>, h - <NUM_LIT:3>), (<NUM_LIT:2>, <NUM_LIT:2>))<EOL>pygame.draw.line(self.surfaceDown, GRAY, (<NUM_LIT:2>, <NUM_LIT:2>), (w - <NUM_LIT:3>, <NUM_LIT:2>))<EOL>self.surfaceHighlight = self.surfaceNormal<EOL>
Redraw the button's Surface object. Call this method when the button has changed appearance.
f3098:c0:m3
def setSurfaces(self, normalSurface, downSurface=None, highlightSurface=None):
if downSurface is None:<EOL><INDENT>downSurface = normalSurface<EOL><DEDENT>if highlightSurface is None:<EOL><INDENT>highlightSurface = normalSurface<EOL><DEDENT>if type(normalSurface) == str:<EOL><INDENT>self.origSurfaceNormal = pygame.image.load(normalSurface)<EOL><DEDENT>if type(downSurface) == str:<EOL><INDENT>self.origSurfaceDown = pygame.image.load(downSurface)<EOL><DEDENT>if type(highlightSurface) == str:<EOL><INDENT>self.origSurfaceHighlight = pygame.image.load(highlightSurface)<EOL><DEDENT>if self.origSurfaceNormal.get_size() != self.origSurfaceDown.get_size() != self.origSurfaceHighlight.get_size():<EOL><INDENT>raise Exception('<STR_LIT:foo>')<EOL><DEDENT>self.surfaceNormal = self.origSurfaceNormal<EOL>self.surfaceDown = self.origSurfaceDown<EOL>self.surfaceHighlight = self.origSurfaceHighlight<EOL>self.customSurfaces = True<EOL>self._rect = pygame.Rect((self._rect.left, self._rect.top, self.surfaceNormal.get_width(), self.surfaceNormal.get_height()))<EOL>
Switch the button to a custom image type of button (rather than a text button). You can specify either a pygame.Surface object or a string of a filename to load for each of the three button appearance states.
f3098:c0:m10
def __init__(self, func, on_collect=None):
self._ext_on_collect = on_collect<EOL>if hasattr(func, '<STR_LIT>'): <EOL><INDENT>self._func = weakref.ref(func.im_func)<EOL>self._obj = weakref.ref(func.im_self, self._on_collect)<EOL><DEDENT>else:<EOL><INDENT>self._func = weakref.ref(func, self._on_collect)<EOL>self._obj = None<EOL><DEDENT>
Both `on_func_collect` and `on_self_collect` should accept single parameter that will be instance of :class:`.WeakCallable` that died. :param callable func: Methods to create weak reference for. :param callable on_collect: Callable that will be called when function is garbage collected.
f3100:c1:m0
@classmethod<EOL><INDENT>def instance(cls, interval=<NUM_LIT:5>):<DEDENT>
if not cls._instance:<EOL><INDENT>cls._instance = _Messenger(interval)<EOL><DEDENT>return cls._instance<EOL>
Returns existing instance of messenger. If one does not exist it will be created and returned. :param int interval: Number of miliseconds that represents interval when messages will be processed. Note that this parameter will be used only the first time when instance is requested, every other time it will be ignored because existing instance of :class:`._Messenger` is returned.
f3100:c2:m0
def __init__(self, interval=<NUM_LIT:5>):
self._subscribers = defaultdict(list)<EOL>self._messages = Queue()<EOL>self._lock = Lock()<EOL>self._timer = DispatcherTimer()<EOL>self._timer.Interval = TimeSpan.FromMilliseconds(<NUM_LIT:5>)<EOL>self._timer.Tick += self._execute<EOL>self._timer.Start()<EOL>
:param int interval: Number of milliseconds that represents interval when messages will be processed.
f3100:c2:m1
def send(self, message, *args, **kwargs):
self._messages.put((message, args, kwargs), False)<EOL>
Sends provided message to all listeners. Message is only added to queue and will be processed on next tick. :param Message message: Message to send.
f3100:c2:m2
def subscribe(self, message, handler):
with self._lock:<EOL><INDENT>ref = WeakCallable(handler, self._on_collect)<EOL>self._subscribers[message].append(ref)<EOL><DEDENT>
Adds hander for specified message. :param str message: Name of message to subscribe to. :param callable handler: Handler for this message type. Handler must receive single parameter and that parameter will be instance of sent message.
f3100:c2:m3
def unsubscribe(self, message, handler):
with self._lock:<EOL><INDENT>self._subscribers[message].remove(WeakCallable(handler))<EOL><DEDENT>
Removes handler from message listeners. :param str message: Name of message to unsubscribe handler from. :param callable handler: Callable that should be removed as handler for `message`.
f3100:c2:m4
def _execute(self, sender, event_args):
with self._lock:<EOL><INDENT>while not self._messages.empty():<EOL><INDENT>msg, args, kwargs = self._messages.get(False)<EOL>for subscriber in self._subscribers[msg]:<EOL><INDENT>try:<EOL><INDENT>subscriber(*args, **kwargs)<EOL><DEDENT>except weakref.ReferenceError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Event handler for timer that processes all queued messages.
f3100:c2:m5
def __init__(self, name=None):
self._messanger = _Messenger.instance()<EOL>
:param str name: Name of signal, for easier debuging. If not provided name of property to which signal is assigned to will be used if signal is creates in :class:`.ViewModel` class.
f3100:c3:m0
def connect(self, handler):
self._messanger.subscribe(self, handler)<EOL>
Connects handler to this signal.
f3100:c3:m1
def disconnect(self, handler):
self._messanger.unsubscribe(self, handler)<EOL>
Disconnects handler from this singal.
f3100:c3:m2
def emit(self, *args, **kwargs):
self._messanger.send(self, *args, **kwargs)<EOL>
Emits this signal. As result, all handlers will be invoked.
f3100:c3:m3