- Your favorite text editor
- Python 3 (3.5 is the latest)
This file contains 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 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 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 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 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" | |
} |
This file contains 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
#!/bin/bash | |
host=$1 | |
pub_key=$2 | |
function help { | |
echo 'usage: ./bootstrap-devstack.sh host public_key' | |
echo ' example: ./bootstrap-devstack.sh 1.1.1.1 ~/.ssh/id_dsa.pub' | |
exit 1 | |
} |