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
>>> from invoices.api.serializers import User | |
>>> u = User(many=True) | |
>>> print(u.parent) | |
None | |
>>> type(u.child.parent) | |
<class 'rest_framework.serializers.ListSerializer'> | |
>>> u2 = User() | |
>>> print(u2.parent) | |
None | |
>>> |
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 Vue from 'vue' | |
import router from './router' | |
import store from './store' | |
import page from './components/Page' | |
import Vuetify from 'vuetify' | |
store.dispatch('urls') | |
new Vue({ | |
router, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Welcome to Vuetify</title> | |
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet" type="text/css"> | |
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet" type="text/css"></link> | |
<link href="styles.css" rel="stylesheet" type="text/css"> |
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
try: | |
fd = fopen('/tmp/demo', 'w') | |
except IsADirectoryError: | |
print('This is a directory. Expecting a file') |
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
try: | |
fd = fopen('/tmp/demo', 'w') | |
except OSError as e: | |
if e.errno != 21: | |
raise | |
print('This is a directory. Expecting a file') |
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
class MyCustomException(Exception): | |
pass |
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
### Keybase proof | |
I hereby claim: | |
* I am xordoquy on github. | |
* I am xordoquy (https://keybase.io/xordoquy) on keybase. | |
* I have a public key whose fingerprint is 26C7 B0F3 4A76 022E 7730 2FC9 029B B5BB 595F B559 | |
To claim this, I am signing this object: |
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
array = [] | |
for i in range(5): | |
def demo(): | |
return i | |
array.append(demo) | |
[item() for item in array] |
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
# BAD: Incorrect code | |
class MyManager(models.Manager): | |
# ... | |
pass | |
# Sets the attribute on an instance of MyManager. Django will | |
# ignore this setting. | |
mgr = MyManager() | |
mgr.use_for_related_fields = True |
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
result = [] | |
for i in range(5): | |
def f(): | |
print(i) | |
result.append(f) | |
for f in result: | |
f() | |
NewerOlder