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
description = 'demonstration of an error with nested joins.' | |
cft = CloudFormationTemplate(description) | |
site_url = join('.', ref('AWS::StackName'), 'mmstacks.net'), | |
cft.resources.update({'Value': join('', 'site_url: ', site_url)}) |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "demonstration of an error with nested joins.", | |
"Resources": { | |
"Value": { | |
"Fn::Join": [ | |
"", | |
[ | |
"site_url: ", | |
[ |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "demonstration of an error with nested joins.", | |
"Resources": { | |
"Value": { | |
"Fn::Join": [ | |
"", | |
[ | |
"site_url: ", | |
{ |
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
COMMAND LINE: | |
$ export OAUTH_CLIENT_ID=ffffbbbb777733330000 | |
$ oauthtoken.py staff edx | |
3bae7d8cf43a69e34a35188636c3553e8b52a89c | |
$ token=`oauthtoken.py staff edx` | |
$ curl -H "Authorization: Bearer $token" http://localhost:8000/api/user/v1/accounts/staff | |
{"username":"staff",...} | |
PYTHON |
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 f(): | |
... return {1, 2, 3} | |
... | |
>>> dis.dis(f) | |
2 0 LOAD_CONST 1 (1) | |
3 LOAD_CONST 2 (2) | |
6 LOAD_CONST 3 (3) | |
9 BUILD_SET 3 | |
12 RETURN_VALUE | |
>>> def g(): |
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
[alias] | |
gl1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
gl2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
glog = !"git gl2" |
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
from collections import namedtuple, OrderedDict | |
import functools | |
import pytest | |
def typednamedtuple(name, fields): | |
factory = namedtuple(name, fields.keys()) | |
@functools.wraps(factory) | |
def wrapper(*args, **kwargs): | |
for spec, arg in zip(fields.iteritems(), args): |
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
class UniversalSet(set): | |
def __init__(self): | |
super(UniversalSet, self).__init__([]) | |
def __and__(self, other): | |
if not isinstance(other, set): | |
other = set(other) | |
return other | |
def __rand__(self, other): |
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
diff --git a/lms/djangoapps/course_api/serializers.py b/lms/djangoapps/course_api/serializers.py | |
index 6f30d7e..4ab8d45 100644 | |
--- a/lms/djangoapps/course_api/serializers.py | |
+++ b/lms/djangoapps/course_api/serializers.py | |
@@ -18,12 +18,12 @@ class CourseSerializer(serializers.Serializer): # pylint: disable=abstract-meth | |
Serializer for Course objects | |
""" | |
- id = serializers.CharField(read_only=True) # pylint: disable=invalid-name | |
+ course_id = serializers.CharField(source='id', read_only=True) # pylint: disable=invalid-name |
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
class PathMap(object): | |
sep = u'.' | |
def __init__(self): | |
self._store = {} | |
def __setitem__(self, key, value): | |
segments = key.rstrip(self.sep).split(self.sep) | |
next_ = self._store |
OlderNewer