redish Documentation Release Ask Solem
|
|
- Marcia Hopkins
- 6 years ago
- Views:
Transcription
1 redish Documentation Release Ask Solem Sep 14, 2017
2
3 Contents 1 redish - Pythonic Redis abstraction built on top of redis-py Introduction The client Serializers Compression Working with keys and values Lists Dicts (Hashes) Sets Sorted sets redish.proxy Installation Accessing Redis via the Proxy object Basics Integer (or Counter) Dictionary List Set Sorted Set Proxy objects in general Keyspaces in proxy objects API Reference Database - redish.client Datatypes - redish.types Models - redish.models Proxy - redish.proxy Serialization - redish.serialization Utilities - redish.utils Change History [ :40 P.M CET] Indices and tables 25 Python Module Index 27 i
4 ii
5 Contents: Contents 1
6 2 Contents
7 CHAPTER 1 redish - Pythonic Redis abstraction built on top of redis-py Version Introduction The client A connection to a database is represented by the redish.client.client class: >>> from redish.client import Client >>> db = Client() >>> db = Client(host="localhost", port=6379, db="") # default settings. >>> db <RedisClient: localhost:6379/> Serializers Clients can be configured to automatically serialize and deserialize values. There are three serializers shipped with redish: Plain The plain serializer does not serialize values, but does still support compression using the encoding argument. Note that this means you can only store string values in keys. Example: >>> from redish import serialization >>> db = Client(serializer=serialization.Plain()) Pickler 3
8 Uses the pickle module to serialize Python objects. This can store any object except lambdas or objects not resolving back to a module. Example: >>> from redish import serialization >>> db = Client(serializer=serialization.Pickler()) JSON: Stores values in JSON format. This supports lists, dicts, strings, numbers, and floats. Complex Python objects can not be stored using JSON. The upside is that it is commonly supported by other languages and platforms. Example: >>> from redish import serialization >>> db = Client(serializer=serialization.JSON()) Compression In addition these serializers can also be configured to do compression: # Using zlib compression >>> db = Client(serializer=serialization.Pickler(encoding="zlib")) Working with keys and values Set a value: >>> db["foo"] = {"name": "George"} Get value by key: >>> db["foo"] {'name': 'George'} Delete key: >>> del(db["foo"]) Getting nonexistent values works like you would expect from Python dictionaries; It raises the KeyError exception: >>> db["foo"] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "redish/client.py", line 198, in getitem raise KeyError(key) KeyError: 'foo' Set many keys at the same time: >>> db.update({"name": "George Costanza",... "company": "Vandelay Industries"}) Get a list of keys in the database: 4 Chapter 1. redish - Pythonic Redis abstraction built on top of redis-py
9 >>> db.keys() ['company', 'name'] Get a list of keys matching a pattern: >>> db.keys(pattern="na*") ['name'] Rename keys: >>> db.rename("name", "user:name") >>> db.rename("company", "user:company") >>> db.keys("user:*") ['user:company', 'user:name'] Get all items in the database (optionally matching a pattern) as a list of (key, value) tuples: >>> db.items(pattern="user:*") [('user:company', 'Vandelay Industries'), ('user:name', 'George Costanza')] Get all values in the database (optionally where keys matches a pattern): >>> db.values(pattern="user:*") ['Vandelay Industries', 'George Costanza'] Iterator versions of keys, values and items are also available, as iterkeys, itervalues, iteritems respectively. Check for existence of a key in the database: >>> "user:name" in db True >>> "user:address" in db False >>> "user:address" not in db True Get and remove key from the database (atomic operation): >>> db.pop("user:name") 'George Costanza' >>> "user:name" in db False Get the number of keys present in the database: >>> len(db) 1 Lists Note: Lists does not currently support storing serialized objects. Create a new list with key mylist, and initial items: 1.5. Lists 5
10 >>> l = db.list("mylist", ["Jerry", "George"]) Get items in the list as a Python list: >>> list(l) ['Jerry', 'George'] append adds items to the end of the list: >>> l.append("kramer") >>> list(l) ['Jerry', 'George', 'Kramer'] appendleft prepends item to the head of the list: >>> l.appendleft("elaine") >>> list(l) ['Elaine', 'Jerry', George', 'Kramer'] Get item at index (zero based): >>> l[2] 'George' Check if a value is in the list using the in operator: >>> "George" in l True >>> "Soup-nazi" in l False pop removes and returns the last element of the list: >>> list(l) ['Elaine', 'Jerry', 'George', 'Kramer'] >>> l.pop() 'Kramer' >>> list(l) ['Elaine', 'Jerry', 'George'] popleft removes and returns the head of the list: >>> l.popleft() 'Elaine' >>> list(l) ['Jerry', 'George'] Get the number of items in the list: >>> len(l) 2 extend adds another list to the end of the list: >>> l.extend(["elaine", "Kramer"]) >>> list(l) ['Jerry', 'George', 'Elaine', 'Kramer'] 6 Chapter 1. redish - Pythonic Redis abstraction built on top of redis-py
11 extendleft adds another list to the head of the list: >>> l.extendleft(["soup-nazi", "Art"]) >>> list(l) ['Art', 'Soup-nazi', 'Jerry', 'George', 'Elaine', 'Kramer'] Get slice of list: >>> l[2:4] ['Jerry', 'George'] Iterate over the lists items: >>> it = iter(l) >>> it.next() 'Art' remove finds and removes one or more occurences of value from the list: >>> l.remove("soup-nazi", count=1) 1 >>> list(l) ['Art', 'Jerry', 'George', 'Elaine', 'Kramer'] trim trims the list to the range in start, stop: >>> l[2:4] ['George', 'Elaine'] >>> l.trim(start=2, stop=4) >>> list(l) ['George', 'Elaine'] Dicts (Hashes) Create a new dictionary with initial content: >>> d = db.dict("mydict", {"name": "George Louis Costanza"}) Get the value of key "name": >>> d["name"] 'George Louis Costanza' Set store another key, "company": >>> d["company"] = "Vandelay Industries" Check if a key exists in the dictionary, using the in operator: >>> "company" in d True Remove a key: 1.6. Dicts (Hashes) 7
12 >>> del(d["company"]) >>> "company" in d False Get a copy as a Python dict: >>> dict(d) {'name': 'George Louis Costanza'} update updates with the contents of a dict (x.update(y) does a merge where keys in y has precedence): >>> d.update({"mother": "Estelle Costanza",... "father": "Frank Costanza"}) >>> dict(d) {'name': 'George Louis Costanza', 'mother': 'Estelle Costanza', 'father': 'Frank Costanza'} Get the number of keys in the dictionary: >>> len(d) 3 keys / iterkeys gives a list of the keys in the dictionary: >>> d.keys() ['name', 'father', 'mother'] values / itervalues gives a list of values in the dictionary: >>> d.values() ['George Louis Costanza', 'Frank Costanza', 'Estelle Costanza'] items / iteritems gives a list of (key, value) tuples of the items in the dictionary: >>> d.items() [('father', 'Frank Costanza'), ('name', 'George Louis Costanza'), ('mother', 'Estelle Costanza')] setdefault returns the value of a key if present, otherwise stores a default value: >>> d.setdefault("company", "Vandelay Industries") 'Vandelay Industries' >>> d["company"] = "New York Yankees" >>> d.setdefault("company", "Vandelay Industries") 'New York Yankees' get(key, default=none) returns the value of a key if present, otherwise returns the default value: >>> d.get("company") "Vandelay Industries" >>> d.get("address") None 8 Chapter 1. redish - Pythonic Redis abstraction built on top of redis-py
13 pop removes a key and returns its value. Also supports an extra parameters, which is the default value to return if the key does not exist: >>> d.pop("company") 'New York Yankees' >>> d.pop("company") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "redish/types.py", line 373, in pop val = self[key] File "redish/types.py", line 290, in getitem raise KeyError(key) KeyError: 'company' # With default value, does not raise KeyError, but returns default value. >>> d.pop("company", None) None Sets Create a new set with the key myset, and initial members "Jerry" and "George": >>> s = db.set("myset", ["Jerry", "George"]) Add member "Elaine" to the set: >>> s.add("elaine") Check for membership: >>> "Jerry" in s True >>> "Cosmo" in s: False Remove member from set: >>> s.remove("elaine") >>> "Elaine" in s False Get copy of the set as a list: >>> list(s) ['Jerry', 'George'] Create another set: >>> s2 = x.set("myset2", ["Jerry", "Jason", "Julia", "Michael") Get the difference of the second set and the first: >>> s2.difference(s) set(['jason', 'Michael', 'Julia']) 1.7. Sets 9
14 Get the union of the two sets: >>> s.union(s2) set(['jason', 'Michael', 'Jerry', 'Julia', 'George']) Get the intersection of the two sets: >>> s.intersection(s2) set(['jerry']) Update the set with the union of another: >>> s.update(s2) 5 >>> s <Set: ['Jason', 'Michael', 'Jerry', 'Julia', 'George']> Sorted sets Create a new sorted set with the key myzset, and initial members: >>> z = db.sortedset("myzset", (("foo", 0.9), ("bar", 0.1), ("baz", 0.3))) Casting to list gives the members ordered by score: >>> list(z) ['bar', 'baz', 'foo'] revrange sorts the members in reverse: >>> z.revrange() ['foo', 'baz', 'bar'] score gives the current score of a member: >>> z.score("foo") add adds another member: >>> z.add("zaz", 1.2) >>> list(z) ['bar', 'baz', 'foo', 'zaz'] increment increments the score of a member by amount (or 1 by default): >>> z.increment("baz") 1.3 >>> z.increment("bar", 0.2) >>> list(z) ['bar', 'foo', 'zaz', 'baz'] Check for membership using the in operator: 10 Chapter 1. redish - Pythonic Redis abstraction built on top of redis-py
15 >>> "bar" in z True >>> "xuzzy" in z False remove removes a member: >>> z.remove("zaz") >>> "zaz" in z False update updates the sorted set with members from an iterable of (member, score) tuples: >>> z.update([("foo", 0.1), ("xuzzy", 0.6)]) >>> list(z) ['foo', 'bar', 'xuzzy', 'baz'] rank gives the position of a member in the set (0-based): >>> z.rank("foo") 0 >>> z.rank("xuzzy") 2 revrank gives the position of a member in reverse order: >>> z.revrank("foo") 3 >>> z.revrank("baz") 0 range_by_score gives all the member with score within a range (min / max): >>> z.range_by_score(min=0.3, max=0.6) ['bar', 'xuzzy'] redish.proxy The proxy submodule offers a different view on the redis datastore: it exposes the strings, integers, lists, hashes, sets and sorted sets within the datastore transparently, as if they were native Python objects accessed by key on the proxy object. They do not store serialized objects as with the rest of redish. For example: >>> from redish import proxy >>> r = proxy.proxy() Key access yields an object that acts like the Python equivalent of the underlying Redis structure. That structure can be read and modified as if it is native, local object. Here, that object acts like a dict: >>> r['mydict'] {'father': 'Frank Costanza', 'name': 'George Louis Costanza', 'mother': 'Estelle Costanza'} >>> r['mydict']['name'] 'George Louis Costanza' >>> r['mydict']['name'] = "Georgie" 1.9. redish.proxy 11
16 >>> r['mydict']['name'] 'Georgie' Sometimes, it may be convenient to assign a variable to the proxy object, and use that in subsequent operations: >>> ss = r['myset'] >>> 'George' in ss True >>> 'Ringo' in ss False The Proxy object is a subclass of a normal redis.client object, and so supports the same methods (other than getitem, setitem, contains, and delitem ). The object that the proxy object returns is an instance of one of the classes from redish.types (with the exception of unicode: those are simply serialized/unserialized from the underlying redis data store as UTF-8). >>> r['mycounter'] = 1 >>> cc = r['mycounter'] >>> cc += 1 >>> cc += 1 >>> r.get('mycounter') '3' >>> type(cc) <class 'redish.types.int'> Since redis does not support empty sets, lists, or hashes, the proxy object will (thread-)locally remember keys that are explicitly set as empty types. It does not currently remember container types that have been emptied as a product of operations on the underlying store: >>> r['newlist'] = [] >>> r['newlist'].extend([1,2]) >>> len(r['newlist']) 2 Finally, you may structure key names into arbitrary keyspaces denoted by format strings: >>> name = r.keyspace['user:%04d:name'] >>> parents = r.keyspace['user:%04d:parents'] >>> property = r.keyspace['user:%04d:%s'] >>> name[1] = 'Jerry' >>> property[1,'parents'] = ['Morty', 'Helen'] >>> parents.items() ('user:0001:parents', ['Morty', 'Helen']) For more information, see the redish.proxy documentation. Installation You can install redish either via the Python Package Index (PyPI) or from source. To install using pip,: $ pip install redish To install using easy_install,: 12 Chapter 1. redish - Pythonic Redis abstraction built on top of redis-py
17 $ easy_install redish If you have downloaded a source tarball you can install it by doing the following,: $ python setup.py build # python setup.py install # as root Installation 13
18 14 Chapter 1. redish - Pythonic Redis abstraction built on top of redis-py
19 CHAPTER 2 Accessing Redis via the Proxy object By mixing the type system from redish with the original redis-py s Redis object, the redish.proxy module gives a different kind of access to the key-value store without pickling/unpickling and by respecting the strengths in Redis s types. In other words, it transparently exposes Redis as a data structure server. Basics Example: >>> from redish import proxy >>> x = proxy.proxy() Ordinary key/value usage encodes strings as UTF-8, and returns unicode objects when accessing by key: >>> x["foo"] = "bar" >>> x["foo"] u'bar' Deletion and invalid keys work as expected: >>> del x["foo"] >>> x["foo"] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "redish/proxy.py", line 29, in getitem raise KeyError(key) KeyError: 'foo' 15
20 Integer (or Counter) When reading an integer, the proxy transparently passes an object that mimics the behaviour of int, but is actually stored and fetched from the Redis store: >>> x["z"] = 1 >>> x["z"] 1 >>> x["z"]. class <class 'redish.types.int'> Increment and decrement operations translate directly to Redis commands: >>> x["z"] += 2 >>> x["z"] 3 And all other operations you would expect to perform on an integer are present: >>> 3. * x["z"] 9.0 The proxy object can be assigned to another variable, and it will point to the same value in the Redis store. For the most part, you can treat the variable the same way: >>> z = x["z"] >>> z += 1 >>> z 4 >>> x["z"] 4 However, it is not the same in all respects: reassigning the variable is not the same as setting the value on the key: >>> z = 5 >>> x["z"] 4 >>> z 5 >>> z. class <type 'int'> Dictionary By assigning a key to a dictionary type, a hash data type is created in the Redis store. When the key is accessed, it returns a type that mimics a python dict: >>> x["dictionary"] = {"a": "b", "c": "d"} >>> x["dictionary"] {'a': 'b', 'c': 'd'} You may access, create, test, and destroy keys within that hash as if they were native Python keys in a dict: 16 Chapter 2. Accessing Redis via the Proxy object
21 >>> x["dictionary"]["c"] 'd' >>> x["dictionary"]["e"] = "f" >>> "e" in x["dictionary"] True >>> x["dictionary"]. class <class 'redish.types.dict'> List By assigning a key in the Proxy object to a list type, a list is created in the Redis store. When the key is accessed, it returns a type that mimics a python list: >>> x["liszt"] = ['w', 'x', 'y', 'z'] >>> x["liszt"] ['w', 'x', 'y', 'z'] >>> x["liszt"].extend(["a", "b", "c"]) >>> x["liszt"] ['w', 'x', 'y', 'z', 'a', 'b', 'c'] >>> x["liszt"][-1] 'c' >>> x["liszt"].pop() 'c' >>> x["liszt"][-1] 'b' Set By assigning a key in the Proxy object to a set type, a set is created in the Redis store. When the key is accessed, it returns a type that mimics a python set: >>> x["set"] = set(["opera", "firefox", "ie", "safari"]) >>> s = x["set"] >>> "opera" in s True >>> s.remove("safari") >>> "safari" in s False >>> list(s) ['opera', 'ie', 'firefox'] It may be useful to point out that assignment to a key on the proxy object copies by value: >>> x["game"] = x["set"] >>> x["game"].add("mobilesafari") True >>> x["game"] set(['opera', 'ie', 'firefox', 'mobilesafari']) >>> x["set"] set(['opera', 'ie', 'firefox']) 2.4. List 17
22 Sorted Set There is no native Python equivalent of a Sorted Set. However, it resembles a specialized dictionary in which all the values are numeric. The local implementation of the Sorted Set type (ZSet) uses a dictionary in this way to initialize its values: >>> from redish.types import ZSet >>> zs = ZSet({'c': 3, 'b': 2, 'a': 1}) >>> zs ['a', 'b', 'c'] >>> zs[-1] 'c' The proxied equivalent in which the data resides on the Redis server is created when setting a key to an object of the ZSet class, and is generated when retrieving such a set: >>> x["zs"] = zs >>> x["zs"].rank("a") 0 >>> x["zs"].range_by_score(2,3) ['b', 'c'] >>> x["zs"].remove("c") >>> x["zs"].items() [('a', 1.0), ('b', 2.0)] Proxy objects in general A Proxy object retains all the normal methods from Redis object: >>> x.keys() ['z', 'dictionary', 'Liszt', 'set', 'game'] >>> x.bgsave() True Keyspaces in proxy objects The fact that Redis offers a flat keyspace in each of its databases is a great benefit: it does not presuppose any structure for the keys, and access is fast and unencumbered. However, users are likely to want some structure in using keys, and the Keyspaces feature is a first attempt at making key name patterns accessible to users. At the heart, a keyspace is a formatstring with an associated label. Access is achieved by accessing elements in the proxy with a tuple argument, with the label as the first element of the tuple and the following elements used as inputs to the formatstring: >>> x.register_keyspace('myspace', "person:%04d:name") 'myspace' >>> x['myspace', 1] = "Bob" >>> x['person:0001:name'] u'bob' The label string is returned to facilitate structured and symbolic use of the keyspaces, so the following is equivalent to the above: 18 Chapter 2. Accessing Redis via the Proxy object
23 >>> UNAME = x.register_keyspace('myspace', "person:%04d:name") >>> x[uname, 1] = "Bob" >>> x['myspace', 1] u'bob' One can debug the keyspaces by feeding a tuple to actual_key: >>> x.actual_key((uname, 202)) 'person:0202:name' One can also obtain a keyspace as a subset of all the keys in the database, allowing you to treat the keyspace as a dict: >>> names = x.keyspace(uname) >>> names[1] u'bob' If you like, you can bypass labeling altogether and initialize a keyspace using a formatstring alone as a pattern: >>> namez = x.keyspace("person:%04d:name") >>> namez[1] u'bob' Not only can you get keys that match a (glob-style) pattern, as in redis.keys(), but you can also get values and items. When fed a keyspace label as an argument, the formatstring is converted to a glob-style pattern. When used with keyspaced proxies, no argument is needed, and the keyspace s formatstring is converted into a glob-style pattern. The following are thus equivalent: >>> r.keys('person:*:name') ['person:0001:name'] >>> r.keys('myspace') ['person:0001:name'] >>> names.keys() ['person:0001:name'] All these features can be combined: >>> ZZ = x.register_keyspace('friends', '%(type)s:%(id)04d:friends') >>> friendstore = x.keyspace(zz) >>> namestore = x.keyspace('%(type)s:%(id)04d:name') >>> frank = {'type': 'person', 'id': 203,... 'friends': set([204, 1]), 'name': 'Frank'} >>> fido = {'type': 'pet', 'id': 204,... 'name': 'Fido', 'friends': set([1, 202])} >>> for o in [frank, fido]:... friendstore[o] = o['friends']... namestore[o] = o['name'] >>> x['person:0203:friends'] <Set: ['1', '204']> >>> x['pet:0204:friends'].intersection(friendstore[frank]) set(['1']) >>> friendstore.items() [('person:0203:friends', <Set: ['1', '204']>), ('pet:0204:friends', <Set: ['1', '202']>)] >>> namestore[frank] u'frank' I have no idea at this point if these experimental features are useful to others, but they are fairly minimal, independent, and make sense to me. Feedback is appreciated Keyspaces in proxy objects 19
24 20 Chapter 2. Accessing Redis via the Proxy object
25 CHAPTER 3 API Reference Release 0.2 Date Sep 14, 2017 Database - redish.client Datatypes - redish.types Models - redish.models Proxy - redish.proxy Serialization - redish.serialization Utilities - redish.utils redish.utils.dt_to_timestamp(dt) Convert datetime to UNIX timestamp. redish.utils.maybe_datetime(timestamp) Convert datetime to timestamp, only if timestamp is a datetime object. 21
26 22 Chapter 3. API Reference
27 CHAPTER 4 Change History [ :40 P.M CET] Initial release. 23
28 24 Chapter 4. Change History
29 CHAPTER 5 Indices and tables genindex modindex search 25
30 26 Chapter 5. Indices and tables
31 Python Module Index r redish.utils, 21 27
32 28 Python Module Index
33 Index D dt_to_timestamp() (in module redish.utils), 21 M maybe_datetime() (in module redish.utils), 21 R redish.utils (module), 21 29
pygtrie Release Jul 03, 2017
pygtrie Release Jul 03, 2017 Contents 1 Features 3 2 Installation 5 3 Upgrading from 0.9.x 7 4 Trie classes 9 5 PrefixSet class 19 6 Version History 21 Python Module Index 23 i ii Implementation of a
More informationData Structures. Dictionaries - stores a series of unsorted key/value pairs that are indexed using the keys and return the value.
Data Structures Lists - stores a series of ordered mutable items Tuples - stores a series of ordered immutable items [not commonly used] Sets - stores a series of mutable or immutable(frozen) unsorted
More informationPyTrie Documentation. Release 0.3. George Sakkis
PyTrie Documentation Release 0.3 George Sakkis Jun 05, 2017 Contents 1 Usage 3 2 Reference documentation 5 2.1 Classes.................................................. 5 2.2 Trie methods...............................................
More informationdjango-redis-cache Documentation
django-redis-cache Documentation Release 1.5.2 Sean Bleier Nov 15, 2018 Contents 1 Intro and Quick Start 3 1.1 Intro................................................... 3 1.2 Quick Start................................................
More informationstreamio Documentation
streamio Documentation Release 0.1.0.dev James Mills April 17, 2014 Contents 1 About 3 1.1 Examples................................................. 3 1.2 Requirements...............................................
More informationBasilisk Documentation
Basilisk Documentation Release 0.1 Bonnier Business Polska November 12, 2015 Contents 1 Indices and tables 7 Python Module Index 9 i ii Contents: Basilisk enables Pythonic use of Redis hashes, lists and
More informationLECTURE 3 Python Basics Part 2
LECTURE 3 Python Basics Part 2 FUNCTIONAL PROGRAMMING TOOLS Last time, we covered function concepts in depth. We also mentioned that Python allows for the use of a special kind of function, a lambda function.
More informationPython Tutorial. Day 1
Python Tutorial Day 1 1 Why Python high level language interpreted and interactive real data structures (structures, objects) object oriented all the way down rich library support 2 The First Program #!/usr/bin/env
More informationA Little Python Part 2
A Little Python Part 2 Introducing Programming with Python Data Structures, Program Control Outline Python and the System Data Structures Lists, Dictionaries Control Flow if, for, while Reminder - Learning
More informationCOMP 204: Dictionaries Recap & Sets
COMP 204: Dictionaries Recap & Sets Material from Carlos G. Oliver, Christopher J.F. Cameron October 10, 2018 1/21 Reminder Midterm on Wednesday October 17 at 6:30-8:00 pm. Assignment 2: numpy is allowed
More informationSherlock Documentation
Sherlock Documentation Release 0.3.0 Vaidik Kapoor May 05, 2015 Contents 1 Overview 3 1.1 Features.................................................. 3 1.2 Supported Backends and Client Libraries................................
More informationDictionaries. Looking up English words in the dictionary. Python sequences and collections. Properties of sequences and collections
Looking up English words in the dictionary Comparing sequences to collections. Sequence : a group of things that come one after the other Collection : a group of (interesting) things brought together for
More informationpython-anyvcs Documentation
python-anyvcs Documentation Release 1.4.0 Scott Duckworth Sep 27, 2017 Contents 1 Getting Started 3 2 Contents 5 2.1 The primary API............................................. 5 2.2 Git-specific functionality.........................................
More informationData Structures I: Linked Lists
Lab 4 Data Structures I: Linked Lists Lab Objective: Analyzing and manipulating data are essential skills in scientific computing. Storing, retrieving, and rearranging data take time. As a dataset grows,
More informationTagalog Documentation
Tagalog Documentation Release 0.3.1 Government Digital Service July 09, 2014 Contents 1 Documentation index 3 1.1 Tagalog commands............................................ 3 1.2 tagalog Package.............................................
More informationArmide Documentation. Release Kyle Mayes
Armide Documentation Release 0.3.1 Kyle Mayes December 19, 2014 Contents 1 Introduction 1 1.1 Features.................................................. 1 1.2 License..................................................
More informationSequences and iteration in Python
GC3: Grid Computing Competence Center Sequences and iteration in Python GC3: Grid Computing Competence Center, University of Zurich Sep. 11 12, 2013 Sequences Python provides a few built-in sequence classes:
More informationpybdg Documentation Release 1.0.dev2 Outernet Inc
pybdg Documentation Release 1.0.dev2 Outernet Inc April 17, 2016 Contents 1 Source code 3 2 License 5 3 Documentation 7 Python Module Index 15 i ii Bitloads, or bit payloads, are compact payloads containing
More informationunqlite-python Documentation
unqlite-python Documentation Release 0.2.0 charles leifer Jan 23, 2018 Contents 1 Installation 3 2 Quick-start 5 2.1 Key/value features............................................ 5 2.2 Cursors..................................................
More informationDogeon Documentation. Release Lin Ju
Dogeon Documentation Release 1.0.0 Lin Ju June 07, 2014 Contents 1 Indices and tables 7 Python Module Index 9 i ii DSON (Doge Serialized Object Notation) is a data-interchange format,
More informationPython: Short Overview and Recap
Python: Short Overview and Recap Benjamin Roth CIS LMU Benjamin Roth (CIS LMU) Python: Short Overview and Recap 1 / 39 Data Types Object type Example creation Numbers (int, float) 123, 3.14 Strings this
More informationpymemcache Documentation
pymemcache Documentation Release 2.1.0 Charles Gordon, Nicholas Charriere, Jon Parise, Joe Gordon Jan 08, 2019 Contents 1 Getting started! 3 1.1 Basic Usage...............................................
More informationMUTABLE LISTS AND DICTIONARIES 4
MUTABLE LISTS AND DICTIONARIES 4 COMPUTER SCIENCE 61A Sept. 24, 2012 1 Lists Lists are similar to tuples: the order of the data matters, their indices start at 0. The big difference is that lists are mutable
More informationCOMP10001 Foundations of Computing Functions
COMP10001 Foundations of Computing Functions Semester 1, 2017 Tim Baldwin & Egemen Tanin version: 1093, date: March 21, 2017 2017 The University of Melbourne Announcements Project 1 now out Live Tutor
More informationCIS192 Python Programming
CIS192 Python Programming Data Types Joseph Cappadona University of Pennsylvania September 03, 2015 Joseph Cappadona (University of Pennsylvania) CIS 192 September 03, 2015 1 / 32 Outline 1 Data Types
More informationLECTURE 20. Serialization and Data Persistence
LECTURE 20 Serialization and Data Persistence SERIALIZATION Serialization refers to the flattening of complex object hierarchies into a format that is easily stored, sent over a network, or shared with
More informationMEIN 50010: Python Data Structures
: Python Data Structures Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-18 Data Structures Stacks, Queues & Deques Structures Data structures are a way of storing
More informationtreelib Documentation
treelib Documentation Release 1.4.0 Xiaming Chen Dec 23, 2017 Contents 1 Install 3 2 Useful APIs 5 2.1 Node Objects.............................................. 5 2.2 Tree Objects..............................................
More informationredis-lua Documentation
redis-lua Documentation Release 2.0.8 Julien Kauffmann October 12, 2016 Contents 1 Quick start 3 1.1 Step-by-step analysis........................................... 3 2 What s the magic at play here?
More informationData structure and algorithm in Python
Data structure and algorithm in Python Array-Based Sequences Xiaoping Zhang School of Mathematics and Statistics, Wuhan University Table of contents 1. Python s Sequence Types 2. Low-Level s Arrays 3.
More informationScrapy-Redis Documentation
Scrapy-Redis Documentation Release 0.7.0-dev Rolando Espinoza Nov 13, 2017 Contents 1 Scrapy-Redis 3 1.1 Features.................................................. 3 1.2 Requirements...............................................
More informationData Structures. Lists, Tuples, Sets, Dictionaries
Data Structures Lists, Tuples, Sets, Dictionaries Collections Programs work with simple values: integers, floats, booleans, strings Often, however, we need to work with collections of values (customers,
More informationCIS192: Python Programming Data Types & Comprehensions Harry Smith University of Pennsylvania September 6, 2017 Harry Smith (University of Pennsylvani
CIS192: Python Programming Data Types & Comprehensions Harry Smith University of Pennsylvania September 6, 2017 Harry Smith (University of Pennsylvania) CIS 192 Fall Lecture 2 September 6, 2017 1 / 34
More informationIHIH Documentation. Release Romain Dartigues
IHIH Documentation Release 0.1.1 Romain Dartigues December 11, 2016 Contents 1 Why? 3 2 Table of contents 5 2.1 Source documentation.......................................... 5 2.2 Examples.................................................
More informationnptdms Documentation Release Adam Reeve
nptdms Documentation Release 0.11.4 Adam Reeve Dec 01, 2017 Contents 1 Contents 3 1.1 Installation and Quick Start....................................... 3 1.2 Reading TDMS files...........................................
More informationsemidbm Documentation
semidbm Documentation Release 0.4.0 James Saryerwinnie Jr September 04, 2013 CONTENTS i ii semidbm is a pure python implementation of a dbm, which is essentially a persistent key value store. It allows
More informationBasic Scripting, Syntax, and Data Types in Python. Mteor 227 Fall 2017
Basic Scripting, Syntax, and Data Types in Python Mteor 227 Fall 2017 Basic Shell Scripting/Programming with Python Shell: a user interface for access to an operating system s services. The outer layer
More informationIntroduction to Python
Introduction to Python Michael Krisper Thomas Wurmitzer October 21, 2014 Michael Krisper, Thomas Wurmitzer Introduction to Python October 21, 2014 1 / 26 Schedule Tutorium I Dates & Deadlines Submission
More informationCollections. Lists, Tuples, Sets, Dictionaries
Collections Lists, Tuples, Sets, Dictionaries Homework notes Homework 1 grades on canvas People mostly lost points for not reading the document carefully Didn t play again Didn t use Y/N for playing again
More informationLECTURE 27. Python and Redis
LECTURE 27 Python and Redis PYTHON AND REDIS Today, we ll be covering a useful but not entirely Python-centered topic: the inmemory datastore Redis. We ll start by introducing Redis itself and then discussing
More informationA Framework for Creating Distributed GUI Applications
A Framework for Creating Distributed GUI Applications Master s Project Report Derek Snyder May 15, 2006 Advisor: John Jannotti Introduction Creating distributed graphical user interface (GUI) applications
More informationCSC148 Fall 2017 Ramp Up Session Reference
Short Python function/method descriptions: builtins : input([prompt]) -> str Read a string from standard input. The trailing newline is stripped. The prompt string, if given, is printed without a trailing
More informationTurn in a printout of your code exercises stapled to your answers to the written exercises at 2:10 PM on Thursday, January 13th.
6.189 Homework 3 Readings How To Think Like A Computer Scientist: Monday - chapters 9, 10 (all); Tuesday - Chapters 12, 13, 14 (all). Tuesday s reading will really help you. If you re short on time, skim
More informationtreelib Documentation
treelib Documentation Release 1.3.0 Xiaming Chen Jul 08, 2018 Contents 1 Install 3 2 Useful APIs 5 2.1 Node Objects.............................................. 5 2.2 Tree Objects..............................................
More informationPython. Executive Summary
Python Executive Summary DEFINITIONS OBJECT: a unit of data of a particular type with characteristic functionality (i.e., methods and/or response to operators). Everything in Python is an object. "atomic"
More informationCS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017
CS 133 - Introduction to Computational and Data Science Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 Introduction to Python II In the previous class, you have
More informationConfire Documentation
Confire Documentation Release 0.2.0 Benjamin Bengfort December 10, 2016 Contents 1 Features 3 2 Setup 5 3 Example Usage 7 4 Next Topics 9 5 About 17 Python Module Index 19 i ii Confire is a simple but
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationPizco Documentation. Release 0.1. Hernan E. Grecco
Pizco Documentation Release 0.1 Hernan E. Grecco Nov 02, 2017 Contents 1 Design principles 3 2 Pizco in action 5 3 Contents 7 3.1 Getting Started.............................................. 7 3.2 Futures..................................................
More informationxmljson Documentation
xmljson Documentation Release 0.1.9 S Anand Aug 01, 2017 Contents 1 About 3 2 Convert data to XML 5 3 Convert XML to data 7 4 Conventions 9 5 Options 11 6 Installation 13 7 Roadmap 15 8 More information
More informationChapter 14 Tuples, Sets, and Dictionaries. Copyright 2012 by Pearson Education, Inc. All Rights Reserved.
Chapter 14 Tuples, Sets, and Dictionaries 1 Motivations The No Fly List is a list, created and maintained by the United States government's Terrorist Screening Center, of people who are not permitted to
More informationThere are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:
Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited
More informationAvro Specification
Table of contents 1 Introduction...2 2 Schema Declaration... 2 2.1 Primitive Types... 2 2.2 Complex Types...2 2.3 Names... 5 2.4 Aliases... 6 3 Data Serialization...6 3.1 Encodings... 7 3.2 Binary Encoding...7
More informationAvro Specification
Table of contents 1 Introduction...2 2 Schema Declaration... 2 2.1 Primitive Types... 2 2.2 Complex Types...2 2.3 Names... 5 3 Data Serialization...6 3.1 Encodings... 6 3.2 Binary Encoding...6 3.3 JSON
More informationIntroduction to Python! Lecture 2
.. Introduction to Python Lecture 2 Summary Summary: Lists Sets Tuples Variables while loop for loop Functions Names and values Passing parameters to functions Lists Characteristics of the Python lists
More informationyaml Documentation Release dev Anthon van der Neut
yaml Documentation Release dev Anthon van der Neut December 21, 2016 Contents 1 Overview 3 2 Installing 5 2.1 Optional requirements........................................ 5 3 Details 7 3.1 Indentation
More informationArcher Documentation. Release 0.1. Praekelt Dev
Archer Documentation Release 0.1 Praekelt Dev February 12, 2014 Contents 1 User Service 3 1.1 Installation................................................ 3 1.2 API....................................................
More informationKaiso Documentation. Release 0.1-dev. onefinestay
Kaiso Documentation Release 0.1-dev onefinestay Sep 27, 2017 Contents 1 Neo4j visualization style 3 2 Contents 5 2.1 API Reference.............................................. 5 3 Indices and tables
More informationPLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science
PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science SUMMER 2012 EXAMINATIONS CSC 108 H1Y Instructors: Janicki Duration NA PLEASE HAND IN Examination Aids: None Student Number: Family Name(s):
More informationCSE : Python Programming
CSE 399-004: Python Programming Lecture 08: Graphical User Interfaces with wxpython March 12, 2005 http://www.seas.upenn.edu/~cse39904/ Plan for today and next time Today: wxpython (part 1) Aside: Arguments
More informationIMAPClient Documentation
IMAPClient Documentation Release 0.9.2 Menno Smits March 28, 2013 CONTENTS i ii Author Menno Smits Version 0.9.2 Date March 28, 2013 Homepage http://imapclient.freshfoo.com Download http://pypi.python.org/pypi/imapclient/
More informationjxmlease Documentation
jxmlease Documentation Release 1.0.2dev1 Juniper Networks April 18, 2016 Contents 1 Welcome 1 1.1 Installation................................................ 1 1.2 Parsing XML...............................................
More informationlinkgrabber Documentation
linkgrabber Documentation Release 0.2.6 Eric Bower Jun 08, 2017 Contents 1 Install 3 2 Tutorial 5 2.1 Quickie.................................................. 5 2.2 Documentation..............................................
More informationConnexion Documentation
Connexion Documentation Release 0.5 Zalando SE Nov 16, 2017 Contents 1 Quickstart 3 1.1 Prerequisites............................................... 3 1.2 Installing It................................................
More informationJSimpleDB: Language Driven Persistence for Java
JSimpleDB: Language Driven Persistence for Java Archie Cobbs Emergency Callworks, Inc. aka Motorola Solutions Why Persistence? Computers are state machines and persistence allows flexibility in handling
More informationCOMPUTER SCIENCE IN THE NEWS (TWO YEARS AGO) CS61A Lecture 16 Mutable Data Structures TODAY REVIEW: OOP CLASS DESIGN 7/24/2012
COMPUTER SCIENCE IN THE NEWS (TWO YEARS AGO) CS61A Lecture 16 Mutable Data Structures Jom Magrotker UC Berkeley EECS July 16, 2012 http://articles.nydailynews.com/2010 04 27/news/27062899_1_marks death
More informationPython - 2. Jim Eng
Python - 2 Jim Eng jimeng@umich.edu Lists Dictionaries Try... except Methods and Functions Classes and Objects Midterm Review Overview Patterns in programming - 1 Sequential steps Conditional steps Repeated
More informationLecture Agenda. Objects. But First... Immutable Types and Nesting. Immutable Types and Nesting
COMP10001 Foundations of Computing Objects and Types: A Closer Look (Advanced Lecture) Semester 1, 2017 Tim Baldwin & Egemen Tanin Lecture Agenda This lecture: Making sense of strings, lists and functions
More informationpython-json-patch Documentation
python-json-patch Documentation Release 1.21 Stefan Kögl Jan 16, 2018 Contents 1 Tutorial 3 1.1 Creating a Patch............................................. 3 1.2 Applying a Patch.............................................
More informationCSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern
CSE 399-004: Python Programming Lecture 12: Decorators April 9, 200 http://www.seas.upenn.edu/~cse39904/ Announcements Projects (code and documentation) are due: April 20, 200 at pm There will be informal
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationpysharedutils Documentation
pysharedutils Documentation Release 0.5.0 Joel James August 07, 2017 Contents 1 pysharedutils 1 2 Indices and tables 13 i ii CHAPTER 1 pysharedutils pysharedutils is a convenient utility module which
More informationdjango-conduit Documentation
django-conduit Documentation Release 0.0.1 Alec Koumjian Apr 24, 2017 Contents 1 Why Use Django-Conduit? 3 2 Table of Contents 5 2.1 Filtering and Ordering.......................................... 5
More informationPython Finite State Machine. Release 0.1.5
Python Finite State Machine Release 0.1.5 Sep 15, 2017 Contents 1 Overview 1 1.1 Installation................................................ 1 1.2 Documentation..............................................
More informationbottle-rest Release 0.5.0
bottle-rest Release 0.5.0 February 18, 2017 Contents 1 API documentation 3 1.1 bottle_rest submodule.......................................... 3 2 What is it 5 2.1 REST in bottle..............................................
More informationSQL. Often times, in order for us to build the most functional website we can, we depend on a database to store information.
Often times, in order for us to build the most functional website we can, we depend on a database to store information. If you ve ever used Microsoft Excel or Google Spreadsheets (among others), odds are
More informationspacetrack Documentation
spacetrack Documentation Release 0.13.1 Frazer McLean Feb 03, 2018 Contents 1 Installation 3 1.1 pip.................................................. 3 1.2 Git..................................................
More informationRedis Timeseries Documentation
Redis Timeseries Documentation Release 0.1.8 Ryan Anguiano Jul 26, 2017 Contents 1 Redis Timeseries 3 1.1 Install................................................... 3 1.2 Usage...................................................
More informationiptools Release dev
iptools Release 0.7.0-dev August 21, 2016 Contents 1 Using with Django INTERNAL_IPS 3 2 Python Version Compatibility 5 3 Installation 7 4 API 9 4.1 iptools..................................................
More informationtld Documentation Release 0.9 Artur Barseghyan
tld Documentation Release 0.9 Artur Barseghyan Jun 13, 2018 Contents 1 Prerequisites 3 2 Documentation 5 3 Installation 7 4 Usage examples 9 5 Update the list of TLD names
More informationQuestion 1. Part (a) Part (b) December 2013 Final Examination Marking Scheme CSC 108 H1F. [13 marks] [4 marks] Consider this program:
Question 1. Part (a) [4 marks] Consider this program: [13 marks] def square(x): (number) -> number Write what this program prints, one line per box. There are more boxes than you need; leave unused ones
More informationpvl Documentation Release William Trevor Olson
pvl Documentation Release 0.2.0 William Trevor Olson May 29, 2017 Contents 1 pvl 1 1.1 Installation................................................ 1 1.2 Basic Usage...............................................
More informationretask Documentation Release 1.0 Kushal Das
retask Documentation Release 1.0 Kushal Das February 12, 2016 Contents 1 Dependencies 3 2 Testimonial(s) 5 3 User Guide 7 3.1 Introduction............................................... 7 3.2 Setting
More informationPython Mock Tutorial Documentation
Python Mock Tutorial Documentation Release 0.1 Javier Collado Nov 14, 2017 Contents 1 Introduction 3 2 Mock 5 2.1 What is a mock object?.......................................... 5 2.2 What makes mock
More informationzope.location Documentation
zope.location Documentation Release 4.0 Zope Foundation Contributors January 28, 2015 Contents 1 Using zope.location 3 1.1 Location................................................ 3 1.2 inside()................................................
More informationPyDic Documentation. Release 1.1. Krzysztof Dorosz
PyDic Documentation Release 1.1 Krzysztof Dorosz May 31, 2014 Contents 1 Introduction 3 1.1 Preparing a PyDic dictionary....................................... 3 1.2 Quickstart................................................
More informationBabu Madhav Institute of Information Technology, UTU 2015
Five years Integrated M.Sc.(IT)(Semester 5) Question Bank 060010502:Programming in Python Unit-1:Introduction To Python Q-1 Answer the following Questions in short. 1. Which operator is used for slicing?
More informationFIQL Parser. Release 0.15
FIQL Parser Release 0.15 July 02, 2016 Contents 1 What is FIQL? 3 2 How does FIQL work? 5 3 Installing fiql_parser 7 4 Using fiql_parser 9 4.1 Parsing a FIQL formatted string.....................................
More informationAbstract Data Types Chapter 1
Abstract Data Types Chapter 1 Part Two Bags A bag is a basic container like a shopping bag that can be used to store collections. There are several variations: simple bag grab bag counting bag 2 Bag ADT
More informationdatabuild Documentation
databuild Documentation Release 0.0.10 Flavio Curella May 15, 2015 Contents 1 Contents 3 1.1 Installation................................................ 3 1.2 Quickstart................................................
More informationpyfinity Documentation
pyfinity Documentation Release 0.1.0 Frank Singleton January 26, 2014 Contents 1 Fast Counters 3 1.1 pyfinity.counter_manager_versioned................................... 3 2 Indices and tables 13 Python
More informationComputer Sciences 368 Scripting for CHTC Day 3: Collections Suggested reading: Learning Python
Day 3: Collections Suggested reading: Learning Python (3rd Ed.) Chapter 8: Lists and Dictionaries Chapter 9: Tuples, Files, and Everything Else Chapter 13: while and for Loops 1 Turn In Homework 2 Homework
More informationIntroduction to Python. Cathal Hoare
Introduction to Python Cathal Hoare Dictionaries We are familiar with dictionaries in the real world: Contains word definitions Creates associations between words and definitions Searchable Dictionaries
More informationPython-Tempo Documentation
Python-Tempo Documentation Release 0.1.0 Andrew Pashkin October 25, 2015 Contents 1 Links 3 2 Features 5 3 Quick example 7 4 Schedule model 9 4.1 Example.................................................
More informationUranium Documentation
Uranium Documentation Release 0.1 Yusuke Tsutsumi Jul 26, 2018 Contents 1 What is Uranium? 1 1.1 Installation................................................ 2 1.2 Tutorial..................................................
More informationCS Programming Languages: Python
CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer
More informationRequests Mock Documentation
Requests Mock Documentation Release 1.5.1.dev4 Jamie Lennox Jun 16, 2018 Contents 1 Overview 3 2 Using the Mocker 5 2.1 Activation................................................ 5 2.2 Class Decorator.............................................
More informationdjango-oauth2-provider Documentation
django-oauth2-provider Documentation Release 0.2.7-dev Alen Mujezinovic Aug 16, 2017 Contents 1 Getting started 3 1.1 Getting started.............................................. 3 2 API 5 2.1 provider.................................................
More informationmicawber Documentation
micawber Documentation Release 0.3.4 charles leifer Nov 29, 2017 Contents 1 examples 3 2 integration with web frameworks 5 2.1 Installation................................................ 5 2.2 Getting
More informationLecture no
Advanced Algorithms and Computational Models (module A) Lecture no. 3 29-09-2014 Giacomo Fiumara giacomo.fiumara@unime.it 2014-2015 1 / 28 Expressions, Operators and Precedence Sequence Operators The following
More information