pyowm.commons package

Submodules

pyowm.commons.databoxes module

class pyowm.commons.databoxes.ImageType(name, mime_type)[source]

Bases: object

Databox class representing an image type

Parameters:
  • name (str) – the image type name
  • mime_type (str) – the image type MIME type
class pyowm.commons.databoxes.Satellite(name, symbol)[source]

Bases: object

Databox class representing a satellite

Parameters:
  • name (str) – the satellite
  • symbol (str) – the short name of the satellite

pyowm.commons.enums module

class pyowm.commons.enums.ImageTypeEnum[source]

Bases: object

Allowed image types on OWM APIs

GEOTIFF = <pyowm.commons.databoxes.ImageType - name=GEOTIFF mime=image/tiff>
PNG = <pyowm.commons.databoxes.ImageType - name=PNG mime=image/png>
classmethod items()[source]

All values for this enum :return: list of pyowm.commons.enums.ImageType

classmethod lookup_by_mime_type(mime_type)[source]
classmethod lookup_by_name(name)[source]

pyowm.commons.frontlinkedlist module

Module containing class related to the implementation of linked-list data structure

class pyowm.commons.frontlinkedlist.FrontLinkedList[source]

Bases: pyowm.abstractions.linkedlist.LinkedList

Implementation of a linked-list data structure. Insertions are performed at the front of the list and so are O(1) while deletions take O(n) because they can be performed against any of the linked list’s elements. Each element in the list is a LinkedListNode instance; after instantiation, the list contains no elements.

Parameters:
  • first_node (LinkedListNode) – reference to the first LinkedListNode element in the list
  • last_node (LinkedListNode) – reference to the last LinkedListNode element in the list
add(data)[source]

Adds a new data node to the front list. The provided data will be encapsulated into a new instance of LinkedListNode class and linked list pointers will be updated, as well as list’s size.

Parameters:data (object) – the data to be inserted in the new list node
contains(data)[source]

Checks if the provided data is stored in at least one node of the list.

Parameters:data (object) – the seeked data
Returns:a boolean
first_node()[source]
index_of(data)[source]

Finds the position of a node in the list. The index of the first occurrence of the data is returned (indexes start at 0)

Parameters:data – data of the seeked node
Type:object
Returns:the int index or -1 if the node is not in the list
pop()[source]

Removes the last node from the list

remove(data)[source]

Removes a data node from the list. If the list contains more than one node having the same data that shall be removed, then the node having the first occurrency of the data is removed.

Parameters:data (object) – the data to be removed in the new list node
size()[source]

Returns the number of elements in the list

Returns:an int
class pyowm.commons.frontlinkedlist.FrontLinkedListIterator(obj)[source]

Bases: object

Iterator over the LinkedListNode elements of a LinkedList class instance. The implementation keeps a copy of the iterated list so avoid concurrency problems when iterating over it. This can nevertheless be memory-consuming when big lists have to be iterated over.

Parameters:obj (object) – the iterable object (LinkedList)
Returns:a FrontLinkedListIterator instance
next()[source]

Compatibility for Python 2.x, delegates to function: __next__() Returns the next Weather item

Returns:the next Weather item
class pyowm.commons.frontlinkedlist.LinkedListNode(data, next_node)[source]

Bases: object

Class representing an element of the LinkedList

Parameters:
  • data (object) – the actual data that this node holds
  • next (LinkedListNode) – reference to the next LinkedListNode instance in the list
data()[source]

Returns the data in this node

Returns:an object
next()[source]

Returns the next LinkedListNode in the list

Returns:a LinkedListNode instance
update_next(linked_list_node)[source]
Parameters:linked_list_node (LinkedListNode) – the new reference to the next LinkedListNode element

pyowm.commons.http_client module

pyowm.commons.image module

class pyowm.commons.image.Image(data, image_type=None)[source]

Bases: object

Wrapper class for a generic image

Parameters:
  • data (bytes) – raw image data
  • image_type (pyowm.commons.databoxes.ImageType or None) – the type of the image, if known
classmethod load(path_to_file)[source]

Loads the image data from a file on disk and tries to guess the image MIME type

Parameters:path_to_file (str) – path to the source file
Returns:a pyowm.image.Image instance
persist(path_to_file)[source]

Saves the image to disk on a file

Parameters:path_to_file (str) – path to the target file
Returns:None

pyowm.commons.tile module

Module contents