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
#!/usr/bin/env python | |
# coding: utf-8 | |
from __future__ import unicode_literals | |
import csv | |
import sys | |
from collections import OrderedDict | |
import couchdbkit | |
BASE_URL = 'http://books.scielo.org/id/%s' |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
""" | |
Script that shows all pull-requests from all repos of an | |
organization waiting for revision. | |
need to pip install prettytable | |
""" | |
import urllib2 | |
import json |
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
# coding:utf-8 | |
import couchdbkit | |
BASE_URL = 'http://books.scielo.org/id/%s' | |
server = couchdbkit.Server(uri='http://192.168.1.12:5984/') | |
db = server['scielobooks_1a'] | |
print 'sbid|title|url' |
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
_memo = {} | |
data = {'user': 'gus'} | |
def get_from_other_resource(field): | |
print 'other resource - [%s]' % (field) | |
return data[field] | |
print 'Imprimindo o valor da var _memo. A funcao get_from_other_resource sera invocada:' | |
print _memo.setdefault('user', get_from_other_resource('user')) |
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
!ID 0 | |
!v100!ABCD. Arquivos Brasileiros de Cirurgia Digestiva (São Paulo) | |
!v400!0102-6720 | |
!v035!PRINT | |
!v935! | |
!v150!ABCD, arq. bras. cir. dig. | |
!v151!ABCD, arq. bras. cir. dig | |
!v610! | |
!v440!medicina | |
!v440!cirurgia |
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 caching.base | |
class AppCustomManager(models.Manager): | |
""" | |
Domain specific model managers. | |
""" | |
def available(self, availability=None): | |
""" | |
Filter the queryset based on its availability. |
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 render(self, context): | |
object_record = self.object_record.resolve(context) | |
if object_record.paginator.count > settings.PAGINATION__ITEMS_PER_PAGE: | |
class_li_previous = 'disabled' if not object_record.has_previous() else '' | |
class_li_next = 'disabled' if not object_record.has_next() else '' | |
html_pages = [] | |
for page in object_record.paginator.page_range: | |
class_li_page = 'active' if object_record.number == page else '' |
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
#!/usr/bin/env python | |
# coding:utf-8 | |
""" | |
>>> livro = Livro('Eram os deuses astronautas?', 'Erich von Daniken') | |
>>> livro.autor_individual | |
'DANIKEN, Erich von' | |
>>> livro2 = Livro('O menino maluquinho', 'Ziraldo') | |
Traceback (most recent call last): | |
... |
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
#!/usr/bin/env python | |
# coding:utf-8 | |
""" | |
>>> livro = Livro('Eram os deuses astronautas?', 'Erich von Daniken') | |
>>> livro.autor_individual | |
'DANIKEN, Erich von' | |
>>> livro2 = Livro('O menino maluquinho', 'Ziraldo') | |
Traceback (most recent call last): | |
... |
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
#!/usr/bin/env python | |
# coding:utf-8 | |
""" | |
>>> livro = Livro('Eram os deuses astronautas?', 'Erich von Daniken') | |
>>> livro.autor_individual | |
'DANIKEN, Erich von' | |
>>> livro2 = Livro('O menino maluquinho', 'Ziraldo') | |
Traceback (most recent call last): | |
... |