- Your favorite text editor
- Python 3 (3.5 is the latest)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import re | |
import routes | |
from keystone import assignment | |
from keystone import auth | |
from keystone import catalog | |
from keystone.common import controller | |
from keystone import credential |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _require_single_keyword_arg(self, **kwargs): | |
provided_params = [name for name, value in kwargs.iteritems() if value] | |
if not provided_params: raise VE('Something must be passed in') | |
if len(provided_params) != 1: | |
msg = _('Only a single keyword arg allowed: received %s') % ', '.join(provided_params) | |
raise exception.ValidationError(msg) |
Python Koans - An Introduction To Python
Python is a fun, dynamic, flexible language for solving all kinds of problems. It's used everywhere from modest scripts to large systems, powering things like websites, games, film production tools, scientific analysis, and even space programs. Best of all, it's a language that "fits your brain".
This session is a mostly self guided introduction to Python through koans. What’s a koan you ask? It’s a small puzzle or exercise expressed as a test, designed to build your knowledge of the Python syntax and idioms incrementially.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
class Logger(object): | |
__metaclass__ abc.ABCMeta | |
@abstractmethod | |
def log_it(self, message, *args, **kwargs): | |
raise NotImplemented | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
class Logger(object): | |
__metaclass__ abc.ABCMeta | |
@abstractmethod | |
def log_it(self, message, *args, **kwargs): | |
raise NotImplemented | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": [ | |
{ | |
"local": { | |
"user": { | |
"name": "@@UserName@@" | |
} | |
}, | |
"remote": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": [ | |
{ | |
"local": { | |
"user": "name" | |
}, | |
"remote": [ | |
{ | |
"type": "UserName" | |
} |