code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.1429,
394,
0,
1,
0,
0,
394,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.6... | [
"import os",
"import subprocess",
"import sys",
"BASEDIR = '../main/src/com/joelapenna/foursquare'",
"TYPESDIR = '../captures/types/v1'",
"captures = sys.argv[1:]",
"if not captures:\n captures = os.listdir(TYPESDIR)",
" captures = os.listdir(TYPESDIR)",
"for f in captures:\n basename = f.split('... |
#! /usr/bin/env python
import sys, os
import tarfile, zipfile, gzip, bz2
from optparse import OptionParser
"""
Builds packaged releases of DebugKit so I don't have to do things manually.
Excludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives.
"""
def main():
parser = OptionParser... | [
[
1,
0,
0.0231,
0.0077,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
1,
0,
0.0308,
0.0077,
0,
0.66,
0.125,
223,
0,
4,
0,
0,
223,
0,
0
],
[
1,
0,
0.0385,
0.0077,
0,
0... | [
"import sys, os",
"import tarfile, zipfile, gzip, bz2",
"from optparse import OptionParser",
"\"\"\"\nBuilds packaged releases of DebugKit so I don't have to do things manually.\n\nExcludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives.\n\"\"\"",
"def main():\n parser = O... |
#! /usr/bin/env python
import sys, os
import tarfile, zipfile, gzip, bz2
from optparse import OptionParser
"""
Builds packaged releases of DebugKit so I don't have to do things manually.
Excludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives.
"""
def main():
parser = OptionParser... | [
[
1,
0,
0.0231,
0.0077,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
1,
0,
0.0308,
0.0077,
0,
0.66,
0.125,
223,
0,
4,
0,
0,
223,
0,
0
],
[
1,
0,
0.0385,
0.0077,
0,
0... | [
"import sys, os",
"import tarfile, zipfile, gzip, bz2",
"from optparse import OptionParser",
"\"\"\"\nBuilds packaged releases of DebugKit so I don't have to do things manually.\n\nExcludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives.\n\"\"\"",
"def main():\n parser = O... |
#====================================================================
# 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 ... | [
[
1,
0,
0.3514,
0.0135,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3649,
0.0135,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.3784,
0.0135,
0,
... | [
"import os",
"import re",
"import tempfile",
"import shutil",
"ignore_pattern = re.compile('^(.svn|target|bin|classes)')",
"java_pattern = re.compile('^.*\\.java')",
"annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')",
"def process_dir(dir):\n files = os.listdir(dir)\n for... |
"""
Data format classes ("responders") that can be plugged
into model_resource.ModelResource and determine how
the objects of a ModelResource instance are rendered
(e.g. serialized to XML, rendered by templates, ...).
"""
from django.core import serializers
from django.core.handlers.wsgi import STATUS_CODE_TEXT
from d... | [
[
8,
0,
0.0117,
0.0201,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0234,
0.0033,
0,
0.66,
0.0625,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0268,
0.0033,
0,
0.66... | [
"\"\"\"\nData format classes (\"responders\") that can be plugged \ninto model_resource.ModelResource and determine how\nthe objects of a ModelResource instance are rendered\n(e.g. serialized to XML, rendered by templates, ...).\n\"\"\"",
"from django.core import serializers",
"from django.core.handlers.wsgi im... |
"""
Generic resource class.
"""
from django.utils.translation import ugettext as _
from authentication import NoAuthentication
from django.core.urlresolvers import reverse as _reverse
from django.http import Http404, HttpResponse, HttpResponseNotAllowed
def load_put_and_files(request):
"""
Populates request.PU... | [
[
8,
0,
0.0135,
0.0203,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.027,
0.0068,
0,
0.66,
0.1111,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0338,
0.0068,
0,
0.66,... | [
"\"\"\"\nGeneric resource class.\n\"\"\"",
"from django.utils.translation import ugettext as _",
"from authentication import NoAuthentication",
"from django.core.urlresolvers import reverse as _reverse",
"from django.http import Http404, HttpResponse, HttpResponseNotAllowed",
"def load_put_and_files(reque... |
"""
Data format classes that can be plugged into
model_resource.ModelResource and determine how submissions
of model data need to look like (e.g. form submission MIME types,
XML, JSON, ...).
"""
from django.core import serializers
from django.forms import model_to_dict
class InvalidFormData(Exception):
"""
Ra... | [
[
8,
0,
0.0486,
0.0833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0972,
0.0139,
0,
0.66,
0.125,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.1111,
0.0139,
0,
0.66,... | [
"\"\"\"\nData format classes that can be plugged into \nmodel_resource.ModelResource and determine how submissions\nof model data need to look like (e.g. form submission MIME types,\nXML, JSON, ...).\n\"\"\"",
"from django.core import serializers",
"from django.forms import model_to_dict",
"class InvalidFormD... |
"""
Model-bound resource class.
"""
from django import forms
from django.conf.urls.defaults import patterns
from django.http import *
from django.forms import ModelForm, models
from django.forms.util import ErrorDict
from django.utils.functional import curry
from django.utils.translation.trans_null import _
from resour... | [
[
8,
0,
0.0082,
0.0123,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0165,
0.0041,
0,
0.66,
0.0833,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0206,
0.0041,
0,
0.66... | [
"\"\"\"\nModel-bound resource class.\n\"\"\"",
"from django import forms",
"from django.conf.urls.defaults import patterns",
"from django.http import *",
"from django.forms import ModelForm, models",
"from django.forms.util import ErrorDict",
"from django.utils.functional import curry",
"from django.u... |
VERSION = (1, 1)
| [
[
14,
0,
1,
1,
0,
0.66,
0,
557,
0,
0,
0,
0,
0,
8,
0
]
] | [
"VERSION = (1, 1)"
] |
from django.http import HttpResponse
from django.utils.translation import ugettext as _
import hashlib, time, random
def djangouser_auth(username, password):
"""
Check username and password against
django.contrib.auth.models.User
"""
from django.contrib.auth.models import User
try:
user... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0095,
0.0047,
0,
0.66,
0.1429,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0142,
0.0047,
0,
... | [
"from django.http import HttpResponse",
"from django.utils.translation import ugettext as _",
"import hashlib, time, random",
"def djangouser_auth(username, password):\n \"\"\"\n Check username and password against\n django.contrib.auth.models.User\n \"\"\"\n from django.contrib.auth.models imp... |
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',
)
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
152,
0,
1,
0,
0,
152,
0,
0
],
[
14,
0,
0.3,
0.1,
0,
0.66,
0.5,
623,
4,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.75,
0.6,
0,
0.66,
1,
234,... | [
"from distutils.core import setup",
"version = '%s.%s' % __import__('django_restapi').VERSION[:2]",
"setup(name='django-rest',\n\t\tversion=version,\n\t\tpackages=['django_restapi'],\n\t\tauthor='Andriy Drozdyuk',\n\t\tauthor_email='drozzy@gmail.com',\n\t)"
] |
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... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
79,
0,
1,
0,
0,
79,
0,
0
],
[
14,
0,
0.1111,
0.037,
0,
0.66,
0.1111,
309,
1,
0,
0,
0,
0,
4,
0
],
[
14,
0,
0.1481,
0.037,
0,
0.66,
... | [
"from os.path import realpath",
"DEBUG = True",
"TEMPLATE_DEBUG = True",
"INSTALLED_APPS = (\n 'django.contrib.contenttypes',\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n 'django_restapi_tests.polls',\n 'django_restapi_tests.p... |
#!/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 ... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
879,
0,
1,
0,
0,
879,
0,
0
],
[
7,
0,
0.5,
0.5455,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.49,
... | [
"from django.core.management import execute_manager",
"try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n 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 run dj... |
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)
... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.25,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0.66... | [
"from datetime import datetime",
"from django.db import models",
"from django.utils.translation import gettext_lazy as _",
"class Poll(models.Model):\n question = models.CharField(max_length=200)\n password = models.CharField(max_length=200)\n pub_date = models.DateTimeField(_('date published'), defa... |
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... | [
[
1,
0,
0.003,
0.003,
0,
0.66,
0,
984,
0,
1,
0,
0,
984,
0,
0
],
[
1,
0,
0.006,
0.003,
0,
0.66,
0.0769,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.009,
0.003,
0,
0.66,
... | [
"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.authentica... |
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... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.5,
302,
0,
1,
0,
0,
302,
0,
0
],
[
14,
0,
0.6429,
0.7857,
0,
0.... | [
"from django.conf.urls.defaults import *",
"from django.contrib import admin",
"urlpatterns = patterns('',\n url(r'', include('django_restapi_tests.examples.simple')),\n url(r'', include('django_restapi_tests.examples.basic')),\n url(r'', include('django_restapi_tests.examples.template')),\n url(r'', in... |
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 = ('... | [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.087,
0.0435,
0,
0.66,
0.1429,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.1304,
0.0435,
0,
0... | [
"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(\n queryset = Poll.objects.all(... |
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'),
... | [
[
1,
0,
0.0417,
0.0417,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0833,
0.0417,
0,
0.66,
0.1667,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.125,
0.0417,
0,
0... | [
"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(\n queryset = Poll.objects.all(),\n permitted_methods = ('GET', 'PO... |
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... | [
[
1,
0,
0.0345,
0.0345,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.069,
0.0345,
0,
0.66,
0.1429,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.1034,
0.0345,
0,
0... | [
"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 *",
"class FriendshipCollection(Resource):\n def read(self, reque... |
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... | [
[
1,
0,
0.0175,
0.0175,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0351,
0.0175,
0,
0.66,
0.125,
272,
0,
3,
0,
0,
272,
0,
0
],
[
1,
0,
0.0526,
0.0175,
0,
0... | [
"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",
"class ChoiceCollection(Collection):\n \n def read(self, request):\n poll_id... |
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')... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.1667,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
... | [
"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(\n queryset = Poll.objects.all(),\n permitted_methods = ('GET'... |
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 ... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.1667,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
... | [
"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(\n queryset = Poll.objects.all(), \n responder = XMLResponder(),... |
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... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.1667,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.15,
0.05,
0,
0.66,
0.3... | [
"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(\n queryset = Poll.objects.all(), \n responder = XMLResponder(... |
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.
# ... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0476,
0.0238,
0,
0.66,
0.125,
272,
0,
1,
0,
0,
272,
0,
0
],
[
1,
0,
0.0714,
0.0238,
0,
0... | [
"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",
"basicauth_poll_resource = Collection(\n queryset = Poll.obje... |
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... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0625,
0.0312,
0,
0.66,
0.25,
779,
0,
1,
0,
0,
779,
0,
0
],
[
3,
0,
0.2188,
0.2188,
0,
0.66... | [
"from django.db import models",
"from django.http import Http404",
"class Person(models.Model):\n name = models.CharField(max_length=20)\n friends = models.ManyToManyField('self')\n idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers')\n\n def __unicode__(self):\n ... |
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'... | [
[
1,
0,
0.0294,
0.0294,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0588,
0.0294,
0,
0.66,
0.5,
375,
0,
1,
0,
0,
375,
0,
0
],
[
3,
0,
0.5588,
0.9118,
0,
0.6... | [
"from django.test import TestCase",
"from django.utils.functional import curry",
"class GenericTest(TestCase):\n\n fixtures = ['initial_data.json']\n \n def setUp(self):\n self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')\n self.client.delete = curry(self.client.get, REQ... |
from django.db import models
# Create your models here.
| [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
]
] | [
"from django.db import models"
] |
# Create your views here.
| [] | [] |
#!/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 ... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
879,
0,
1,
0,
0,
879,
0,
0
],
[
7,
0,
0.5,
0.5455,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.98,
... | [
"from django.core.management import execute_manager",
"try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n 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 run dj... |
#!/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... | [
[
8,
0,
0.2329,
0.0137,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2603,
0.0137,
0,
0.66,
0.125,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.274,
0.0137,
0,
0.66,
... | [
"'''The setup and build script for the python-twitter library.'''",
"__author__ = 'python-twitter@googlegroups.com'",
"__version__ = '0.8.3'",
"METADATA = dict(\n name = \"python-twitter\",\n version = __version__,\n py_modules = ['twitter'],\n author='The Python-Twitter Developers',\n author_email='pyth... |
#!/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... | [
[
1,
0,
0.2,
0.0111,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2111,
0.0111,
0,
0.66,
0.0625,
509,
0,
1,
0,
0,
509,
0,
0
],
[
7,
0,
0.2611,
0.0444,
0,
0.6... | [
"import os",
"import sys",
"try:\n from urlparse import parse_qsl\nexcept:\n from cgi import parse_qsl",
" from urlparse import parse_qsl",
" from cgi import parse_qsl",
"import oauth2 as oauth",
"REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'",
"ACCESS_TOKEN_URL = 'https://api... |
"""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
... | [
[
8,
0,
0.0035,
0.0046,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0069,
0.0023,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.015,
0.0092,
0,
0.66,... | [
"\"\"\"Implementation of JSONEncoder\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None",
" from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii",... |
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 ... | [
[
8,
0,
0.1582,
0.3133,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3165,
0.0032,
0,
0.66,
0.1,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3244,
0.0127,
0,
0.66,
... | [
"r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintaine... |
"""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... | [
[
8,
0,
0.0231,
0.0308,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0846,
0.0615,
0,
0.66... | [
"\"\"\"JSON token scanner\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None",
" from simplejson._speedups import make_scanner as c_make_scanner",
" c_make_scanner = None",
"__all__ = ['make_scanner']",
... |
#!/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... | [
[
8,
0,
0.0213,
0.0071,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0355,
0.0071,
0,
0.66,
0.0667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0496,
0.0071,
0,
0.66,... | [
"'''Post a message to twitter'''",
"__author__ = 'dewitt@google.com'",
"import ConfigParser",
"import getopt",
"import os",
"import sys",
"import twitter",
"USAGE = '''Usage: tweet [options] message\n\n This script posts a message to Twitter.\n\n Options:\n\n -h --help : print this help\n --co... |
#!/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... | [
[
8,
0,
0.2606,
0.0563,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3099,
0.0141,
0,
0.66,
0.5,
614,
0,
1,
0,
0,
614,
0,
0
],
[
3,
0,
0.7535,
0.507,
0,
0.66,
... | [
"'''A class that defines the default URL Shortener.\n\nTinyURL is provided as the default and as an example.\n'''",
"import urllib",
"class ShortenURL(object):\n '''Helper class to make URL Shortener calls if/when required'''\n def __init__(self,\n userid=None,\n password=N... |
#!/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_... | [
[
1,
0,
0.1618,
0.0147,
0,
0.66,
0,
390,
0,
1,
0,
0,
390,
0,
0
],
[
7,
0,
0.3603,
0.3824,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
9
],
[
1,
1,
0.1912,
0.0147,
1,
0.62,
... | [
"from astm.version import __version__",
"try:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup\n # http://wiki.python.org/moin/Distutils/Cookbook/AutoPackageDiscovery\n import os\n\n def is_package(path):",
" from setuptools import setup, fi... |
# -*- 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... | [
[
8,
0,
0.0165,
0.0085,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0223,
0.0011,
0,
0.66,
0.0345,
251,
0,
1,
0,
0,
251,
0,
0
],
[
1,
0,
0.0234,
0.0011,
0,
0.66... | [
"\"\"\"\n.. module:: astm.asynclib\n :synopsis: Forked version of asyncore mixed with asynchat.\n.. moduleauthor:: Sam Rushing <rushing@nightmare.com>\n.. sectionauthor:: Christopher Petrilli <petrilli@amber.org>\n.. sectionauthor:: Steve Holden <sholden@holdenweb.com>\n.. heavily adapted from original documentat... |
# -*- 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... | [
[
1,
0,
0.0299,
0.003,
0,
0.66,
0,
193,
0,
1,
0,
0,
193,
0,
0
],
[
1,
0,
0.0328,
0.003,
0,
0.66,
0.05,
238,
0,
1,
0,
0,
238,
0,
0
],
[
1,
0,
0.0403,
0.0119,
0,
0.66... | [
"from collections import Iterable",
"from .compat import unicode",
"from .constants import (\n STX, ETX, ETB, CR, LF, CRLF,\n FIELD_SEP, COMPONENT_SEP, RECORD_SEP, REPEAT_SEP, ENCODING\n)",
"try:\n from itertools import izip_longest\nexcept ImportError: # Python 3\n from itertools import zip_long... |
# -*- 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, ... | [
[
1,
0,
0.0391,
0.0039,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.043,
0.0039,
0,
0.66,
0.0909,
687,
0,
1,
0,
0,
687,
0,
0
],
[
1,
0,
0.0469,
0.0039,
0,
0... | [
"import logging",
"import socket",
"from .asynclib import Dispatcher, loop",
"from .codec import decode_message, is_chunked_message, join",
"from .constants import ACK, CRLF, EOT, NAK, ENCODING",
"from .exceptions import InvalidState, NotAccepted",
"from .protocol import ASTMProtocol",
"log = logging.... |
# -*- 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... | [
[
1,
0,
0.0935,
0.0093,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.1028,
0.0093,
0,
0.66,
0.1667,
591,
0,
2,
0,
0,
591,
0,
0
],
[
1,
0,
0.1121,
0.0093,
0,
... | [
"import logging",
"from .asynclib import AsyncChat, call_later",
"from .records import HeaderRecord, TerminatorRecord",
"from .constants import STX, ENQ, ACK, NAK, EOT, ENCODING",
"log = logging.getLogger(__name__)",
"__all__ = ['ASTMProtocol']",
"class ASTMProtocol(AsyncChat):\n \"\"\"Common ASTM p... |
# -*- 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):
"""... | [
[
3,
0,
0.4038,
0.0769,
0,
0.66,
0,
305,
0,
0,
0,
0,
645,
0,
0
],
[
8,
1,
0.4231,
0.0385,
1,
0.46,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5577,
0.0769,
0,
0.66,
... | [
"class BaseASTMError(Exception):\n \"\"\"Base ASTM error.\"\"\"",
" \"\"\"Base ASTM error.\"\"\"",
"class InvalidState(BaseASTMError):\n \"\"\"Should be raised in case of invalid ASTM handler state.\"\"\"",
" \"\"\"Should be raised in case of invalid ASTM handler state.\"\"\"",
"class NotAccepte... |
# -*- 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... | [
[
1,
0,
0.0292,
0.0029,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0321,
0.0029,
0,
0.66,
0.0769,
687,
0,
1,
0,
0,
687,
0,
0
],
[
1,
0,
0.035,
0.0029,
0,
0... | [
"import logging",
"import socket",
"from .asynclib import loop",
"from .codec import encode",
"from .constants import ENQ, EOT",
"from .exceptions import NotAccepted",
"from .mapping import Record",
"from .protocol import ASTMProtocol",
"log = logging.getLogger(__name__)",
"__all__ = ['Client', 'E... |
# -*- 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... | [
[
1,
0,
0.0191,
0.0019,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.021,
0.0019,
0,
0.66,
0.04,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0229,
0.0019,
0,
0.6... | [
"import datetime",
"import decimal",
"import inspect",
"import time",
"import warnings",
"from operator import itemgetter",
"from itertools import islice",
"try:\n from itertools import izip_longest\nexcept ImportError: # Python 3\n from itertools import zip_longest as izip_longest\n from .co... |
# -*- 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... | [
[
14,
0,
0.6667,
0.0667,
0,
0.66,
0,
218,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.8667,
0.3333,
0,
0.66,
1,
162,
3,
3,
0,
0,
293,
10,
4
]
] | [
"__version_info__ = (0, 6, 0, 'dev', 0)",
"__version__ = '{version}{tag}{build}'.format(\n version='.'.join(map(str, __version_info__[:3])),\n tag='-' + __version_info__[3] if __version_info__[3] else '',\n build='.' + str(__version_info__[4]) if __version_info__[4] else ''\n)"
] |
# -*- 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):... | [
[
3,
0,
0.4412,
0.2647,
0,
0.66,
0,
587,
0,
2,
0,
0,
186,
0,
0
],
[
14,
1,
0.3529,
0.0294,
1,
0.79,
0,
808,
1,
0,
0,
0,
0,
3,
0
],
[
14,
1,
0.3824,
0.0294,
1,
0.79,... | [
"class DummyMixIn(object):\n _input_buffer = ''\n addr = ('localhost', 15200)\n\n def flush(self):\n pass\n\n def close(self):",
" _input_buffer = ''",
" addr = ('localhost', 15200)",
" def flush(self):\n pass",
" def close(self):\n pass",
"class CallLogger(obj... |
# -*- 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,... | [
[
1,
0,
0.303,
0.0303,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3333,
0.0303,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.3636,
0.0303,
0,
0.6... | [
"import os",
"import sys",
"import unittest",
"def suite():\n suite = unittest.TestSuite()\n for root, dirs, files in os.walk('.'):\n for file in files:\n if not (file.startswith('test_') and file.endswith('.py')):\n continue\n name = file.split('.')[0]\n ... |
# -*- 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... | [
[
8,
0,
0.0303,
0.018,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0449,
0.0022,
0,
0.66,
0.0909,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0517,
0.0112,
0,
0.66,... | [
"\"\"\"Common ASTM records structure.\n\n\nThis module contains base ASTM records mappings with only defined common\nrequired fields for most implementations. Others are marked as\n:class:`~astm.mapping.NotUsedField` and should be defined explicitly for your\nASTM realisation.\n\"\"\"",
"from datetime import date... |
# -*- 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... | [
[
14,
0,
0.2683,
0.0244,
0,
0.66,
0,
1,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3415,
0.0244,
0,
0.66,
0.0667,
693,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3902,
0.0244,
0,
0.6... | [
"ENCODING = 'latin-1'",
"STX = b'\\x02'",
"ETX = b'\\x03'",
"EOT = b'\\x04'",
"ENQ = b'\\x05'",
"ACK = b'\\x06'",
"NAK = b'\\x15'",
"ETB = b'\\x17'",
"LF = b'\\x0A'",
"CR = b'\\x0D'",
"CRLF = CR + LF",
"RECORD_SEP = b'\\x0D' # \\r #",
"FIELD_SEP = b'\\x7C' # | #",
"REPEAT_SEP ... |
# -*- 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
----------------------------------------... | [
[
8,
0,
0.0325,
0.0156,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0442,
0.0026,
0,
0.66,
0.0714,
244,
0,
1,
0,
0,
244,
0,
0
],
[
1,
0,
0.0506,
0.0104,
0,
0.66... | [
"\"\"\"\n\n``astm.omnilab.server`` - LabOnline server implementation\n----------------------------------------------------------\n\n\"\"\"",
"from astm.server import BaseRecordsDispatcher",
"from astm.mapping import (\n Component, ConstantField, ComponentField, DateTimeField, IntegerField,\n SetField, Tex... |
# -*- 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
----------------------------------------... | [
[
8,
0,
0.0328,
0.0157,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0486,
0.0105,
0,
0.66,
0.1,
791,
0,
9,
0,
0,
791,
0,
0
],
[
1,
0,
0.0643,
0.021,
0,
0.66,
... | [
"\"\"\"\n\n``astm.omnilab.client`` - LabOnline client implementation\n----------------------------------------------------------\n\n\"\"\"",
"from astm.mapping import (\n Component, ConstantField, ComponentField, IntegerField, DateTimeField,\n RepeatedComponentField, SetField, TextField, NotUsedField\n)",
... |
# -*- 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
| [
[
1,
0,
0.9091,
0.0909,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
0,
1,
0.0909,
0,
0.66,
1,
0,
0,
1,
0,
0,
0,
0,
0
]
] | [
"from . import client",
"from . import server"
] |
# -*- 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... | [
[
1,
0,
0.0403,
0.004,
0,
0.66,
0,
367,
0,
1,
0,
0,
367,
0,
0
],
[
1,
0,
0.0504,
0.0161,
0,
0.66,
0.1,
791,
0,
8,
0,
0,
791,
0,
0
],
[
1,
0,
0.0665,
0.0161,
0,
0.66... | [
"from astm import __version__",
"from astm.mapping import (\n Component, ConstantField, ComponentField, DateField, DateTimeField,\n IntegerField, SetField, TextField\n)",
"from astm.records import (\n HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord,\n TerminatorRecord\n)",
"S... |
# -*- 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, ... | [
[
1,
0,
0.303,
0.0303,
0,
0.66,
0,
623,
0,
2,
0,
0,
623,
0,
0
],
[
1,
0,
0.3333,
0.0303,
0,
0.66,
0.0909,
63,
0,
3,
0,
0,
63,
0,
0
],
[
1,
0,
0.4242,
0.1515,
0,
0.6... | [
"from .version import __version__, __version_info__",
"from .exceptions import BaseASTMError, NotAccepted, InvalidState",
"from .codec import (\n decode, decode_message, decode_record,\n encode, encode_message, encode_record,\n make_checksum\n)",
"from .mapping import Record, Component",
"from .rec... |
# -*- 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 = (... | [
[
1,
0,
0.2857,
0.0286,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.3429,
0.0286,
0,
0.66,
0.25,
623,
3,
1,
0,
0,
933,
10,
2
],
[
4,
0,
0.6571,
0.5429,
0,
... | [
"import sys",
"version = '.'.join(map(str, sys.version_info[:2]))",
"if version >= '3.0':\n basestring = (str, bytes)\n unicode = str\n bytes = bytes\n long = int\n def buffer(obj, start=None, stop=None):\n memoryview(obj)\n if start == None:",
" basestring = (str, bytes)",
"... |
#====================================================================
# 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 ... | [
[
1,
0,
0.3514,
0.0135,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3649,
0.0135,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.3784,
0.0135,
0,
... | [
"import os",
"import re",
"import tempfile",
"import shutil",
"ignore_pattern = re.compile('^(.svn|target|bin|classes)')",
"java_pattern = re.compile('^.*\\.java')",
"annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')",
"def process_dir(dir):\n files = os.listdir(dir)\n for... |
#!/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 ... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
879,
0,
1,
0,
0,
879,
0,
0
],
[
7,
0,
0.5,
0.5455,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.98,
... | [
"from django.core.management import execute_manager",
"try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n 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 run dj... |
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... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.0667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
... | [
"import os",
"import sys",
"import logging",
"os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'",
"sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))",
"from google.appengine.ext.webapp import util",
"from django.conf import settings",
"settings._target = None",
"import django.core.handl... |
#!/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 ... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
879,
0,
1,
0,
0,
879,
0,
0
],
[
7,
0,
0.5,
0.5455,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.54,
... | [
"from django.core.management import execute_manager",
"try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n 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 run dj... |
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... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.5882,
0.8824,
0,
0.66,
1,
990,
3,
10,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n # Example:\n # (r'^16x16/', include('16x16.foo.urls')),\n\n # Uncomment this for admin:\n (r'^send/', 'favicon.views.receiver'),\n (r'^contrib/', 'favicon.views.contrib'),\n (r'^toggler/', 'favicon.views.toggler'),"
] |
#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... | [
[
1,
0,
0.0455,
0.0227,
0,
0.66,
0,
167,
0,
1,
0,
0,
167,
0,
0
],
[
3,
0,
0.1591,
0.1591,
0,
0.66,
0.1429,
148,
0,
0,
0,
0,
697,
0,
6
],
[
14,
1,
0.1136,
0.0227,
1,
... | [
"from google.appengine.ext import db",
"class Favicon(db.Model):\n mimetype = db.StringProperty(required=True)\n favicon_bytes = db.BlobProperty(required=True)\n active = db.BooleanProperty(default=True)\n accesses = db.IntegerProperty(default=0)\n created_at = db.DateTimeProperty(auto_now_add=True)\n modif... |
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......
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.1667,
16,
0,
1,
0,
0,
16,
0,
0
],
[
1,
0,
0.3636,
0.0909,
0,
0.... | [
"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"
] |
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... | [
[
1,
0,
0.0128,
0.0128,
0,
0.66,
0,
211,
0,
6,
0,
0,
211,
0,
0
],
[
1,
0,
0.0256,
0.0128,
0,
0.66,
0.0588,
426,
0,
1,
0,
0,
426,
0,
0
],
[
2,
0,
0.0705,
0.0513,
0,
... | [
"from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountStat",
"from datetime import datetime",
"def inc_total_favicons():\n total_favicons = CountStat.get_or_insert(\"total_favicons\")\n total_favicons.count += 1\n total_favicons.put()",
" total_favicons = CountStat.get_or_in... |
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... | [
[
1,
0,
0.0073,
0.0073,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0146,
0.0073,
0,
0.66,
0.05,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0219,
0.0073,
0,
0.... | [
"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, Fa... |
#!/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... | [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
1,
... | [
"import os",
"import sys",
"import ctypes"
] |
'''
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... | [
[
8,
0,
0.0565,
0.0968,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.129,
0.0161,
0,
0.66,
0.2,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.1452,
0.0161,
0,
0.66,
... | [
"'''\nCreated on Oct 16, 2012\nRefactored on Jul 4, 2013\n\n@author: Nils Amiet\n'''",
"import time",
"import math",
"from contextlib import contextmanager",
"def timer():\n '''Context manager used to wrap some code with a timer and print the execution time at the end'''\n timer = Timer()\n timer.s... |
'''
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... | [
[
8,
0,
0.0732,
0.122,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1707,
0.0244,
0,
0.66,
0.3333,
394,
0,
2,
0,
0,
394,
0,
0
],
[
1,
0,
0.1951,
0.0244,
0,
0.66,... | [
"'''\nCreated on 11 juin 2013\n\n@author: Nils Amiet\n'''",
"from subprocess import Popen, PIPE",
"import os",
"class SentiStrength():\n '''Wrapper class for SentiStrength java version'''\n \n RUN_COMMAND = \"java -jar\"\n SENTISTRENGTH_PATH = os.path.join(os.path.dirname(__file__), \"SentiStrengt... |
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... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
528,
0,
3,
0,
0,
528,
0,
0
],
[
14,
0,
0.5761,
0.8696,
0,
0.66,
1,
990,
3,
24,
0,
0,
75,
10,
24
]
] | [
"from django.conf.urls import patterns, include, url",
"urlpatterns = patterns('ITInfluence.views',\n # Examples:\n # url(r'^$', 'InfrarougeTwitterInfluence.views.home', name='home'),\n # url(r'^InfrarougeTwitterInfluence/', include('InfrarougeTwitterInfluence.foo.urls')),\n\n # Uncomment the admin/do... |
# 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 ... | [
[
1,
0,
0.0114,
0.0057,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
14,
0,
0.0229,
0.0057,
0,
0.66,
0.0357,
660,
3,
1,
0,
0,
45,
10,
3
],
[
14,
0,
0.0343,
0.0057,
0,
... | [
"import os",
"PROJECT_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir))",
"DEBUG = False",
"TEMPLATE_DEBUG = DEBUG",
"ADMINS = (\n # ('Your Name', 'your_email@example.com'),\n)",
"MANAGERS = ADMINS",
"DATABASES = {\n 'infrarouge': { # SQLite database for Infrarouge d... |
"""
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 ``... | [
[
8,
0,
0.25,
0.4688,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5,
0.0312,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
8,
0,
0.6875,
0.0312,
0,
0.66,
0... | [
"\"\"\"\nWSGI config for InfrarougeTwitterInfluence project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deployments. It should expose a module-level variable\nnamed ``application``. Django's ``runserver`` and ``runfcgi`` commands discover\nthis applicat... |
#!/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)
| [
[
1,
0,
0.2,
0.1,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.75,
0.6,
0,
0.66,
1,
0,
... | [
"import os",
"import sys",
"if __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"InfrarougeTwitterInfluence.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)",
" os.environ.setdefault(\"DJANGO_SETTINGS... |
'''
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... | [
[
8,
0,
0.0153,
0.0255,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0357,
0.0051,
0,
0.66,
0.1111,
75,
0,
1,
0,
0,
75,
0,
0
],
[
8,
0,
0.0408,
0.0051,
0,
0.66,
... | [
"'''\nCreated on 8 juin 2013\n\n@author: Nils Amiet\n'''",
"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():\n '''Class used to plot ne... |
# 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 = ["#",... | [
[
8,
0,
0.125,
0.1562,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0312,
0,
0.66,
0.5,
371,
0,
1,
0,
0,
371,
0,
0
],
[
2,
0,
0.6562,
0.7188,
0,
0.66,
... | [
"'''\nCreated on 18 juin 2013\n\n@author: Nils Amiet\n'''",
"import nltk",
"def isEnglishTweet(text):\n '''\n Checks that the ratio of unknown words in the given text does not exceed a threshold.\n Words are checked against an English dictionary of 235k words provided by NLTK\n '''\n filterList =... |
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,... | [
[
1,
0,
0.0112,
0.0112,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0225,
0.0112,
0,
0.66,
0.0833,
962,
0,
1,
0,
0,
962,
0,
0
],
[
14,
0,
0.0449,
0.0112,
0,
0... | [
"from django.db import models",
"import django.db.models.options as options",
"options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('isTwitterModel',)",
"'''Twitter models'''",
"class Tweet(models.Model):\n class Meta():\n isTwitterModel = True\n \n id = models.DecimalField(primary_key=True,... |
# 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... | [
[
8,
0,
0.0336,
0.042,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.084,
0.0084,
0,
0.66,
0.0769,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0924,
0.0084,
0,
0.66,
... | [
"'''\nCreated on 4 jul 2013\n\n@author: Nils Amiet\n'''",
"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"... |
'''
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:
... | [
[
8,
0,
0.0714,
0.119,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1667,
0.0238,
0,
0.66,
0.3333,
316,
0,
1,
0,
0,
316,
0,
0
],
[
2,
0,
0.369,
0.3333,
0,
0.66,
... | [
"'''\nCreated on 13 juin 2013\n\n@author: Nils Amiet\n'''",
"from ITInfluence.models import Tweet",
"def getAllHashtags():\n tweets = Tweet.objects.all().exclude(hashtags=\"\")\n hashtags = {}\n \n for tweet in tweets:\n currentTweetHashtags = tweet.hashtags.split(\" \")\n for tag in c... |
'''
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... | [
[
8,
0,
0.0278,
0.0463,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0648,
0.0093,
0,
0.66,
0.0909,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0833,
0.0093,
0,
0.66,
... | [
"'''\nCreated on 10 juin 2013\n\n@author: Nils Amiet\n'''",
"import threading",
"from ITInfluence.models import User, Friendship",
"from ITInfluence.twitter import TwitterREST",
"rest = TwitterREST()",
"def collectRequest(query):\n userRequestPerMinute = 1\n followersPerRequest = 5000\n \n val... |
'''
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 = []
... | [
[
8,
0,
0.0207,
0.0345,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0483,
0.0069,
0,
0.66,
0.2,
316,
0,
3,
0,
0,
316,
0,
0
],
[
1,
0,
0.0552,
0.0069,
0,
0.66,
... | [
"'''\nCreated on 18 juin 2013\n\n@author: Nils Amiet\n'''",
"from ITInfluence.models import Tweet, User, Friendship",
"import networkx as nx",
"import math",
"class TwitterFollowersGraphBuilder():\n '''\n Builds the followers graph\n '''\n \n def __init__(self):\n self.graph = nx.DiGra... |
# 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... | [
[
8,
0,
0.0315,
0.0394,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5315,
0.9449,
0,
0.66,
1,
151,
0,
8,
0,
0,
0,
0,
15
],
[
14,
1,
0.0787,
0.0079,
1,
0.13,
... | [
"'''\nCreated on 23 mai 2013\n\n@author: Nils Amiet\n'''",
"class PolarityCounter:\n \n polarityCounts = {}\n RECEIVED = \"recv\"\n SENT = \"sent\"\n AVERAGE = \"avg\"\n NDI = -1 # network disagreement index",
" polarityCounts = {}",
" RECEIVED = \"recv\"",
" SENT = \"sent\"",
"... |
'''
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... | [
[
8,
0,
0.038,
0.0633,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1139,
0.0127,
0,
0.66,
0.3333,
691,
0,
1,
0,
0,
691,
0,
0
],
[
1,
0,
0.1266,
0.0127,
0,
0.66,... | [
"'''\nCreated on 14 juin 2013\n\n@author: Nils Amiet\n'''",
"import networkx as nx",
"import sqlite3",
"class InfrarougeGraphBuilder():\n \n userRepliesCounts = {}\n graph1 = nx.DiGraph()\n \n userParticipations = []\n graph2 = nx.Graph()",
" userRepliesCounts = {}",
" graph1 = nx.... |
'''
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... | [
[
8,
0,
0.0089,
0.0148,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0207,
0.003,
0,
0.66,
0.0417,
330,
0,
1,
0,
0,
330,
0,
0
],
[
1,
0,
0.0237,
0.003,
0,
0.66,
... | [
"'''\nCreated on 11 juin 2013\n\n@author: Nils Amiet\n'''",
"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",... |
'''
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... | [
[
8,
0,
0.0069,
0.0115,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0161,
0.0023,
0,
0.66,
0.0286,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0184,
0.0023,
0,
0.66,
... | [
"'''\nCreated on 7 juin 2013\n\n@author: Nils Amiet\n'''",
"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 D... |
# 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... | [
[
1,
0,
0.0049,
0.0024,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0073,
0.0024,
0,
0.66,
0.0222,
691,
0,
1,
0,
0,
691,
0,
0
],
[
1,
0,
0.0121,
0.0024,
0,
... | [
"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",... |
'''
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"):... | [
[
8,
0,
0.1071,
0.1786,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.6786,
0.6786,
0,
0.66,
1,
87,
0,
3,
0,
0,
0,
0,
3
],
[
2,
1,
0.4643,
0.1786,
1,
0.35,
0,... | [
"'''\nCreated on 12 juin 2013\n\n@author: Nils Amiet\n'''",
"class TwitterRouter():\n def db_for_read(self, model, **hints):\n if hasattr(model._meta, \"isTwitterModel\"):\n return \"default\"\n else:\n return \"infrarouge\"\n\n def db_for_write(self, model, **hints):",
... |
'''
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... | [
[
8,
0,
0.015,
0.025,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.07,
0.055,
0,
0.66,
0.037,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.105,
0.005,
0,
0.66,
0.0741... | [
"'''\nCreated on 23 mars 2013\n\n@author: Nils Amiet\n'''",
"'''\nGraph 1:\nReplies graph\nWeighted directed graph\nWeight of edge from A to B = number of replies from user A to user B\n\nGraph 2:\nUser-Discussion graph",
"import networkx as nx",
"import networkx.readwrite.gml as gml",
"import sqlite3",
"... |
'''
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... | [
[
8,
0,
0.0205,
0.0342,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.4966,
0.8767,
0,
0.66,
0.5,
151,
0,
8,
0,
0,
0,
0,
17
],
[
14,
1,
0.0753,
0.0068,
1,
0.22,
... | [
"'''\nCreated on 23 mai 2013\n\n@author: Nils Amiet\n'''",
"class PolarityCounter:\n \n polarityCounts = {}\n RECEIVED = \"recv\"\n SENT = \"sent\"\n AVERAGE = \"avg\"\n NDI = -1 # network disagreement index",
" polarityCounts = {}",
" RECEIVED = \"recv\"",
" SENT = \"sent\"",
"... |
'''
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 ... | [
[
8,
0,
0.0057,
0.0096,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0172,
0.0019,
0,
0.66,
0.0238,
913,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0192,
0.0019,
0,
0.66... | [
"'''\nCreated on 4 avr. 2013\n\n@author: Nils Amiet\n'''",
"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"... |
'''
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... | [
[
8,
0,
0.0263,
0.0439,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5395,
0.9298,
0,
0.66,
1,
408,
0,
6,
0,
0,
0,
0,
8
],
[
14,
1,
0.0965,
0.0088,
1,
0.97,
... | [
"'''\nCreated on 8 avr. 2013\n\n@author: Nils Amiet\n'''",
"class HTMLTableGenerator:\n \n infrarougeUserURL = \"http://www.infrarouge.ch/ir/member-\"\n tableBorder = 1\n \n def __init__(self, th=[], rows=[], title=\"Untitled page\", users=None):\n self.th = th\n self.rows = rows",
... |
'''
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... | [
[
8,
0,
0.0319,
0.0532,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0745,
0.0106,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0851,
0.0106,
0,
0.66... | [
"'''\nModule which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''",
"import re",
"import subprocess",
"REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')",
"def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines... |
'''
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... | [
[
8,
0,
0.0304,
0.0522,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0783,
0.0087,
0,
0.66,
... | [
"'''\nModule which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''",
"import os",
"from mytracks.parser import StringsParser",
"import mytracks.history",
"class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file valida... |
#!/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... | [
[
8,
0,
0.0417,
0.0521,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0104,
0,
0.66,
0.125,
640,
0,
1,
0,
0,
640,
0,
0
],
[
1,
0,
0.0938,
0.0104,
0,
0.66,... | [
"'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''",
"import mytracks.files",
"import mytracks.translate",
"import mytracks.validate",
"import sys",
"def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n p... |
'''
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... | [
[
8,
0,
0.0667,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0222,
0,
0.66,
0.125,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.1556,
0.0222,
0,
0.66,
... | [
"'''\nModule for dealing with resource files (but not their contents).\n\n@author: Rodrigo Damazio\n'''",
"import os.path",
"from glob import glob",
"import re",
"MYTRACKS_RES_DIR = 'MyTracks/res'",
"ANDROID_MASTER_VALUES = 'values'",
"ANDROID_VALUES_MASK = 'values-*'",
"def GetMyTracksDir():\n '''\n... |
'''
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... | [
[
8,
0,
0.0261,
0.0435,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0609,
0.0087,
0,
0.66,
0.3333,
573,
0,
1,
0,
0,
573,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66... | [
"'''\nModule which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''",
"from xml.parsers.expat import ParserCreate",
"import re",
"class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n... |
'''
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 | [
[
8,
0,
0.1905,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.7143,
0.619,
0,
0.66,
1,
229,
0,
2,
0,
0,
186,
0,
1
],
[
8,
1,
0.5238,
0.1429,
1,
0.56,
... | [
"'''\nModule which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''",
"class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor",
" '''\n classdocs\n '''",
" def __init__(self, language):\n '''... |
#!/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... | [
[
1,
0,
0.1753,
0.0103,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1856,
0.0103,
0,
0.66,
0.1,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1959,
0.0103,
0,
0.6... | [
"import sys",
"import os",
"from StringIO import StringIO",
"from PIL import Image",
"import datauri",
"RGBA_BLACK = (0, 0, 0, 255)",
"sign_ = lambda n: -1 if n < 0 else (1 if n > 0 else 0)",
"def find_black_region_(im, sx, sy, ex, ey):\n dx = sign_(ex - sx)\n dy = sign_(ey - sy)\n if abs(dx) == ab... |
#!/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... | [
[
1,
0,
0.3542,
0.0208,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.375,
0.0208,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3958,
0.0208,
0,
0... | [
"import sys",
"import os",
"from StringIO import StringIO",
"from PIL import Image",
"import datauri",
"def image_to_data_uri_(im):\n f = StringIO()\n im.save(f, 'PNG')\n uri = datauri.to_data_uri(f.getvalue(), 'foo.png')\n f.close()\n return uri",
" f = StringIO()",
" im.save(f, 'PNG')",
" ... |
#!/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... | [
[
1,
0,
0.2881,
0.0169,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.3051,
0.0169,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.322,
0.0169,
0,
0... | [
"import sys",
"import os",
"import os.path",
"import shutil",
"import zipfile",
"def main():\n params = {}\n params['id'] = sys.argv[1]\n params['displayname'] = sys.argv[2]\n params['description'] = sys.argv[3]\n\n zip_file = zipfile.ZipFile('dist/stencil-%s.zip' % params['id'], 'w',\n zipfile.... |
#!/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... | [
[
1,
0,
0.5,
0.0294,
0,
0.66,
0,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.5294,
0.0294,
0,
0.66,
0.2,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.5588,
0.0294,
0,
0.66,
... | [
"import base64",
"import sys",
"import mimetypes",
"def to_data_uri(data, file_name):\n '''Takes a file object and returns its data: string.'''\n mime_type = mimetypes.guess_type(file_name)\n return 'data:%(mimetype)s;base64,%(data)s' % dict(mimetype=mime_type[0],\n data=base64.b64encode(data))",
" ... |
# -*- 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... | [
[
1,
0,
0.0469,
0.0156,
0,
0.66,
0,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.0781,
0.0156,
0,
0.66,
0.1111,
36,
0,
1,
0,
0,
36,
0,
0
],
[
1,
0,
0.0938,
0.0156,
0,
0.... | [
"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):\n \"\"\"Sends a created notification to all participants except the modified_by\"\"\"\n\n... |
# -*- 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"""
... | [
[
1,
0,
0.04,
0.0133,
0,
0.66,
0,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.0533,
0.0133,
0,
0.66,
0.0833,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.08,
0.0133,
0,
0.66... | [
"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):\n \"\"\"Initialize... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.