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 A: | |
def method(self): | |
print(42) | |
class B(A): | |
def method(self): | |
print('overriding') | |
super( self.__class__, self ).method() | |
class C(B): |
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 requests | |
requests.post('https://upload.wistia.com', | |
{'url': 'https://s3.us-east-2.amazonaws.com/wistia-glitches/lenny-example-video.mp4', | |
'api_password':'your_api_password_from_wistia'}) |
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 re | |
import tokenize | |
import astroid | |
def _build_assign(value): | |
return astroid.parse('_ = {}'.format(value)).body[0] |
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
"""test for Python 3 string formatting error | |
""" | |
# pylint: disable=too-few-public-methods, import-error, unused-argument, line-too-long, no-absolute-import | |
import os | |
from missing import Missing | |
__revision__ = 1 | |
class Custom(object): | |
""" Has a __getattr__ """ |
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
# Using a helper function to evaluate the result of .metaclass | |
from astroid.helpers import evaluate_metaclass | |
m = cls.metaclass() | |
real_m = evaluate_metaclass(m) | |
----------------------- | |
# Adding a keyword parameter |
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
# mutable list | |
def foobar(arg_string="abc", arg_list=[]): | |
print arg_string, arg_list | |
arg_string = arg_string + "xyz" | |
arg_list.append("F") | |
for i in range(4): | |
foobar() | |
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 | |
VALUE=$(cat) | |
echo $VALUE | curl -F 'sprunge=<-' http://sprunge.us |
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 fields import Tuple | |
import abc, six | |
@six.add_metaclass(abc.ABCMeta) | |
class Pair(Tuple.a.b): | |
@abc.abstractmethod | |
def test(self): | |
pass |
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 defaultdict | |
d = defaultdict(int) | |
d[4] = 5 | |
for i in d: | |
if not d[3]: | |
# watch it burn. |