Skip to content

Commit

Permalink
added docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingfisch committed May 17, 2015
1 parent 00aad8f commit 1f83697
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions rest.py
@@ -1,24 +1,43 @@
#!/usr/bin/python3

"""
Using REST between Python blocks
"""
"""Classes for using REST inside Python programs"""

class CRUD:
"""Class with built-in CRUD functions."""

_objects = []

def create(self, object):
"""
Creates a new object.
Keyword arguments:
object -- Object or list of objects to create
"""
if type(object) == type([]):
self._objects.extend(object)
else:
self._objects.append(object)

def read(self):
"""Returns a list of created objects."""
return self._objects

def update(self, objectId, object):
"""
Updates object.
Keyword arguments:
objectId -- Key of object to update
object -- Object to update with
"""
self._objects[objectId] = object

def delete(self, objectId):
self._objects.pop(objectId)
"""
Deletes object from list.
Keyword arguments:
objectId -- Key of object to delete
"""
self._objects.pop(objectId)

0 comments on commit 1f83697

Please sign in to comment.