halogen documentation

Size: px
Start display at page:

Download "halogen documentation"

Transcription

1 halogen documentation Release Oleg Pidsadnyi, Paylogic International and others Apr 13, 2018

2

3 Contents 1 halogen 3 2 Schema Serialization Validation Serializing dict Serializing objects Attribute Type HAL RFC Link href deprecation Deserialization Type.deserialize Deserialization validation errors Contact License Internal API 27 Python Module Index 33 i

4 ii

5 Contents Welcome to halogen s documentation! halogen Schema Serialization Validation Serializing dict Serializing objects Attribute * Attr() * Attr( const ) * Attr(attr= foo ) * Attr(attr=lambda value: value) * Attribute as a decorator * Attr(attr=Acccessor) * Attr(Type()) * Attr(Type(validators=[validator])) * Attr(default=value) * Attr(required=False) Type * Subclassing types * Type.serialize * Nullable types HAL RFC Link href deprecation * CURIE * Embedded Deserialization Type.deserialize Deserialization validation errors Contact License Contents 1

6 Internal API 2 Contents

7 CHAPTER 1 halogen Python HAL generation/parsing library. Halogen takes the advantage of the declarative style serialization with easily extendable schemas. Schema combines the knowledge about your data model, attribute mapping and advanced accessing, with complex types and data transformation. Library is purposed in representing your data in HAL format in the most obvious way possible, but also of the generic web form-like functionality so that your schemas and types can be reused as much as possible. 3

8 4 Chapter 1. halogen

9 CHAPTER 2 Schema Schema is the main building block of the serialization. It is also a type which means you can declare nested structures with schemas. 2.1 Serialization >>> Schema.serialize("hello": "Hello World") >>> "hello": "Hello World" Simply call Schema.serialize() class method which can accept dict or any other object. 2.2 Validation There s no validation involved in the serialization. Your source data or your model is considered to be clean since it is coming from the storage and it is not a user input. Of course exceptions in the types or attribute accessors may occur but they are considered as programming errors. 2.3 Serializing dict Dictionary values are automatically accessed by the schema attributes using their names as keys: class Hello(halogen.Schema): hello = halogen.attr() serialized = Hello.serialize("hello": "Hello World") 5

10 Result: "hello": "Hello World" HAL is just JSON, but according to it s specification it SHOULD have self link to identify the serialized resource. For this you should use HAL-specific attributes and configure the way the self is composed. HAL example: from flask import url_for spell = "uid": "abracadabra", "name": "Abra Cadabra", "cost": 10, class Spell(halogen.Schema): self = halogen.link(attr=lambda spell: url_for("spell.get" uid=spell['uid'])) name = halogen.attr() serialized = Spell.serialize(spell) Result: "_links": "self": "href": "/spells/abracadabra", "name": "Abra Cadabra" 2.4 Serializing objects Similar to dictionary keys the schema attributes can also access object properties: from flask import url_for class Spell(object): uid = "abracadabra" name = "Abra Cadabra" cost = 10 spell = Spell() class SpellSchema(halogen.Schema): self = halogen.link(attr=lambda spell: url_for("spell.get" uid=spell.uid)) name = halogen.attr() serialized = SpellSchema.serialize(spell) 6 Chapter 2. Schema

11 Result: "_links": "self": "href": "/spells/abracadabra", "name": "Abra Cadabra" 2.5 Attribute Attributes form the schema and encapsulate the knowledge how to get the data from your model, how to transform it according to the specific type Attr() The name of the attribute member in the schema is the name of the key the result will be serialized to. By default the same attribute name is used to access the source model. Example: from flask import url_for class Spell(object): uid = "abracadabra" name = "Abra Cadabra" cost = 10 spell = Spell() class SpellSchema(halogen.Schema): self = halogen.link(attr=lambda spell: url_for("spell.get" uid=spell.uid)) name = halogen.attr() serialized = SpellSchema.serialize(spell) Result: "_links": "self": "href": "/spells/abracadabra", "name": "Abra Cadabra" Attr( const ) In case the attribute represents a constant the value can be specified as a first parameter. This first parameter is a type of the attribute. If the type is not a instance or subclass of a halogen.types.type it will be bypassed Attribute 7

12 from flask import url_for class Spell(object): uid = "abracadabra" name = "Abra Cadabra" cost = 10 spell = Spell() class SpellSchema(halogen.Schema): self = halogen.link(attr=lambda spell: url_for("spell.get" uid=spell.uid)) name = halogen.attr("custom name") serialized = SpellSchema.serialize(spell) Result: "_links": "self": "href": "/spells/abracadabra", "name": "custom name" In some cases also the attr can be specified to be a callable that returns a constant value Attr(attr= foo ) In case the attribute name doesn t correspond your model you can override it: from flask import url_for class Spell(object): uid = "abracadabra" title = "Abra Cadabra" cost = 10 spell = Spell() class SpellSchema(halogen.Schema): self = halogen.link(attr=lambda spell: url_for("spell.get" uid=spell.uid)) name = halogen.attr(attr="title") serialized = SpellSchema.serialize(spell) Result: "_links": "self": "href": "/spells/abracadabra", "name": "Abra Cadabra" 8 Chapter 2. Schema

13 The attr parameter accepts strings of the source attribute name or even dot-separated path to the attribute. This works for both: nested dictionaries or related objects an Python properties. class SpellSchema(halogen.Schema): name = halogen.attr(attr="path.to.my.attribute") Attr(attr=lambda value: value) The attr parameter accepts callables that take the entire source model and can access the neccessary attribute. You can pass a function or lambda in order to return the desired value which also can be just a constant. from flask import url_for class Spell(object): uid = "abracadabra" title = "Abra Cadabra" cost = 10 spell = Spell() class SpellSchema(halogen.Schema): self = halogen.link(attr=lambda spell: url_for("spell.get" uid=spell.uid)) name = halogen.attr(attr=lambda value: value.title) serialized = SpellSchema.serialize(spell) Result: "_links": "self": "href": "/spells/abracadabra", "name": "Abra Cadabra" Attribute as a decorator Sometimes accessor functions are too big for lambdas. In this case it is possible to decorate a method of the class to be a getter accessor. class default=none) def total(obj): return sum( (item.amount for item in obj.items), 0, ) (continues on next page) 2.5. Attribute 9

14 @total.setter def set_total(obj, value): obj.total = value (continued from previous page) Attr(attr=Acccessor) In case the schema is used for both directions to serialize and to deserialize the halogen.schema.accessor can be passed with both getter and setter specified. Getter is a string or callable in order to get the value from a model, and setter is a string or callable that knows where the deserialized value should be stored Attr(Type()) After the attibute gets the value it passes it to it s type in order to complete the serialization. Halogen provides basic types for example halogen.types.list to implement lists of values or schemas. Schema is also a Type and can be passed to the attribute to implement complex structures. Example: from flask import url_for class Book(object): uid = "good-book-uid" title = "Harry Potter and the Philosopher's Stone" genres = [ "uid": "fantasy-literature", "title": "fantasy literature", "uid": "mystery", "title": "mystery", "uid": "adventure", "title": "adventure", ] book = Book() class GenreSchema(halogen.Schema): self = halogen.link(attr=lambda genre: url_for("genre.get" uid=genre['uid'])) title = halogen.attr() class BookSchema(halogen.Schema): self = halogen.link(attr=lambda book: url_for("book.get" uid=book.uid)) title = halogen.attr() genres = halogen.attr(halogen.types.list(genreschema)) serialized = BookSchema.serialize(book) Result: "_links": "self": "href": "good-book-uid", "genres": [ "_links": "self": "href": "fantasy-literature", "title": "fantasy literature", "_links": "self": "href": "mystery", "title": "mystery", "_links": "self": "href": "adventure", "title": "adventure" (continues on next page) 10 Chapter 2. Schema

15 ], "title": "Harry Potter and the Philosopher's Stone" (continued from previous page) Attr(Type(validators=[validator])) Type gets optional validators parameter, which is a list of halogen.validators.validator objects whose single interface method validate will be called for the given value during the deserialization. If the value is not valid, halogen.exceptions.validationerror should be raised. Halogen provides basic validators, for example halogen.validators.range to validate that the values is in certain range Attr(default=value) If an attribute cannot be taken, provided default value will be used; if default value is a callable, it will be called to get the default value Attr(required=False) By default, attributes are required, so when an attribute can not be taken during the serialization and default is not provided, an exception will be raised (AttributeError or KeyError, depending on the input). It s possible to relax this restriction by passing required=false to the attribute constructor. For deserialization, the same logic applies, but the exception type will be halogen.exceptions.validationerror for human readability (see Deserialization). 2.6 Type Type is responsible in serialization of individual values such as integers, strings, dates. Also type is a base of Schema. It has both serialize() and deserialize() methods that convert the attribute s value. Unlike Schema types are instantiated. You can configure serialization behavior by passing parameters to their constructors while declaring your schema. Types can raise halogen.exceptions.validationerror during deserialization, but serialization expects the value that this type knows how to transform Subclassing types Types that are common in your application can be shared between schemas. This could be the datetime type, specific URL type, internationalized strings and any other representation that requires specific format Type.serialize The default implementation of the Type.serialize is a bypass. Serialization method of a type is the last opportunity to convert the value that is being serialized: Example: 2.6. Type 11

16 class Amount(object): currency = "EUR" amount = 1 class AmountType(halogen.types.Type): def serialize(self, value): if value is None or not isinstance(value, Amount): return None return "currency": value.currency, "amount": value.amount class Product(object): name = "Milk" def init (self): self.price = Amount() product = Product() class ProductSchema(halogen.Schema): name = halogen.attr() price = halogen.attr(amounttype()) serialized = ProductSchema.serialize(product) Result: "name": "Milk", "price": "amount": 1, "currency": "EUR" Nullable types In case the accessor returns None and the further serialization by a type or a nested schema is not desired the type can be wrapped into Nullable type. class FreeProduct(object): """A free product, that doesn't have a price.""" (continues on next page) 12 Chapter 2. Schema

17 price = None (continued from previous page) class AmountSchema(halogen.Schema): currency = halogen.attr(required=true, default="usd") amount = halogen.attr(required=true, default=0) class FreeProductSchema(halogen.Schema): price_null = halogen.attr(halogen.types.nullable(amounttype()), attr="price") price_zero = halogen.attr(amounttype(), attr="price") serialized = FreeProductSchema.serialize(FreeProduct()) Result: "price_null": None, "price_zero": "amount": 0, "currency": "USD" 2.6. Type 13

18 14 Chapter 2. Schema

19 CHAPTER 3 HAL Hypertext Application Language. 3.1 RFC The JSON variant of HAL (application/hal+json) has now been published as an internet draft: draft-kelly-json-hal 3.2 Link Link objects at RFC: link-objects 3.3 href The href property is REQUIRED. halogen.link will create href for you. You just need to point to halogen.link either from where or what halogen.link should put into href. Static variant class EventSchema(halogen.Schema): Callable variant artist = halogen.link(attr="/artists/some-artist") 15

20 class EventSchema(halogen.Schema): help = halogen.link(attr=lambda: current_app.config['doc_url']) 3.4 deprecation Links can be deprecated by specifying the deprecation URL attribute which points to the document describing the deprecation. class EventSchema(halogen.Schema): artist = halogen.link( attr="/artists/some-artist", deprecation=" ) CURIE CURIEs are providing links to the resource documentation. doc = halogen.curie( name="doc, href=" templated=true ) class BlogSchema(halogen.Schema): lastest_post = halogen.link(attr="/posts/latest", curie=doc) "_links": "curies": [ "name": "doc", "href": " "templated": true ], "doc:latest_posts": "href": "/posts/latest" Schema also can be a param to link 16 Chapter 3. HAL

21 class BookLinkSchema(halogen.Schema): href = halogen.attr("/books") class BookSchema(halogen.Schema): books = halogen.link(booklinkschema) serialized = BookSchema.serialize("books": "") "_links": "books": "href": "/books" Embedded The reserved _embedded property is OPTIONAL. It is an object whose property names are link relation types (as defined by [RFC5988]) and values are either a Resource Object or an array of Resource Objects. Embedded Resources MAY be a full, partial, or inconsistent version of the representation served from the target URI. For creating _embedded in your schema you should use halogen.embedded. Example: em = halogen.curie( name="em", href=" templated=true, type="text/html" ) class EventSchema(halogen.Schema): self = halogen.link("/events/activity-event") collection = halogen.link("/events/activity-event", curie=em) uid = halogen.attr() class PublicationSchema(halogen.Schema): self = halogen.link(attr=lambda publication: "/campaigns/activity-campaign/events/ activity-event") event = halogen.link(attr=lambda publication: "/events/activity-event", curie=em) campaign = halogen.link(attr=lambda publication: "/campaign/activity-event", curie=em) class EventCollection(halogen.Schema): self = halogen.link("/events") (continues on next page) 3.4. deprecation 17

22 events = halogen.embedded(halogen.types.list(eventschema), attr=lambda collection: collection["events"], curie=em) publications = halogen.embedded( attr_type=halogen.types.list(publicationschema), attr=lambda collection: collection["publications"], curie=em ) (continued from previous page) collections = 'events': [ "uid": 'activity-event' ], 'publications': [ "event": "uid": "activity-event", "campaign": "uid": "activity-campaign" ] serialized = EventCollection.serialize(collections) Result: "_embedded": "em:events": [ "_links": "curies": [ "href": " "name": "em", "templated": true, "type": "text/html" ], "em:collection": "href": "/events/activity-event", "self": "href": "/events/activity-event", "uid": "activity-event" ], "em:publications": [ "_links": "curies": [ "href": " "name": "em", "templated": true, "type": "text/html" ], "em:campaign": "href": "/campaign/activity-event", "em:event": "href": "/events/activity-event", (continues on next page) 18 Chapter 3. HAL

23 (continued from previous page) "self": "href": "/campaigns/activity-campaign/events/activity- event" ], "_links": "curies": [ "href": " "name": "em", "templated": true, "type": "text/html" ], "self": "href": "/events" By default, embedded resources are required, you can make them not required by passing required=false to the constructor, and empty values will be omitted in the serialization: class Schema(halogen.Schema): user1 = halogen.embedded(personschema, required=false) user2 = halogen.embedded(personschema) serialized = Schema.serialize('user2': Person("John", "Smith")) Result: "_embedded": "user2": "name": "John", "surname": "Smith" 3.4. deprecation 19

24 20 Chapter 3. HAL

25 CHAPTER 4 Deserialization Schema has deserialize method. Method deserialize will return dict as a result of deserialization if you wont pass any object as a second param. Example: class Hello(halogen.Schema): hello = halogen.attr() result = Hello.deserialize("hello": "Hello World") print(result) Result: "hello": "Hello World" However, if you will pass object as the second param of deserialize method then data will be assigned on object s attributes. Example: class HellMessage(object): hello = "" hello_message = HellMessage() class Hello(halogen.Schema): hello = halogen.attr() (continues on next page) 21

26 (continued from previous page) Hello.deserialize("hello": "Hello World", hello_message) print(hello_message.hello) Result: "Hello World" 4.1 Type.deserialize How you already know attributes launch serialize method from types which they are supported in moment of serialization but in case of deserialization the same attributes will launch deserialize method. It means that when you write your types you should not forget about deserialize methods for them. Example: import decimal class Amount(object): currency = "EUR" amount = 1 def init (self, currency, amount): self.currency = currency self.amount = amount def repr (self): return "Amount: currency amount".format(currency=self.currency, amount=str(self.amount)) class AmountType(halogen.types.Type): def serialize(self, value): if value is None or not isinstance(value, Amount): return None return "currency": value.currency, "amount": value.amount def deserialize(self, value): return Amount(value["currency"], decimal.decimal(str(value["amount"]))) class ProductSchema(halogen.Schema): title = halogen.attr() price = halogen.attr(amounttype()) (continues on next page) 22 Chapter 4. Deserialization

27 (continued from previous page) product = ProductSchema.deserialize("title": "Pencil", "price": "currency": "EUR", "amount": 0.30) print(product) Result: "price": Amount: EUR 0.3, "title": "Pencil" 4.2 Deserialization validation errors On deserialization failure, halogen raises special exception (halogen.exceptions.validationerror). That exception class has unicode method which renders human readable error result so user can easily track down the problem with his input. Example: class Hello(halogen.Schema): hello = halogen.attr() try: result = Hello.deserialize() except halogen.exceptions.validationerror as exc: print(exc) Result: "errors": [ "errors": [ ], "attr": "hello" ], "attr": "<root>" "type": "str", "error": "Missing attribute." In case when you have nested schemas, and use List, halogen also adds the index (counting from 0) in the list so you see where exactly the validation error happened. Example: class Product(halogen.Schema): """A product has a name and quantity.""" (continues on next page) 4.2. Deserialization validation errors 23

28 (continued from previous page) name = halogen.attr() quantity = halogen.attr() class NestedSchema(halogen.Schema): """An example nested schema.""" products = halogen.attr( halogen.types.list( Product, ), default=[], ) try: result = NestedSchema.deserialize( "products": [ "name": "name", "quantity": 1, "name": "name", ] ) except halogen.exceptions.validationerror as exc: print(exc) Result: "errors": [ "errors": [ "index": 1, "errors": [ "errors": [ "type": "str", "error": "Missing attribute." ], "attr": "quantity" ] ], "attr": "products" ], "attr": "<root>" (continues on next page) 24 Chapter 4. Deserialization

29 (continued from previous page) Note that should ValueError exception happen on the attribute deserialization, it will be caught and reraized as halogen.exceptions.validationerror. This is to eliminate the need of raising halogen specific exceptions in types and attributes during the deserialization. 4.3 Contact If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page. 4.4 License This software is licensed under the MIT license See License file 2013 Oleg Pidsadnyi, Paylogic International and others Contact 25

30 26 Chapter 4. Deserialization

31 CHAPTER 5 Internal API Halogen basic types. class halogen.types.amount(currencies, amount_class, **kwargs) Amount (money) schema type. amount_object_to_dict(amount) Return the dictionary representation of an Amount object. Amount object must have amount and currency properties and as_tuple method which will return (currency, amount) and as_quantized method to quantize amount property. Parameters amount instance of Amount object Returns dict with amount and currency keys. deserialize(value, **kwargs) Deserialize the amount. Parameters value Amount in CURRENCYAMOUNT or currency : CURRENCY, amount : AMOUNT format. For example EUR35.50 or currency : EUR, amount : Returns A paylogic Amount object. Raises ValidationError when amount can t be deserialzied ValidationError when amount has more than 2 decimal places serialize(value, **kwargs) Serialize amount. Parameters value Amount value. Returns Converted amount. class halogen.types.boolean(validators=none, *args, **kwargs) Boolean schema type. 27

32 deserialize(value, **kwargs) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. serialize(value, **kwargs) Serialization of value. class halogen.types.isodatetime(validators=none, *args, **kwargs) ISO-8601 datetime schema type. deserialize(value, **kwargs) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. serialize(value, **kwargs) Serialization of value. class halogen.types.isoutcdate(validators=none, *args, **kwargs) ISO-8601 date schema type in UTC timezone. class halogen.types.isoutcdatetime(validators=none, *args, **kwargs) ISO-8601 datetime schema type in UTC timezone. deserialize(value, **kwargs) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. format_as_utc(value) Format UTC times. serialize(value, **kwargs) Serialization of value. class halogen.types.int(validators=none, *args, **kwargs) Int schema type. deserialize(value, **kwargs) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. serialize(value, **kwargs) Serialization of value. class halogen.types.list(item_type=none, allow_scalar=false, *args, **kwargs) List type for Halogen schema attribute. deserialize(value, **kwargs) Deserialize every item of the list. serialize(value, **kwargs) Serialize every item of the list. class halogen.types.nullable(nested_type, *args, **kwargs) Nullable type. 28 Chapter 5. Internal API

33 deserialize(value, **kwargs) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. serialize(value, **kwargs) Serialization of value. class halogen.types.string(validators=none, *args, **kwargs) String schema type. deserialize(value, **kwargs) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. serialize(value, **kwargs) Serialization of value. class halogen.types.type(validators=none, *args, **kwargs) Base class for creating types. deserialize(value) Deserialization of value. Returns Deserialized value. Raises halogen.exception.validationerror exception if value is not valid. static is_type() Determine if value is an instance or subclass of the class Type. serialize(value, **kwargs) Serialization of value. Halogen schema primitives. class halogen.schema.accessor(getter=none, setter=none) Object that encapsulates the getter and the setter of the attribute. get(obj, **kwargs) Get an attribute from a value. Parameters obj Object to get the attribute value from. Returns Value of object s attribute. set(obj, value) Set value for obj s attribute. Parameters obj Result object or dict to assign the attribute to. value Value to be assigned. class halogen.schema.attr(attr_type=none, attr=none, required=true, **kwargs) Schema attribute. accessor Get an attribute s accessor with the getter and the setter. Returns Accessor instance. 29

34 compartment The key of the compartment this attribute will be placed into (for example: _links or _embedded). deserialize(value) Deserialize the attribute from a HAL structure. Get the value from the HAL structure from the attribute s compartment using the attribute s name as a key, convert it using the attribute s type. Schema will either return it to parent schema or will assign to the output value if specified using the attribute s accessor setter. Parameters value HAL structure to get the value from. Returns Deserialized attribute value. Raises ValidationError. key The key of the this attribute will be placed into (within it s compartment). serialize(value, **kwargs) Serialize the attribute of the input data. Gets the attribute value with accessor and converts it using the type serialization. Schema will place this serialized value into corresponding compartment of the HAL structure with the name of the attribute as a key. Parameters value Value to get the attribute value from. Returns Serialized attribute value. setter(setter) Set an attribute setter accessor function. Can be used as a def set_total(obj, value): obj.total = value halogen.schema.bypass(value) Bypass getter. class halogen.schema.curie(name, href, templated=none, type=none) Curie object. class halogen.schema.embedded(attr_type=none, attr=none, curie=none, required=true) Embedded attribute of schema. compartment Embedded objects are placed in the _objects. key Embedded supports curies. class halogen.schema.link(attr_type=none, attr=none, key=none, required=true, curie=none, templated=none, type=none, deprecation=none) Link attribute of a schema. compartment Return the compartment in which Links are placed (_links). deserialize(value) Link doesn t support deserialization. key The key of the this attribute will be placed into (within it s compartment). Note Links support curies. 30 Chapter 5. Internal API

35 class halogen.schema.linklist(attr_type=none, attr=none, required=true, curie=none) List of links attribute of a schema. class halogen.schema.schema(validators=none, *args, **kwargs) Schema is the basic class used for setting up schemas. halogen.schema.attr(*args, **kwargs) Attribute as a decorator alias. Decorates the getter function default=none) def total(obj): return sum((item.amount for item in obj.items), 0) This is identical to using attr with a lambda, but more practical in case of larger functions: total = halogen.attr(amounttype(), default=none, attr=lambda obj: sum((item.amount for item in obj.items), 0)) Halogen exceptions. exception halogen.exceptions.validationerror(errors, attr=none, index=none) Validation failed. to_dict() Return a dictionary representation of the error. Halogen basic type validators. Returns A dict with the keys: - attr: Attribute which contains the error, or <root> if it refers to the schema root. - errors: A list of dictionary representations of the errors. class halogen.validators.greatthanequal(value, value_err=none) Greater than or equal. validate(value) Validate the value. Parameters value Value to validate. Raises halogen.exception.validationerror exception when value is invalid. class halogen.validators.length(min_length=none, max_length=none, min_err=none, max_err=none) Length validator that checks the length of a List-like type. validate(value) Validate the length of a list. Parameters value List of values. Raises halogen.exception.validationerror exception when length of the list is less than minimum or greater than maximum. class halogen.validators.lessthanequal(value, value_err=none) Less than or equal. validate(value) Validate the value. Parameters value Value to validate. Raises halogen.exception.validationerror exception when value is invalid. 31

36 class halogen.validators.range(min=none, max=none, min_err=none, max_err=none) Range validator. Validator which succeeds if the value it is passed is greater or equal to min and less than or equal to max. If min is not specified, or is specified as None, no lower bound exists. If max is not specified, or is specified as None, no upper bound exists. validate(value) Validate value. Parameters value Value which should be validated. Raises halogen.exception.validationerror exception when either if value less than min in case when min is not None or if value greater than max in case when max is not None. class halogen.validators.validator Base validator. classmethod validate(value) Validate the value. Parameters value Value to validate. Raises halogen.exception.validationerror exception when value is invalid. 32 Chapter 5. Internal API

37 Python Module Index h halogen.exceptions, 31 halogen.schema, 29 halogen.types, 27 halogen.validators, 31 33

38 34 Python Module Index

39 Index A Accessor (class in halogen.schema), 29 accessor (halogen.schema.attr attribute), 29 Amount (class in halogen.types), 27 amount_object_to_dict() (halogen.types.amount method), 27 Attr (class in halogen.schema), 29 attr() (in module halogen.schema), 31 B Boolean (class in halogen.types), 27 BYPASS() (in module halogen.schema), 30 C compartment (halogen.schema.attr attribute), 29 compartment (halogen.schema.embedded attribute), 30 compartment (halogen.schema.link attribute), 30 Curie (class in halogen.schema), 30 D deserialize() (halogen.schema.attr method), 30 deserialize() (halogen.schema.link method), 30 deserialize() (halogen.types.amount method), 27 deserialize() (halogen.types.boolean method), 27 deserialize() (halogen.types.int method), 28 deserialize() (halogen.types.isodatetime method), 28 deserialize() (halogen.types.isoutcdatetime method), 28 deserialize() (halogen.types.list method), 28 deserialize() (halogen.types.nullable method), 28 deserialize() (halogen.types.string method), 29 deserialize() (halogen.types.type method), 29 E Embedded (class in halogen.schema), 30 F format_as_utc() (halogen.types.isoutcdatetime method), 28 G get() (halogen.schema.accessor method), 29 GreatThanEqual (class in halogen.validators), 31 H halogen.exceptions (module), 31 halogen.schema (module), 29 halogen.types (module), 27 halogen.validators (module), 31 I Int (class in halogen.types), 28 is_type() (halogen.types.type static method), 29 ISODateTime (class in halogen.types), 28 ISOUTCDate (class in halogen.types), 28 ISOUTCDateTime (class in halogen.types), 28 K key (halogen.schema.attr attribute), 30 key (halogen.schema.embedded attribute), 30 key (halogen.schema.link attribute), 30 L Length (class in halogen.validators), 31 LessThanEqual (class in halogen.validators), 31 Link (class in halogen.schema), 30 LinkList (class in halogen.schema), 31 List (class in halogen.types), 28 N Nullable (class in halogen.types), 28 R Range (class in halogen.validators), 31 S Schema (class in halogen.schema), 31 serialize() (halogen.schema.attr method), 30 35

40 serialize() (halogen.types.amount method), 27 serialize() (halogen.types.boolean method), 28 serialize() (halogen.types.int method), 28 serialize() (halogen.types.isodatetime method), 28 serialize() (halogen.types.isoutcdatetime method), 28 serialize() (halogen.types.list method), 28 serialize() (halogen.types.nullable method), 29 serialize() (halogen.types.string method), 29 serialize() (halogen.types.type method), 29 set() (halogen.schema.accessor method), 29 setter() (halogen.schema.attr method), 30 String (class in halogen.types), 29 T to_dict() (halogen.exceptions.validationerror method), 31 Type (class in halogen.types), 29 V validate() (halogen.validators.greatthanequal method), 31 validate() (halogen.validators.length method), 31 validate() (halogen.validators.lessthanequal method), 31 validate() (halogen.validators.range method), 32 validate() (halogen.validators.validator class method), 32 ValidationError, 31 Validator (class in halogen.validators), Index

Connexion Documentation

Connexion Documentation Connexion Documentation Release 0.5 Zalando SE Nov 16, 2017 Contents 1 Quickstart 3 1.1 Prerequisites............................................... 3 1.2 Installing It................................................

More information

json-rpc Documentation

json-rpc Documentation json-rpc Documentation Release 1.11.0 Kirill Pavlov May 02, 2018 Contents 1 Features 3 2 Contents 5 2.1 Quickstart................................................ 5 2.2 Method dispatcher............................................

More information

Kaiso Documentation. Release 0.1-dev. onefinestay

Kaiso 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 information

redis-lua Documentation

redis-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 information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming HTTP & HTML & JSON Harry Smith University of Pennsylvania November 1, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 10 November 1, 2017 1 / 22 Outline 1 HTTP Requests

More information

web-transmute Documentation

web-transmute Documentation web-transmute Documentation Release 0.1 Yusuke Tsutsumi Dec 19, 2017 Contents 1 Writing transmute-compatible functions 3 1.1 Add function annotations for input type validation / documentation..................

More information

bottle-rest Release 0.5.0

bottle-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 information

CSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern

CSE : 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

JsonWeb Documentation

JsonWeb Documentation JsonWeb Documentation Release 0.8.2 shawn adams May 28, 2017 Contents 1 Main documentation 3 1.1 jsonweb.encode encode your python classes........................... 3 1.2 jsonweb.decode decode your python

More information

Traits CLI Documentation

Traits CLI Documentation Traits CLI Documentation Release 0.1.0 Takafumi Arakaki March 22, 2013 CONTENTS 1 Links 3 2 Installation 5 3 Dependencies 7 4 Sample 9 5 CLI base class 11 6 Utility functions 19 7 Change log 21 7.1 v0.1....................................................

More information

pybdg Documentation Release 1.0.dev2 Outernet Inc

pybdg 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 information

traitlets Documentation

traitlets Documentation traitlets Documentation Release 4.3.2 The IPython Development Team Feb 23, 2017 Contents 1 Using Traitlets 3 1.1 Default values, and checking type and value............................... 3 1.2 observe..................................................

More information

Object Model Comparisons

Object Model Comparisons Object Model Comparisons 1 Languages are designed, just like programs Someone decides what the language is for Someone decides what features it's going to have Can't really understand a language until

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

tolerance Documentation

tolerance Documentation tolerance Documentation Release Alisue Apr 1, 217 Contents 1 tolerance 1 1.1 Features.................................................. 1 1.2 Installation................................................

More information

kvkit Documentation Release 0.1 Shuhao Wu

kvkit Documentation Release 0.1 Shuhao Wu kvkit Documentation Release 0.1 Shuhao Wu April 18, 2014 Contents 1 Introduction to KVKit 3 1.1 Simple Tutorial.............................................. 3 1.2 Indexes..................................................

More information

django-crucrudile Documentation

django-crucrudile Documentation django-crucrudile Documentation Release 0.9.1 Hugo Geoffroy (pstch) July 27, 2014 Contents 1 Installation 1 1.1 From Python package index....................................... 1 1.2 From source...............................................

More information

traitlets Documentation

traitlets Documentation traitlets Documentation Release 5.0.0.dev The IPython Development Team Dec 08, 2017 Contents 1 Using Traitlets 3 1.1 Default values, and checking type and value............................... 3 1.2 observe..................................................

More information

f5-icontrol-rest Documentation

f5-icontrol-rest Documentation f5-icontrol-rest Documentation Release 1.3.10 F5 Networks Aug 04, 2018 Contents 1 Overview 1 2 Installation 3 2.1 Using Pip................................................. 3 2.2 GitHub..................................................

More information

IHIH Documentation. Release Romain Dartigues

IHIH 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 information

COMP519 Web Programming Lecture 20: Python (Part 4) Handouts

COMP519 Web Programming Lecture 20: Python (Part 4) Handouts COMP519 Web Programming Lecture 20: Python (Part 4) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

More information

python-aspectlib Release 0.4.1

python-aspectlib Release 0.4.1 python-aspectlib 0.4.1 Release 0.4.1 May 03, 2014 Contents i ii aspectlib is an aspect-oriented programming, monkey-patch and decorators library. It is useful when changing behavior in existing code is

More information

python-aspectlib Release 0.5.0

python-aspectlib Release 0.5.0 python-aspectlib 0.5.0 Release 0.5.0 March 17, 2014 Contents i ii aspectlib is an aspect-oriented programming, monkey-patch and decorators library. It is useful when changing behavior in existing code

More information

Exceptions. raise type(message) raise Exception(message)

Exceptions. raise type(message) raise Exception(message) Classes Special thanks to Roy McElmurry, Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/.0

More information

New York University School of Continuing and Professional Studies Management and Information Technology. Advanced Python. Homework, Session 5

New York University School of Continuing and Professional Studies Management and Information Technology. Advanced Python. Homework, Session 5 New York University School of Continuing and Professional Studies Management and Information Technology Advanced Python Homework, Session 5 5.1. design classes Guestbook and Entry. These classes will be

More information

COLUMNS. Thinking about Type Checking

COLUMNS. Thinking about Type Checking DAVID BEAZLEY David Beazley is an open source developer and author of the Python Essential Reference (4th Edition, Addison-Wesley, 2009). He is also known as the creator of Swig (http://www.swig.org) and

More information

Flask-RESTful Documentation

Flask-RESTful Documentation Flask-RESTful Documentation Release 0.2.1 Kyle Conroy, Ryan Horn, Frank Stratton January 25, 2015 Contents 1 User s Guide 3 1.1 Installation................................................ 3 1.2 Quickstart................................................

More information

Unicum Documentation. Release alpha. Deutsche Postbank AG

Unicum Documentation. Release alpha. Deutsche Postbank AG Unicum Documentation Release alpha Deutsche Postbank AG Nov 21, 2017 Contents 1 About 1 1.1 unicum.................................................. 1 2 Getting started 3 2.1 Installing.................................................

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming Generators Exceptions and IO Eric Kutschera University of Pennsylvania February 13, 2015 Eric Kutschera (University of Pennsylvania) CIS 192 February 13, 2015 1 / 24 Outline 1

More information

maya-cmds-help Documentation

maya-cmds-help Documentation maya-cmds-help Documentation Release Andres Weber May 28, 2017 Contents 1 1.1 Synopsis 3 1.1 1.1.1 Features.............................................. 3 2 1.2 Installation 5 2.1 1.2.1 Windows, etc............................................

More information

Friday, 11 April 14. Advanced methods for creating decorators Graham Dumpleton PyCon US - April 2014

Friday, 11 April 14. Advanced methods for creating decorators Graham Dumpleton PyCon US - April 2014 Advanced methods for creating decorators Graham Dumpleton PyCon US - April 2014 Intermission Rant about the history of this talk and why this topic matters. Python decorator syntax @function_wrapper def

More information

flask-ldap3-login Documentation

flask-ldap3-login Documentation flask-ldap3-login Documentation Release 0.0.0.dev0 Nick Whyte Nov 09, 2018 Contents 1 Contents: 3 1.1 Configuration............................................... 3 1.2 Quick Start................................................

More information

Programming I. Course 9 Introduction to programming

Programming I. Course 9 Introduction to programming Programming I Course 9 Introduction to programming What we talked about? Modules List Comprehension Generators Recursive Functions Files What we talk today? Object Oriented Programming Classes Objects

More information

Discovering Descriptors

Discovering Descriptors Discovering Descriptors Mariano Anaya EuroPython - July 2017 rmariano rmarianoa def Learning about descriptors not only provides access to a larger toolset, it creates a deeper understanding of how Python

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College August 29, 2018 Outline Outline 1 Chapter 2: Data Abstraction Outline Chapter 2: Data Abstraction 1 Chapter 2: Data Abstraction

More information

PrettyPandas Documentation

PrettyPandas Documentation PrettyPandas Documentation Release 0.0.4 Henry Hammond Mar 26, 2018 Contents 1 Features 3 2 Installation 5 3 Contributing 7 4 Contents 9 4.1 Quick Start................................................

More information

Data Structures (list, dictionary, tuples, sets, strings)

Data Structures (list, dictionary, tuples, sets, strings) Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access

More information

validictory Documentation

validictory Documentation validictory Documentation Release 1.1.2 James Turk Dec 01, 2017 Contents 1 Overview 3 2 Obtaining validictory 5 3 Contents 7 3.1 Using validictory............................................. 7 3.2 validictory

More information

JSON models Documentation

JSON models Documentation JSON models Documentation Release 2.3 Szczepan Cieślik Apr 29, 2018 Contents 1 JSON models 3 1.1 Features.................................................. 3 1.2 More...................................................

More information

treelib Documentation

treelib 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 information

xmodels Documentation

xmodels Documentation xmodels Documentation Release 0.1.0 Bernd Meyer November 02, 2014 Contents 1 xmodels 1 2 Overview 3 2.1 Installation................................................ 3 2.2 Usage...................................................

More information

Python Essential Reference, Second Edition - Chapter 5: Control Flow Page 1 of 8

Python Essential Reference, Second Edition - Chapter 5: Control Flow Page 1 of 8 Python Essential Reference, Second Edition - Chapter 5: Control Flow Page 1 of 8 Chapter 5: Control Flow This chapter describes related to the control flow of a program. Topics include conditionals, loops,

More information

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017 Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable

More information

Connexion Sqlalchemy Utils Documentation

Connexion Sqlalchemy Utils Documentation Connexion Sqlalchemy Utils Documentation Release 0.1.4 Michael Housh Apr 17, 2017 Contents 1 Connexion Sqlalchemy Utils 3 1.1 Features.................................................. 3 1.2 Running example

More information

PyTrie Documentation. Release 0.3. George Sakkis

PyTrie 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 information

Dogeon Documentation. Release Lin Ju

Dogeon 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 information

doubles Documentation

doubles Documentation doubles Documentation Release 1.1.0 Jimmy Cuadra August 23, 2015 Contents 1 Installation 3 2 Integration with test frameworks 5 2.1 Pytest................................................... 5 2.2 Nose...................................................

More information

DSC 201: Data Analysis & Visualization

DSC 201: Data Analysis & Visualization DSC 201: Data Analysis & Visualization Classes Dr. David Koop Tuple, List, Dictionary, or Set? [1,2,"abc"] 2 Tuple, List, Dictionary, or Set? {"a", 1, 2} 3 Tuple, List, Dictionary, or Set? {} 4 Tuple,

More information

Custom Actions for argparse Documentation

Custom Actions for argparse Documentation Custom Actions for argparse Documentation Release 0.4 Hai Vu October 26, 2015 Contents 1 Introduction 1 2 Information 3 2.1 Folder Actions.............................................. 3 2.2 IP Actions................................................

More information

Advanced Python. generators, decorators, context managers. Zbigniew Jędrzejewski-Szmek. George Mason University

Advanced Python. generators, decorators, context managers. Zbigniew Jędrzejewski-Szmek. George Mason University Advanced Python generators, decorators, context managers Zbigniew Jędrzejewski-Szmek George Mason University Python Summer School, Zürich, September 05, 2013 Version Zürich-98-ge13be00 This work is licensed

More information

apy Documentation Release 1.0 Felix Carmona, stagecoach.io

apy Documentation Release 1.0 Felix Carmona, stagecoach.io apy Documentation Release 1.0 Felix Carmona, stagecoach.io July 19, 2014 Contents 1 Starting up an Application 3 1.1 The directory structure.......................................... 3 1.2 Running the

More information

Python Interview Questions & Answers

Python Interview Questions & Answers Python Interview Questions & Answers Q 1: What is Python? Ans: Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high

More information

Programming Languages: Application and Interpretation

Programming Languages: Application and Interpretation Programming Languages: Application and Interpretation Version 6.7 October 26, 2016 This is the documentation for the software accompanying the textbook Programming Languages: Application and Interpretation

More information

User Defined Types. Babes-Bolyai University Lecture 06. Lect Phd. Arthur Molnar. User defined types. Python scope and namespace

User Defined Types. Babes-Bolyai University Lecture 06. Lect Phd. Arthur Molnar. User defined types. Python scope and namespace ? User Defined Types Babes-Bolyai University arthur@cs.ubbcluj.ro Overview? 1? 2 3 ? NB! Types classify values. A type denotes a domain (a set of values) operations on those values. ? Object oriented programming

More information

pygtrie Release Jul 03, 2017

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 information

What is a class? Responding to messages. Short answer 7/19/2017. Code Listing 11.1 First Class. chapter 11. Introduction to Classes

What is a class? Responding to messages. Short answer 7/19/2017. Code Listing 11.1 First Class. chapter 11. Introduction to Classes chapter 11 Code Listing 11.1 First Class Introduction to Classes What is a class? If you have done anything in computer science before, you likely will have heard the term object oriented programming (OOP)

More information

pyprika Documentation

pyprika Documentation pyprika Documentation Release 1.0.0 Paul Kilgo February 16, 2014 Contents i ii Pyprika is a Python library for parsing and managing recipes. Its major features are: Support for recognizing a human-friendly

More information

msgpack Documentation

msgpack Documentation msgpack Documentation Release 0.4 Author 2017-11-04 Contents 1 API reference 3 Python Module Index 9 i ii MessagePack is a efficient format for inter language data exchange. Contents 1 2 Contents CHAPTER

More information

Java for Python Programmers. Comparison of Python and Java Constructs Reading: L&C, App B

Java for Python Programmers. Comparison of Python and Java Constructs Reading: L&C, App B Java for Python Programmers Comparison of Python and Java Constructs Reading: L&C, App B 1 General Formatting Shebang #!/usr/bin/env python Comments # comments for human readers - not code statement #

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

More information

Advanced Python. Executive Summary, Session 1

Advanced Python. Executive Summary, Session 1 Advanced Python Executive Summary, Session 1 OBJECT: a unit of data of a particular type with characteristic functionality (i.e., methods and/or use with operators). Everything in Python is an object.

More information

Sage Reference Manual: Python technicalities

Sage Reference Manual: Python technicalities Sage Reference Manual: Python technicalities Release 8.1 The Sage Development Team Dec 09, 2017 CONTENTS 1 Various functions to debug Python internals 3 2 Variants of getattr() 5 3 Metaclasses for Cython

More information

pysharedutils Documentation

pysharedutils 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 information

Python A Technical Introduction. James Heliotis Rochester Institute of Technology December, 2009

Python A Technical Introduction. James Heliotis Rochester Institute of Technology December, 2009 Python A Technical Introduction James Heliotis Rochester Institute of Technology December, 2009 Background & Overview Beginnings Developed by Guido Van Rossum, BDFL, in 1990 (Guido is a Monty Python fan.)

More information

traity Documentation Release Sean Ross-Ross

traity Documentation Release Sean Ross-Ross traity Documentation Release 0.0.1 Sean Ross-Ross August 16, 2016 Contents 1 Traity s API 3 1.1 Events.................................................. 3 1.2 Static Properties.............................................

More information

Queries Documentation

Queries Documentation Queries Documentation Release 2.0.0 Gavin M. Roy Jan 31, 2018 Contents 1 Installation 3 2 Contents 5 3 Issues 27 4 Source 29 5 Inspiration 31 6 Indices and tables 33 i ii Queries is a BSD licensed opinionated

More information

django-conduit Documentation

django-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 information

django-oauth2-provider Documentation

django-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 information

pyshk Documentation Release Jeremy Low

pyshk Documentation Release Jeremy Low pyshk Documentation Release 1.1.0 Jeremy Low December 20, 2015 Contents 1 Warnings 3 2 Installation 5 3 Authentication Tutorial 7 3.1 Introduction............................................... 7 3.2

More information

Fun with Python Descriptors

Fun with Python Descriptors Fun with Python Descriptors Author: Jeff Rush Date: 2006-11-25 include directive disabled... include:: Overview What are descriptors? Implementation: attribute watcher Implementation: property()

More information

Avro Specification

Avro 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 information

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013 University of Washington CSE 140 Introduction to Data Programming Winter 2013 Midterm exam February 6, 2013 Name: Solutions UW Net ID (username): This exam is closed book, closed notes. You have 50 minutes

More information

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul CIS192 Python Programming Web Frameworks and Web APIs Harry Smith University of Pennsylvania March 29, 2016 Harry Smith (University of Pennsylvania) CIS 192 March 29, 2016 1 / 25 Quick housekeeping Last

More information

Week 2. Classes and Objects

Week 2. Classes and Objects Week 2 Classes and Objects Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0

More information

funcsigs Documentation

funcsigs Documentation funcsigs Documentation Release 0.4 Aaron Iles December 20, 2013 Contents i ii CHAPTER 1 The Funcsigs Package funcsigs is a backport of the PEP 362 function signature features from Python 3.3 s inspect

More information

MyGeotab Python SDK Documentation

MyGeotab Python SDK Documentation MyGeotab Python SDK Documentation Release 0.8.0 Aaron Toth Dec 13, 2018 Contents 1 Features 3 2 Usage 5 3 Installation 7 4 Documentation 9 5 Changes 11 5.1 0.8.0 (2018-06-18)............................................

More information

Exceptions & a Taste of Declarative Programming in SQL

Exceptions & a Taste of Declarative Programming in SQL Exceptions & a Taste of Declarative Programming in SQL David E. Culler CS8 Computational Structures in Data Science http://inst.eecs.berkeley.edu/~cs88 Lecture 12 April 18, 2016 Computational Concepts

More information

Python. Executive Summary

Python. 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 information

Recall. Key terms. Review. Encapsulation (by getters, setters, properties) OOP Features. CSC148 Intro. to Computer Science

Recall. Key terms. Review. Encapsulation (by getters, setters, properties) OOP Features. CSC148 Intro. to Computer Science CSC148 Intro. to Computer Science Lecture 3: designing classes, special methods, composition, inheritance, Stack, Sack Amir H. Chinaei, Summer 2016 Office Hours: R 10-12 BA4222 ahchinaei@cs.toronto.edu

More information

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017 SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

TH IRD EDITION. Python Cookbook. David Beazley and Brian K. Jones. O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Tokyo

TH IRD EDITION. Python Cookbook. David Beazley and Brian K. Jones. O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Tokyo TH IRD EDITION Python Cookbook David Beazley and Brian K. Jones O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Tokyo Table of Contents Preface xi 1. Data Structures and Algorithms 1 1.1. Unpacking

More information

COMPUTER SCIENCE IN THE NEWS. CS61A Lecture 21 Scheme TODAY REVIEW: DISPATCH DICTIONARIES DISPATCH DICTIONARIES 7/27/2012

COMPUTER SCIENCE IN THE NEWS. CS61A Lecture 21 Scheme TODAY REVIEW: DISPATCH DICTIONARIES DISPATCH DICTIONARIES 7/27/2012 COMPUTER SCIENCE IN THE NEWS CS6A Lecture 2 Scheme Jom Magrotker UC Berkeley EECS July 24, 202 http://spectrum.ieee.org/tech talk/robotics/artificial intelligence/a texas hold em tournament for ais 2 TODAY

More information

Exception Handling. Genome 559

Exception Handling. Genome 559 Exception Handling Genome 559 Review - classes Use your own classes to: - package together related data - conceptually organize your code - force a user to conform to your expectations Class constructor:

More information

Objects. say something to express one's disapproval of or disagreement with something.

Objects. say something to express one's disapproval of or disagreement with something. Objects say something to express one's disapproval of or disagreement with something. class Person: def init (self, name, age): self.name = name self.age = age p1 = Person("John", 36) class Person: def

More information

py3o.template Documentation

py3o.template Documentation py3o.template Documentation Release 0.9.10 Florent Aide Jan 18, 2018 Contents 1 The Python part 3 2 Templating with LibreOffice 5 2.1 Use control structures.......................................... 5

More information

Flask-Cors Documentation

Flask-Cors Documentation Flask-Cors Documentation Release 3.0.4 Cory Dolphin Apr 26, 2018 Contents 1 Installation 3 2 Usage 5 2.1 Simple Usage............................................... 5 3 Documentation 7 4 Troubleshooting

More information

Beyond Blocks: Python Session #1

Beyond Blocks: Python Session #1 Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike

More information

django-gollum Documentation

django-gollum Documentation django-gollum Documentation Release 1.0.0 Luke Sneeringer December 11, 2016 Contents 1 Installation 3 2 Dependencies 5 3 Getting Started 7 4 Getting Help 9 5 License 11 6 Index 13 6.1 Using django-gollum...........................................

More information

Django Service Objects Documentation

Django Service Objects Documentation Django Service Objects Documentation Release 0.5.0 mixxorz, c17r Sep 11, 2018 User Documentation 1 What? 1 2 Installation 3 2.1 Philosophy................................................ 3 2.2 Usage...................................................

More information

databuild Documentation

databuild Documentation databuild Documentation Release 0.0.10 Flavio Curella May 15, 2015 Contents 1 Contents 3 1.1 Installation................................................ 3 1.2 Quickstart................................................

More information

Mastering Python Decorators

Mastering Python Decorators Mastering Python Decorators One of the hallmarks of good Python is the judicious use of decorators to optimize, simplify and add new functionality to existing code. Decorators are usually seen as an advanced

More information

pyramid_swagger Documentation

pyramid_swagger Documentation pyramid_swagger Documentation Release 0.1.0 Scott Triglia Nov 14, 2017 Contents 1 What is Swagger? 3 2 Quickstart 5 3 Changelog 11 4 Configuring pyramid_swagger 17 5 Migrating to Swagger 2.0 23 6 External

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

Stepic Plugins Documentation

Stepic Plugins Documentation Stepic Plugins Documentation Release 0 Stepic Team May 06, 2015 Contents 1 Introduction 3 1.1 Quiz Architecture............................................ 3 1.2 Backend Overview............................................

More information

CPE v1.2.1 Documentation

CPE v1.2.1 Documentation CPE v1.2.1 Documentation Release 1.2.1 Roberto Abdelkader Martínez Pérez, Alejandro Galindo García Nov 19, 2018 Contents 1 Introduction 3 1.1 Matching............................................... 3

More information

Introduction to Python programming, II

Introduction to Python programming, II Grid Computing Competence Center Introduction to Python programming, II Riccardo Murri Grid Computing Competence Center, Organisch-Chemisches Institut, University of Zurich Nov. 16, 2011 Today s class

More information

Kuyruk Documentation. Release 0. Cenk Altı

Kuyruk Documentation. Release 0. Cenk Altı Kuyruk Documentation Release 0 Cenk Altı Mar 07, 2018 Contents 1 About Kuyruk 3 2 User s Guide 5 3 API Reference 17 4 Indices and tables 21 Python Module Index 23 i ii Welcome to Kuyruk s documentation.

More information

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes Based on Introduction to Java Programming, Y. Daniel Liang, Brief Version, 10/E 1 Creating Classes and Objects Classes give us a way of defining custom data types and associating data with operations on

More information

djangotribune Documentation

djangotribune Documentation djangotribune Documentation Release 0.7.9 David THENON Nov 05, 2017 Contents 1 Features 3 2 Links 5 2.1 Contents................................................. 5 2.1.1 Install..............................................

More information

Examining the Code. [Reading assignment: Chapter 6, pp ]

Examining the Code. [Reading assignment: Chapter 6, pp ] Examining the Code [Reading assignment: Chapter 6, pp. 91-104] Static white-box testing Static white-box testing is the process of carefully and methodically reviewing the software design, architecture,

More information