code
stringlengths
1
1.72M
language
stringclasses
1 value
from distutils.core import setup version = '%s.%s' % __import__('django_restapi').VERSION[:2] setup(name='django-rest', version=version, packages=['django_restapi'], author='Andriy Drozdyuk', author_email='drozzy@gmail.com', )
Python
from os.path import realpath DEBUG = True TEMPLATE_DEBUG = True INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.sessions', 'django.contrib.sites', 'django_restapi_tests.polls', 'django_restapi_tests.people' ) SITE_ID=1 ROOT_U...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ...
Python
from datetime import datetime from django.db import models from django.utils.translation import gettext_lazy as _ class Poll(models.Model): question = models.CharField(max_length=200) password = models.CharField(max_length=200) pub_date = models.DateTimeField(_('date published'), default=datetime.now) ...
Python
from binascii import b2a_base64 from datetime import datetime from django.core import serializers from django.test import TestCase from django.utils.functional import curry from django_restapi.authentication import HttpDigestAuthentication from django_restapi_tests.examples.authentication import digest_authfunc from dj...
Python
from django.conf.urls.defaults import * from django.contrib import admin urlpatterns = patterns('', url(r'', include('django_restapi_tests.examples.simple')), url(r'', include('django_restapi_tests.examples.basic')), url(r'', include('django_restapi_tests.examples.template')), url(r'', include('django_rest...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi.receiver import * from django_restapi_tests.polls.models import Poll fullxml_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice xml_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), ...
Python
from django.conf.urls.defaults import * from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django_restapi.resource import Resource from django_restapi_tests.people.models import * # Urls for a resource that does not map 1:1 # to Django models. class FriendshipCollection...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection, Entry, reverse from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice # JSON Test API URLs # # Polls are available at /json/polls/ and # /json/polls/[poll_id]/. # # Different (manua...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice template_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE')...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice simple_poll_resource = Collection( queryset = Poll.objects.all(), responder = XMLResponder(), ) simple_choice_resource ...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice fixedend_poll_resource = Collection( queryset = Poll.objects.all(), responder = XMLResponder(), ) fixedend_choice_resou...
Python
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi.authentication import * from django_restapi_tests.polls.models import Poll # HTTP Basic # # No auth function specified # -> django.contrib.auth.models.User is used. # ...
Python
from django.db import models from django.http import Http404 class Person(models.Model): name = models.CharField(max_length=20) friends = models.ManyToManyField('self') idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers') def __unicode__(self): return self.name d...
Python
from django.test import TestCase from django.utils.functional import curry class GenericTest(TestCase): fixtures = ['initial_data.json'] def setUp(self): self.client.put = curry(self.client.post, REQUEST_METHOD='PUT') self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE'...
Python
from django.db import models # Create your models here.
Python
# Create your views here.
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ...
Python
"""Implementation of JSONDecoder """ import re import sys import struct from simplejson.scanner import make_scanner try: from simplejson._speedups import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconst...
Python
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of ...
Python
r"""Using simplejson from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ import simplejson def main(): import sys if l...
Python
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scan...
Python
#!/usr/bin/python2.4 '''Load the latest update for a Twitter user and leave it in an XHTML fragment''' __author__ = 'dewitt@google.com' import codecs import getopt import sys import twitter TEMPLATE = """ <div class="twitter"> <span class="twitter-user"><a href="http://twitter.com/%s">Twitter</a>: </span> <span...
Python
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twit...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
#!/usr/bin/python2.4 # -*- coding: utf-8 -*-# # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from astm.version import __version__ try: from setuptools import setup, find_...
Python
# -*- coding: utf-8 -*- # # Author: Sam Rushing <rushing@nightmare.com> # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """ .. module:: astm.asynclib :synopsis: Forked vers...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from collections import Iterable from .compat import unicode from .constants import ( STX, ETX, ETB...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import logging import socket from .asynclib import Dispatcher, loop from .codec import decode_message, ...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import logging from .asynclib import AsyncChat, call_later from .records import HeaderRecord, Terminato...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # class BaseASTMError(Exception): """Base ASTM error.""" class InvalidState(BaseASTMError): """...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import logging import socket from .asynclib import loop from .codec import encode from .constants impor...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import datetime import decimal import inspect import time import warnings from operator import itemgett...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # __version_info__ = (0, 6, 0, 'dev', 0) __version__ = '{version}{tag}{build}'.format( version='.'.jo...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # class DummyMixIn(object): _input_buffer = '' addr = ('localhost', 15200) def flush(self):...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import os import sys import unittest def suite(): suite = unittest.TestSuite() for root, dirs,...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """Common ASTM records structure. This module contains base ASTM records mappings with only defined c...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: ASTM specification base encoding. ENCODING = 'latin-1' #: Message start token. STX = b'\x02' #: Mes...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """ ``astm.omnilab.server`` - LabOnline server implementation ----------------------------------------...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """ ``astm.omnilab.client`` - LabOnline client implementation ----------------------------------------...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from . import client from . import server
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from astm import __version__ from astm.mapping import ( Component, ConstantField, ComponentField, D...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from .version import __version__, __version_info__ from .exceptions import BaseASTMError, NotAccepted, ...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import sys version = '.'.join(map(str, sys.version_info[:2])) if version >= '3.0': basestring = (...
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ...
Python
import os import sys import logging os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) # Google App Engine imports. from google.appengine.ext.webapp import util # Force Django to reload its settings. from django.conf import settings settings._target = None...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ...
Python
from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: # (r'^16x16/', include('16x16.foo.urls')), # Uncomment this for admin: (r'^send/', 'favicon.views.receiver'), (r'^contrib/', 'favicon.views.contrib'), (r'^toggler/', 'favicon.views.toggler'), (r'^update/', 'favicon.views...
Python
#from django.db import models from google.appengine.ext import db class Favicon(db.Model): mimetype = db.StringProperty(required=True) favicon_bytes = db.BlobProperty(required=True) active = db.BooleanProperty(default=True) accesses = db.IntegerProperty(default=0) created_at = db.DateTimeProperty(auto_now_ad...
Python
from google.appengine.ext import db from google.appengine.ext.db import djangoforms import django from django import http from django import shortcuts from django.core import serializers from favicon.models import Favicon, FaviconURI, Client, Access # as soon as we have an imagine library......
Python
from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountStat from datetime import datetime def inc_total_favicons(): total_favicons = CountStat.get_or_insert("total_favicons") total_favicons.count += 1 total_favicons.put() def get_total_favicons(): total_favicons = CountStat.get_by...
Python
import logging import sys from google.appengine.ext import db from google.appengine.ext.db import djangoforms import django from django import http from django import shortcuts from datetime import datetime from urllib import quote from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountS...
Python
#!/usr/bin/env python """ tesshelper.py -- Utility operations to compare, report stats, and copy public headers for tesseract 3.0x VS2008 Project $RCSfile: tesshelper.py,v $ $Revision: 7ca575b377aa $ $Date: 2012/03/07 17:26:31 $ """ r""" Requires: python 2.7 or greater: activestate.co...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2012 Zdenko Podobný # Author: Zdenko Podobný # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
Python
''' Created on Oct 16, 2012 Refactored on Jul 4, 2013 @author: Nils Amiet ''' import time import math from contextlib import contextmanager @contextmanager def timer(): '''Context manager used to wrap some code with a timer and print the execution time at the end''' timer = Timer() timer.start() yiel...
Python
''' Created on 11 juin 2013 @author: Nils Amiet ''' from subprocess import Popen, PIPE import os class SentiStrength(): '''Wrapper class for SentiStrength java version''' RUN_COMMAND = "java -jar" SENTISTRENGTH_PATH = os.path.join(os.path.dirname(__file__), "SentiStrengthCom.jar") DATA_PATH = os...
Python
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: #from django.contrib import admin #admin.autodiscover() urlpatterns = patterns('ITInfluence.views', # Examples: # url(r'^$', 'InfrarougeTwitterInfluence.views.home', name='home'), # url(r'^InfrarougeTwi...
Python
# Django settings for InfrarougeTwitterInfluence project. import os PROJECT_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir)) DEBUG = False TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'infrarouge': { # SQLite ...
Python
""" WSGI config for InfrarougeTwitterInfluence project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``...
Python
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "InfrarougeTwitterInfluence.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
''' Created on 8 juin 2013 @author: Nils Amiet ''' import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import networkx as nx import math import random from django.http.response import HttpResponse class GraphPlotter(): '''Class used to plot networkx graphs with matplotlib''' def __in...
Python
# coding: utf-8 ''' Created on 18 juin 2013 @author: Nils Amiet ''' import nltk def isEnglishTweet(text): ''' Checks that the ratio of unknown words in the given text does not exceed a threshold. Words are checked against an English dictionary of 235k words provided by NLTK ''' filterList = ["#",...
Python
from django.db import models import django.db.models.options as options options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('isTwitterModel',) # Create your models here. '''Twitter models''' class Tweet(models.Model): class Meta(): isTwitterModel = True id = models.DecimalField(primary_key=True,...
Python
# coding: utf-8 ''' Created on 4 jul 2013 @author: Nils Amiet ''' import unittest import os, sys ''' Required for running the script from anywhere outside eclipse''' os.chdir(os.path.dirname(os.path.realpath(__file__))) sys.path.append('..') from SentiStrength.sentistrength import SentiStrength from Tools.Timer i...
Python
''' Created on 13 juin 2013 @author: Nils Amiet ''' from ITInfluence.models import Tweet def getAllHashtags(): tweets = Tweet.objects.all().exclude(hashtags="") hashtags = {} for tweet in tweets: currentTweetHashtags = tweet.hashtags.split(" ") for tag in currentTweetHashtags: ...
Python
''' Created on 10 juin 2013 @author: Nils Amiet ''' import threading from ITInfluence.models import User, Friendship from ITInfluence.twitter import TwitterREST rest = TwitterREST() def collectRequest(query): userRequestPerMinute = 1 followersPerRequest = 5000 val = User.objects.raw(query, [follow...
Python
''' Created on 18 juin 2013 @author: Nils Amiet ''' from ITInfluence.models import Tweet, User, Friendship import networkx as nx import math class TwitterFollowersGraphBuilder(): ''' Builds the followers graph ''' def __init__(self): self.graph = nx.DiGraph() self.nodeSizes = [] ...
Python
# coding: utf-8 ''' Created on 23 mai 2013 @author: Nils Amiet ''' class PolarityCounter: polarityCounts = {} RECEIVED = "recv" SENT = "sent" AVERAGE = "avg" NDI = -1 # network disagreement index def __init__(self, replies): ''' Replies: a list of replies with the att...
Python
''' Created on 14 juin 2013 @author: Nils Amiet ''' # coding: utf-8 import networkx as nx import sqlite3 class InfrarougeGraphBuilder(): userRepliesCounts = {} graph1 = nx.DiGraph() userParticipations = [] graph2 = nx.Graph() def __init__(self, databasePath): self.infra...
Python
''' Created on 11 juin 2013 @author: Nils Amiet ''' from ITInfluence.polarity import PolarityCounter from ITInfluence.models import Tweet, User, Friendship from ITInfluence.hashtags import getAllHashtags from InfrarougeTwitterInfluence import settings import sqlite3 import math infrarougeDatabasePath = settings.DATA...
Python
''' Created on 7 juin 2013 @author: Nils Amiet ''' import threading import time import math from twython import TwythonStreamer, Twython, TwythonRateLimitError from twython.exceptions import TwythonError from requests.exceptions import ConnectionError from django.db import DatabaseError from ITInfluence.models im...
Python
# Create your views here. import math import networkx as nx from django.shortcuts import render_to_response, redirect from django.template import RequestContext from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.db import connection from ITInfluence.models import Tweet, User from ITI...
Python
''' Created on 12 juin 2013 @author: Nils Amiet ''' # Database routers are used to know which model should be used with which database. # This is useful in our case because we have multiple databases. class TwitterRouter(): def db_for_read(self, model, **hints): if hasattr(model._meta, "isTwitterModel"):...
Python
''' Created on 23 mars 2013 @author: Nils Amiet ''' # coding: utf-8 ''' Graph 1: Replies graph Weighted directed graph Weight of edge from A to B = number of replies from user A to user B Graph 2: User-Discussion graph Bipartite graph Edge from User A to discussion D => user A participates in discussion D ''' impo...
Python
''' Created on 23 mai 2013 @author: Nils Amiet ''' # coding: utf-8 class PolarityCounter: polarityCounts = {} RECEIVED = "recv" SENT = "sent" AVERAGE = "avg" NDI = -1 # network disagreement index def __init__(self, replies): ''' Replies: a list of replies with the at...
Python
''' Created on 4 avr. 2013 @author: Nils Amiet ''' # coding: utf-8 graph1Path = "graph1.gml" graph2Path = "graph2.gml" rankingsFile = "rankings.html" import networkx as nx import networkx.readwrite.gml as gml import operator import math import copy import os import sys import sqlite3 ''' Required for running the ...
Python
''' Created on 8 avr. 2013 @author: Nils Amiet ''' # coding: utf-8 class HTMLTableGenerator: infrarougeUserURL = "http://www.infrarouge.ch/ir/member-" tableBorder = 1 def __init__(self, th=[], rows=[], title="Untitled page", users=None): self.th = th self.rows = rows sel...
Python
''' Module which brings history information about files from Mercurial. @author: Rodrigo Damazio ''' import re import subprocess REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*') def _GetOutputLines(args): ''' Runs an external process and returns its output as a list of lines. @param args: the argume...
Python
''' Module which compares languague files to the master file and detects issues. @author: Rodrigo Damazio ''' import os from mytracks.parser import StringsParser import mytracks.history class Validator(object): def __init__(self, languages): ''' Builds a strings file validator. Params: @para...
Python
#!/usr/bin/python ''' Entry point for My Tracks i18n tool. @author: Rodrigo Damazio ''' import mytracks.files import mytracks.translate import mytracks.validate import sys def Usage(): print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0] print 'Commands are:' print ' cleanup' print ' translate' p...
Python
''' Module for dealing with resource files (but not their contents). @author: Rodrigo Damazio ''' import os.path from glob import glob import re MYTRACKS_RES_DIR = 'MyTracks/res' ANDROID_MASTER_VALUES = 'values' ANDROID_VALUES_MASK = 'values-*' def GetMyTracksDir(): ''' Returns the directory in which the MyTrac...
Python
''' Module which parses a string XML file. @author: Rodrigo Damazio ''' from xml.parsers.expat import ParserCreate import re #import xml.etree.ElementTree as ET class StringsParser(object): ''' Parser for string XML files. This object is not thread-safe and should be used for parsing a single file at a time...
Python
''' Module which prompts the user for translations and saves them. TODO: implement @author: Rodrigo Damazio ''' class Translator(object): ''' classdocs ''' def __init__(self, language): ''' Constructor ''' self._language = language def Translate(self, string_names): print string_names
Python
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
Python
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
Python
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
Python
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
Python
# -*- coding: UTF-8 -*- import datetime import hashlib import logging import re from google.appengine.api import mail from google.appengine.api.labs import taskqueue from google.appengine.ext import deferred from notifiy import constants from notifiy import model from notifiy import templates from notifiy import uti...
Python
# -*- coding: UTF-8 -*- from google.appengine.ext import deferred from notifiy import email from notifiy import model from notifiy import phone from notifiy import templates def notify_created(wavelet, blip, modified_by): """Sends a created notification to all participants except the modified_by""" for par...
Python
# -*- coding: UTF-8 -*- from google.appengine.ext import db from google.appengine.ext import deferred from notifiy import email from notifiy import gadget from notifiy import preferences from notifiy import templates from notifiy import model def wavelet_init(wavelet, modified_by): """Initialize the wavelet""" ...
Python
#!/usr/bin/env python # -*- coding: UTF-8 -*- from google.appengine.ext import webapp from notifiy import constants class Home(webapp.RequestHandler): def get(self): self.redirect(constants.ROBOT_HOME_PAGE)
Python
# -*- coding: UTF-8 -*- import base64 import urllib def get_url(participant, wave_id): domain = participant.split('@')[1] if wave_id: wave_id = urllib.quote(urllib.quote(wave_id)) if wave_id and domain == 'googlewave.com': return 'https://wave.google.com/wave/#restored:wave:%s' % wave_id...
Python
#!/usr/bin/env python # -*- coding: UTF-8 -*- import urllib import datetime from google.appengine.ext import webapp from google.appengine.ext import deferred from waveapi import simplejson from notifiy import model from notifiy import general from notifiy import preferences from notifiy.robot import create_robot ...
Python