code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
8,
0,
0.875,
0.0625,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
1,
0.0625,
0,
0.66,
1,
375,
0,
1,
0,
0,
375,
0,
0
]
] | [
"\"\"\"Support for ``gettext`` message catalogs.\"\"\"",
"from babel.messages.catalog import *"
] |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
1,
0,
0.1918,
0.0137,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.2055,
0.0137,
0,
0.66,
0.2,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.2329,
0.0137,
0,
0.66,... | [
"import doctest",
"import unittest",
"from babel import localedata",
"class MergeResolveTestCase(unittest.TestCase):\n\n def test_merge_items(self):\n d = {1: 'foo', 3: 'baz'}\n localedata.merge(d, {1: 'Foo', 2: 'Bar'})\n self.assertEqual({1: 'Foo', 2: 'Bar', 3: 'baz'}, d)\n\n def t... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
1,
0,
0.5185,
0.037,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5556,
0.037,
0,
0.66,
0.25,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.6296,
0.037,
0,
0.66,
... | [
"import doctest",
"import unittest",
"from babel import plural",
"def suite():\n suite = unittest.TestSuite()\n suite.addTest(doctest.DocTestSuite(plural))\n return suite",
" suite = unittest.TestSuite()",
" suite.addTest(doctest.DocTestSuite(plural))",
" return suite",
"if __name__ ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
1,
0,
0.2642,
0.0189,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.283,
0.0189,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3019,
0.0189,
0,
0... | [
"import doctest",
"import os",
"import unittest",
"from babel import core",
"from babel.core import default_locale",
"class DefaultLocaleTest(unittest.TestCase):\n \n def setUp(self):\n self._old_locale_settings = self._current_locale_settings()\n \n def tearDown(self):\n self._s... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
1,
0,
0.56,
0.04,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.6,
0.04,
0,
0.66,
0.25,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.68,
0.04,
0,
0.66,
0.5,
... | [
"import doctest",
"import unittest",
"from babel import util",
"def suite():\n suite = unittest.TestSuite()\n suite.addTest(doctest.DocTestSuite(util))\n return suite",
" suite = unittest.TestSuite()",
" suite.addTest(doctest.DocTestSuite(util))",
" return suite",
"if __name__ == '__... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
1,
0,
0.0809,
0.0058,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0867,
0.0058,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0925,
0.0058,
0,
... | [
"import doctest",
"import os",
"from StringIO import StringIO",
"import unittest",
"from babel import support",
"from babel.messages import Catalog",
"from babel.messages.mofile import write_mo",
"class TranslationsTestCase(unittest.TestCase):\n \n def setUp(self):\n # Use a locale which ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
1,
0,
0.4375,
0.0312,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
2,
0,
0.7031,
0.4375,
0,
0.66,
0.5,
425,
0,
0,
1,
0,
0,
0,
17
],
[
1,
1,
0.5469,
0.0625,
1,
0.08,
... | [
"import unittest",
"def suite():\n from babel.tests import core, dates, localedata, numbers, plural, \\\n support, util\n from babel.messages import tests as messages\n suite = unittest.TestSuite()\n suite.addTest(core.suite())\n suite.addTest(dates.suite())\n suite.ad... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
7,
0,
0.1046,
0.0327,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.098,
0.0065,
1,
0.29,
0,
349,
0,
1,
0,
0,
349,
0,
0
],
[
14,
1,
0.1046,
0.0065,
1,
0.29,
... | [
"try:\n from decimal import Decimal\n have_decimal = True\nexcept ImportError:\n have_decimal = False",
" from decimal import Decimal",
" have_decimal = True",
" have_decimal = False",
"import doctest",
"import unittest",
"from babel import numbers",
"class FormatDecimalTestCase(unit... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
8,
0,
0.0406,
0.0029,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0464,
0.0029,
0,
0.66,
0.037,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0493,
0.0029,
0,
0.66,... | [
"\"\"\"Various utility classes and functions.\"\"\"",
"import codecs",
"from datetime import timedelta, tzinfo",
"import os",
"import re",
"import textwrap",
"import time",
"from itertools import izip, imap",
"missing = object()",
"__all__ = ['distinct', 'pathmatch', 'relpath', 'wraptext', 'odict'... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
8,
0,
0.0276,
0.0086,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0345,
0.0017,
0,
0.66,
0.0833,
426,
0,
3,
0,
0,
426,
0,
0
],
[
1,
0,
0.0363,
0.0017,
0,
0.66... | [
"\"\"\"Several classes and functions that help with integrating and using Babel\nin applications.\n\n.. note: the code in this module is not used by Babel itself\n\"\"\"",
"from datetime import date, datetime, timedelta",
"import gettext",
"import locale",
"from babel.core import Locale",
"from babel.date... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
8,
0,
0.5256,
0.359,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.7436,
0.0256,
0,
0.66,
0.3333,
40,
0,
1,
0,
0,
40,
0,
0
],
[
14,
0,
0.7949,
0.0256,
0,
0.66,
... | [
"\"\"\"Integrated collection of utilities that assist in internationalizing and\nlocalizing applications.\n\nThis package is basically composed of two major parts:\n\n * tools to build and work with ``gettext`` message catalogs\n * a Python interface to the CLDR (Common Locale Data Repository), providing\n access... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | [
[
8,
0,
0.0307,
0.0154,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0444,
0.0017,
0,
0.66,
0.0312,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0461,
0.0017,
0,
0.66... | [
"\"\"\"Locale dependent formatting and parsing of numeric data.\n\nThe default locale for the functions in this module is determined by the\nfollowing environment variables, in that order:\n\n * ``LC_NUMERIC``,\n * ``LC_ALL``, and\n * ``LANG``",
"import math",
"import re",
"try:\n from decimal import Decim... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists of v... | [
[
1,
0,
0.1138,
0.0081,
0,
0.66,
0,
662,
0,
1,
0,
0,
662,
0,
0
],
[
1,
0,
0.122,
0.0081,
0,
0.66,
0.1429,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.1301,
0.0081,
0,
0... | [
"from distutils.cmd import Command",
"import doctest",
"from glob import glob",
"import os",
"import sys",
"TOOLS_DIR = os.path.dirname(__file__)",
"class build_doc(Command):\n description = 'generate the documentation'\n user_options = [\n ('force', None,\n \"force regeneration eve... |
import unittest
import doctest
def test_suite():
flags = doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE
return unittest.TestSuite((
doctest.DocFileSuite('test_request.txt', optionflags=flags),
doctest.DocFileSuite('test_response.txt', optionflags=flags),
doctest.DocFileSuite('test_dec.tx... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.3333,
614,
0,
1,
0,
0,
614,
0,
0
],
[
2,
0,
0.5294,
0.6471,
0,
0.... | [
"import unittest",
"import doctest",
"def test_suite():\n flags = doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE\n return unittest.TestSuite((\n doctest.DocFileSuite('test_request.txt', optionflags=flags),\n doctest.DocFileSuite('test_response.txt', optionflags=flags),\n doctest.DocFil... |
# -*- coding: utf-8 -*-
#
# Paste documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 22 22:08:49 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleabl... | [
[
1,
0,
0.1061,
0.0076,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.1818,
0.0076,
0,
0.66,
0.0667,
866,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.2045,
0.0076,
0,
... | [
"import sys",
"extensions = ['sphinx.ext.autodoc']",
"templates_path = ['_templates']",
"source_suffix = '.txt'",
"master_doc = 'index'",
"project = 'WebOb'",
"copyright = '2011, Ian Bicking and contributors'",
"version = '1.0'",
"release = '1.0.8'",
"today_fmt = '%B %d, %Y'",
"unused_docs = ['j... |
from webob.multidict import MultiDict
from UserDict import DictMixin
__all__ = ['ResponseHeaders', 'EnvironHeaders']
class ResponseHeaders(MultiDict):
"""
Dictionary view on the response headerlist.
Keys are normalized for case and whitespace.
"""
def __getitem__(self, key):
key = ... | [
[
1,
0,
0.0068,
0.0068,
0,
0.66,
0,
955,
0,
1,
0,
0,
955,
0,
0
],
[
1,
0,
0.0137,
0.0068,
0,
0.66,
0.125,
351,
0,
1,
0,
0,
351,
0,
0
],
[
14,
0,
0.0274,
0.0068,
0,
... | [
"from webob.multidict import MultiDict",
"from UserDict import DictMixin",
"__all__ = ['ResponseHeaders', 'EnvironHeaders']",
"class ResponseHeaders(MultiDict):\n \"\"\"\n Dictionary view on the response headerlist.\n Keys are normalized for case and whitespace.\n \"\"\"\n def __getitem... |
import re, time, string
from datetime import datetime, date, timedelta
__all__ = ['Cookie']
class Cookie(dict):
def __init__(self, input=None):
if input:
self.load(input)
def load(self, data):
ckey = None
for key, val in _rx_cookie.findall(data):
if key.lower()... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
540,
0,
3,
0,
0,
540,
0,
0
],
[
1,
0,
0.0101,
0.0051,
0,
0.66,
0.0323,
426,
0,
3,
0,
0,
426,
0,
0
],
[
14,
0,
0.0202,
0.0051,
0,
... | [
"import re, time, string",
"from datetime import datetime, date, timedelta",
"__all__ = ['Cookie']",
"class Cookie(dict):\n def __init__(self, input=None):\n if input:\n self.load(input)\n\n def load(self, data):\n ckey = None\n for key, val in _rx_cookie.findall(data):",... |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
Gives a multi-value dictionary object (MultiDict) plus several wrappers
"""
import cgi, copy, sys, warnings, urllib
from UserDict import DictMixin
... | [
[
8,
0,
0.0063,
0.0047,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0095,
0.0016,
0,
0.66,
0.1,
934,
0,
5,
0,
0,
934,
0,
0
],
[
1,
0,
0.0111,
0.0016,
0,
0.66,
... | [
"\"\"\"\nGives a multi-value dictionary object (MultiDict) plus several wrappers\n\"\"\"",
"import cgi, copy, sys, warnings, urllib",
"from UserDict import DictMixin",
"__all__ = ['MultiDict', 'UnicodeMultiDict', 'NestedMultiDict', 'NoVars',\n 'TrackableMultiDict']",
"class MultiDict(DictMixin):\n... |
"""
Represents the Cache-Control header
"""
import re
class UpdateDict(dict):
"""
Dict that has a callback on all updates
"""
# these are declared as class attributes so that
# we don't need to override constructor just to
# set some defaults
updated = None
updated_args = None
def ... | [
[
8,
0,
0.0088,
0.0132,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0176,
0.0044,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
3,
0,
0.1388,
0.2291,
0,
0.66,... | [
"\"\"\"\nRepresents the Cache-Control header\n\"\"\"",
"import re",
"class UpdateDict(dict):\n \"\"\"\n Dict that has a callback on all updates\n \"\"\"\n # these are declared as class attributes so that\n # we don't need to override constructor just to\n # set some defaults\n updated = Non... |
def rfc_reference(header, section):
if not section:
return ''
major_section = section.split('.')[0]
link = 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec%s.html#sec%s' % (major_section, section)
if header.startswith('HTTP_'):
header = header[5:].title().replace('_', '-')
return " F... | [
[
2,
0,
0.0643,
0.1143,
0,
0.66,
0,
734,
0,
2,
1,
0,
0,
0,
4
],
[
4,
1,
0.0357,
0.0286,
1,
0.17,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
13,
2,
0.0429,
0.0143,
2,
0.47,
... | [
"def rfc_reference(header, section):\n if not section:\n return ''\n major_section = section.split('.')[0]\n link = 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec%s.html#sec%s' % (major_section, section)\n if header.startswith('HTTP_'):\n header = header[5:].title().replace('_', '-')\n ... |
import warnings
import re
from datetime import datetime, date
from webob.byterange import Range, ContentRange
from webob.etag import IfRange, NoIfRange
from webob.datetime_utils import parse_date, serialize_date
from webob.util import rfc_reference
CHARSET_RE = re.compile(r';\s*charset=([^;]*)', re.I)
QUOTES_RE = re... | [
[
1,
0,
0.0034,
0.0034,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0068,
0.0034,
0,
0.66,
0.027,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0102,
0.0034,
0,
0... | [
"import warnings",
"import re",
"from datetime import datetime, date",
"from webob.byterange import Range, ContentRange",
"from webob.etag import IfRange, NoIfRange",
"from webob.datetime_utils import parse_date, serialize_date",
"from webob.util import rfc_reference",
"CHARSET_RE = re.compile(r';\\s*... |
"""
Parses a variety of ``Accept-*`` headers.
These headers generally take the form of::
value1; q=0.5, value2; q=0
Where the ``q`` parameter is optional. In theory other parameters
exists, but this ignores them.
"""
import re
from webob.util import rfc_reference
from webob.headers import _trans_name as header... | [
[
8,
0,
0.0153,
0.0279,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0334,
0.0028,
0,
0.66,
0.0833,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0362,
0.0028,
0,
0.66... | [
"\"\"\"\nParses a variety of ``Accept-*`` headers.\n\nThese headers generally take the form of::\n\n value1; q=0.5, value2; q=0\n\nWhere the ``q`` parameter is optional. In theory other parameters",
"import re",
"from webob.util import rfc_reference",
"from webob.headers import _trans_name as header_to_ke... |
import time
import calendar
from datetime import datetime, date, timedelta, tzinfo
from rfc822 import parsedate_tz, mktime_tz, formatdate
__all__ = [
'UTC', 'timedelta_to_seconds',
'year', 'month', 'week', 'day', 'hour', 'minute', 'second',
'parse_date', 'serialize_date',
'parse_date_delta', 'serialize... | [
[
1,
0,
0.0101,
0.0101,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0202,
0.0101,
0,
0.66,
0.0526,
917,
0,
1,
0,
0,
917,
0,
0
],
[
1,
0,
0.0303,
0.0101,
0,
... | [
"import time",
"import calendar",
"from datetime import datetime, date, timedelta, tzinfo",
"from rfc822 import parsedate_tz, mktime_tz, formatdate",
"__all__ = [\n 'UTC', 'timedelta_to_seconds',\n 'year', 'month', 'week', 'day', 'hour', 'minute', 'second',\n 'parse_date', 'serialize_date',\n 'p... |
"""
Does parsing of ETag-related headers: If-None-Matches, If-Matches
Also If-Range parsing
"""
from webob.datetime_utils import *
from webob.util import rfc_reference
__all__ = ['AnyETag', 'NoETag', 'ETagMatcher', 'IfRange', 'NoIfRange', 'etag_property']
def etag_property(key, default, rfc_section):
doc = "Ge... | [
[
8,
0,
0.0126,
0.0209,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0293,
0.0042,
0,
0.66,
0.0833,
676,
0,
1,
0,
0,
676,
0,
0
],
[
1,
0,
0.0335,
0.0042,
0,
0.66... | [
"\"\"\"\nDoes parsing of ETag-related headers: If-None-Matches, If-Matches\n\nAlso If-Range parsing\n\"\"\"",
"from webob.datetime_utils import *",
"from webob.util import rfc_reference",
"__all__ = ['AnyETag', 'NoETag', 'ETagMatcher', 'IfRange', 'NoIfRange', 'etag_property']",
"def etag_property(key, defau... |
import cgi
from webob.datetime_utils import *
from webob.request import *
from webob.response import *
# Pylons has imported UnicodeMultiDict directly from this location; so
# we're putting it here just to help them out (though it has also been
# fixed in Pylons tip on 17 Dec 2009)
from webob.multidict import UnicodeMu... | [
[
1,
0,
0.0222,
0.0222,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.0444,
0.0222,
0,
0.66,
0.125,
676,
0,
1,
0,
0,
676,
0,
0
],
[
1,
0,
0.0667,
0.0222,
0,
0... | [
"import cgi",
"from webob.datetime_utils import *",
"from webob.request import *",
"from webob.response import *",
"from webob.multidict import UnicodeMultiDict",
"__all__ = [\n 'Request', 'Response',\n 'UTC', 'day', 'week', 'hour', 'minute', 'second', 'month', 'year',\n 'html_escape'\n]",
"def... |
from setuptools import setup
version = '1.0.8'
setup(
name='WebOb',
version=version,
description="WSGI request and response object",
long_description="""\
WebOb provides wrappers around the WSGI request environment, and an
object to help create WSGI responses.
The objects map much of the specified be... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
14,
0,
0.06,
0.02,
0,
0.66,
0.5,
623,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
0.55,
0.92,
0,
0.66,
1,
... | [
"from setuptools import setup",
"version = '1.0.8'",
"setup(\n name='WebOb',\n version=version,\n description=\"WSGI request and response object\",\n long_description=\"\"\"\\\nWebOb provides wrappers around the WSGI request environment, and an\nobject to help create WSGI responses."
] |
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import pkg_resources
pkg_resources.require('WebOb')
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
688,
0,
2,
0,
0,
688,
0,
0
],
[
8,
0,
0.5,
0.25,
0,
0.66,
0.3333,
368,
3,
2,
0,
0,
0,
0,
3
],
[
1,
0,
0.75,
0.25,
0,
0.66,
0.666... | [
"import os, sys",
"sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))",
"import pkg_resources",
"pkg_resources.require('WebOb')"
] |
#!/usr/bin/env python
import webob
def make_middleware(app):
from repoze.profile.profiler import AccumulatingProfileMiddleware
return AccumulatingProfileMiddleware(
app,
log_filename='/tmp/profile.log',
discard_first_request=True,
flush_at_shutdown=True,
path='/__profile... | [
[
1,
0,
0.04,
0.02,
0,
0.66,
0,
787,
0,
1,
0,
0,
787,
0,
0
],
[
2,
0,
0.15,
0.16,
0,
0.66,
0.3333,
512,
0,
1,
1,
0,
0,
0,
1
],
[
1,
1,
0.1,
0.02,
1,
0.39,
0,
... | [
"import webob",
"def make_middleware(app):\n from repoze.profile.profiler import AccumulatingProfileMiddleware\n return AccumulatingProfileMiddleware(\n app,\n log_filename='/tmp/profile.log',\n discard_first_request=True,\n flush_at_shutdown=True,\n path='/__profile__')",... |
#
| [] | [] |
"""
gae-pytz
========
pytz has a severe performance problem that impedes its usage on Google App
Engine. This is caused because pytz.__init__ builds a list of available
zoneinfos checking the entire zoneinfo database (which means: it tries to open
hundreds of files). This is done in the module globals, so it is not eas... | [
[
8,
0,
0.2292,
0.4375,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4583,
0.0208,
0,
0.66,
0.5,
182,
0,
2,
0,
0,
182,
0,
0
],
[
8,
0,
0.7604,
0.5,
0,
0.66,
... | [
"\"\"\"\ngae-pytz\n========\npytz has a severe performance problem that impedes its usage on Google App\nEngine. This is caused because pytz.__init__ builds a list of available\nzoneinfos checking the entire zoneinfo database (which means: it tries to open\nhundreds of files). This is done in the module globals, so... |
#!/usr/bin/env python
'''
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
'''
from cStringIO import StringIO
from datetime import datetime, timedelta
from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
from pytz.tzinfo import memorized_datetime, memorized_timede... | [
[
8,
0,
0.0246,
0.0246,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0492,
0.0082,
0,
0.66,
0.1429,
764,
0,
1,
0,
0,
764,
0,
0
],
[
1,
0,
0.0574,
0.0082,
0,
0.66... | [
"'''\n$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $\n'''",
"from cStringIO import StringIO",
"from datetime import datetime, timedelta",
"from struct import unpack, calcsize",
"from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo",
"from pytz.tzinfo import memorized_datetime, memorize... |
"""
A pytz version that runs smoothly on Google App Engine.
Based on http://appengine-cookbook.appspot.com/recipe/caching-pytz-helper/
To use, add pytz to your path normally, but import it from the gae module:
from pytz.gae import pytz
Applied patches:
- The zoneinfo dir is removed fr... | [
[
8,
0,
0.134,
0.2577,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.268,
0.0103,
0,
0.66,
0.0833,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2784,
0.0103,
0,
0.66,
... | [
"\"\"\"\n A pytz version that runs smoothly on Google App Engine.\n\n Based on http://appengine-cookbook.appspot.com/recipe/caching-pytz-helper/\n\n To use, add pytz to your path normally, but import it from the gae module:\n\n from pytz.gae import pytz",
"import os",
"import logging",
"import... |
'''
Reference tzinfo implementations from the Python docs.
Used for testing against as they are only correct for the years
1987 to 2006. Do not use these for real code.
'''
from datetime import tzinfo, timedelta, datetime
from pytz import utc, UTC, HOUR, ZERO
# A class building tzinfo objects for fixed-offset time zo... | [
[
8,
0,
0.0236,
0.0394,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0551,
0.0079,
0,
0.66,
0.0588,
426,
0,
3,
0,
0,
426,
0,
0
],
[
1,
0,
0.063,
0.0079,
0,
0.66,... | [
"'''\nReference tzinfo implementations from the Python docs.\nUsed for testing against as they are only correct for the years\n1987 to 2006. Do not use these for real code.\n'''",
"from datetime import tzinfo, timedelta, datetime",
"from pytz import utc, UTC, HOUR, ZERO",
"class FixedOffset(tzinfo):\n \"\"... |
import webapp2
class LazyHandler(webapp2.RequestHandler):
def get(self, **kwargs):
self.response.out.write('I am a laaazy view.')
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
3,
0,
0.8333,
0.5,
0,
0.66,
1,
864,
0,
1,
0,
0,
842,
0,
1
],
[
2,
1,
0.9167,
0.3333,
1,
0.01,
... | [
"import webapp2",
"class LazyHandler(webapp2.RequestHandler):\n def get(self, **kwargs):\n self.response.out.write('I am a laaazy view.')",
" def get(self, **kwargs):\n self.response.out.write('I am a laaazy view.')",
" self.response.out.write('I am a laaazy view.')"
] |
import webapp2
class HomeHandler(webapp2.RequestHandler):
def get(self, **kwargs):
html = '<a href="%s">test item</a>' % self.url_for('view', item='test')
self.response.out.write(html)
class ViewHandler(webapp2.RequestHandler):
def get(self, **kwargs):
item = kwargs.get('item')
... | [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
3,
0,
0.1447,
0.1053,
0,
0.66,
0.2,
344,
0,
1,
0,
0,
842,
0,
2
],
[
2,
1,
0.1579,
0.0789,
1,
0.8... | [
"import webapp2",
"class HomeHandler(webapp2.RequestHandler):\n def get(self, **kwargs):\n html = '<a href=\"%s\">test item</a>' % self.url_for('view', item='test')\n self.response.out.write(html)",
" def get(self, **kwargs):\n html = '<a href=\"%s\">test item</a>' % self.url_for('vie... |
import fnmatch
import os
def generate( env ):
def Glob( env, includes = None, excludes = None, dir = '.' ):
"""Adds Glob( includes = Split( '*' ), excludes = None, dir = '.')
helper function to environment.
Glob both the file-system files.
includes: list of file name pattern included i... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0.3333,
688,
0,
1,
0,
0,
688,
0,
0
],
[
2,
0,
0.4811,
0.8302,
0,
... | [
"import fnmatch",
"import os",
"def generate( env ): \n def Glob( env, includes = None, excludes = None, dir = '.' ):\n \"\"\"Adds Glob( includes = Split( '*' ), excludes = None, dir = '.')\n helper function to environment.\n\n Glob both the file-system files.\n\n includes: list of file... |
"""tarball
Tool-specific initialization for tarball.
"""
## Commands to tackle a command based implementation:
##to unpack on the fly...
##gunzip < FILE.tar.gz | tar xvf -
##to pack on the fly...
##tar cvf - FILE-LIST | gzip -c > FILE.tar.gz
import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Ut... | [
[
8,
0,
0.0366,
0.061,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1585,
0.0122,
0,
0.66,
0.125,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.1829,
0.0122,
0,
0.66,
... | [
"\"\"\"tarball\n\nTool-specific initialization for tarball.\n\n\"\"\"",
"import os.path",
"import SCons.Builder",
"import SCons.Node.FS",
"import SCons.Util",
"try:\n import gzip\n import tarfile\n internal_targz = 1\nexcept ImportError:\n internal_targz = 0",
" import gzip",
" impor... |
import os
import os.path
from fnmatch import fnmatch
import targz
##def DoxyfileParse(file_contents):
## """
## Parse a Doxygen source file and return a dictionary of all the values.
## Values will be strings and lists of strings.
## """
## data = {}
##
## import shlex
## lex = shlex.shlex(instream = fil... | [
[
1,
0,
0.0056,
0.0056,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0112,
0.0056,
0,
0.66,
0.1667,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0168,
0.0056,
0,
0.... | [
"import os",
"import os.path",
"from fnmatch import fnmatch",
"import targz",
"def srcDistEmitter(source, target, env):\n## \"\"\"Doxygen Doxyfile emitter\"\"\"\n## # possible output formats and their default values and output locations\n## output_formats = {\n## \"HTML\": (\"YES\", \"html\"),\n#... |
"""
Notes:
- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.
To add a platform:
- add its name in options allowed_values below
- add too... | [
[
8,
0,
0.0191,
0.034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0426,
0.0043,
0,
0.66,
0.0167,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0468,
0.0043,
0,
0.66,... | [
"\"\"\"\nNotes: \n- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.\n\nTo add a platform:\n- add its name in options allowed_values below\n-... |
#!/usr/bin/env python
# encoding: utf-8
# Baptiste Lepilleur, 2009
from dircache import listdir
import re
import fnmatch
import os.path
# These fnmatch expressions are used by default to prune the directory tree
# while doing the recursive traversal in the glob_impl method of glob function.
prune_dirs = '.git .bzr .... | [
[
1,
0,
0.0249,
0.005,
0,
0.66,
0,
724,
0,
1,
0,
0,
724,
0,
0
],
[
1,
0,
0.0299,
0.005,
0,
0.66,
0.0588,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0348,
0.005,
0,
0.6... | [
"from dircache import listdir",
"import re",
"import fnmatch",
"import os.path",
"prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '",
"default_excludes = '''\n**/*~\n**/#*#\n**/.#*\n**/%*%\n**/._*\n**/CVS\n**/CVS/**",
"DIR = 1",
"FILE = 2",
"DIR_LINK = 4",
"FILE_LINK = 8",
"LINKS = DIR_LIN... |
#!/usr/bin/env python
# encoding: utf-8
# Baptiste Lepilleur, 2009
from dircache import listdir
import re
import fnmatch
import os.path
# These fnmatch expressions are used by default to prune the directory tree
# while doing the recursive traversal in the glob_impl method of glob function.
prune_dirs = '.git .bzr .... | [
[
1,
0,
0.0249,
0.005,
0,
0.66,
0,
724,
0,
1,
0,
0,
724,
0,
0
],
[
1,
0,
0.0299,
0.005,
0,
0.66,
0.0588,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0348,
0.005,
0,
0.6... | [
"from dircache import listdir",
"import re",
"import fnmatch",
"import os.path",
"prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '",
"default_excludes = '''\n**/*~\n**/#*#\n**/.#*\n**/%*%\n**/._*\n**/CVS\n**/CVS/**",
"DIR = 1",
"FILE = 2",
"DIR_LINK = 4",
"FILE_LINK = 8",
"LINKS = DIR_LIN... |
# module
| [] | [] |
import os.path
import gzip
import tarfile
TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
def make_tarball(tarball_path, sources, base_dir, prefix_dir=''):
"""Parameters:
tarball_path: output path of the .tar.gz file
sources: list of sources to include in the tarball, relative to the current directory
base_dir: i... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0.2,
967,
0,
1,
0,
0,
967,
0,
0
],
[
1,
0,
0.0566,
0.0189,
0,
0.66,... | [
"import os.path",
"import gzip",
"import tarfile",
"TARGZ_DEFAULT_COMPRESSION_LEVEL = 9",
"def make_tarball(tarball_path, sources, base_dir, prefix_dir=''):\n \"\"\"Parameters:\n tarball_path: output path of the .tar.gz file\n sources: list of sources to include in the tarball, relative to the curr... |
"""Script to generate doxygen documentation.
"""
import re
import os
import os.path
import sys
import shutil
from devtools import tarball
def find_program(*filenames):
"""find a program in folders path_lst, and sets env[var]
@param filenames: a list of possible names of the program to search for
@return: ... | [
[
8,
0,
0.009,
0.012,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.024,
0.006,
0,
0.66,
0.0833,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0299,
0.006,
0,
0.66,
... | [
"\"\"\"Script to generate doxygen documentation.\n\"\"\"",
"import re",
"import os",
"import os.path",
"import sys",
"import shutil",
"from devtools import tarball",
"def find_program(*filenames):\n \"\"\"find a program in folders path_lst, and sets env[var]\n @param filenames: a list of possibl... |
# removes all files created during testing
import glob
import os
paths = []
for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]:
paths += glob.glob( 'data/' + pattern )
for path in paths:
os.unlink( path )
| [
[
1,
0,
0.2,
0.1,
0,
0.66,
0,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
14,
0,
0.5,
0.1,
0,
0.66,
0.5,
... | [
"import glob",
"import os",
"paths = []",
"for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]:\n paths += glob.glob( 'data/' + pattern )",
"for path in paths:\n os.unlink( path )",
" os.unlink( path )"
] |
import glob
import os.path
for path in glob.glob( '*.json' ):
text = file(path,'rt').read()
target = os.path.splitext(path)[0] + '.expected'
if os.path.exists( target ):
print 'skipping:', target
else:
print 'creating:', target
file(target,'wt').write(text)
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.5,
79,
0,
1,
0,
0,
79,
0,
0
],
[
6,
0,
0.5909,
0.7273,
0,
0.66,... | [
"import glob",
"import os.path",
"for path in glob.glob( '*.json' ):\n text = file(path,'rt').read()\n target = os.path.splitext(path)[0] + '.expected'\n if os.path.exists( target ):\n print('skipping:', target)\n else:\n print('creating:', target)\n file(target,'wt').write(text... |
# Simple implementation of a json test runner to run the test against json-py.
import sys
import os.path
import json
import types
if len(sys.argv) != 2:
print "Usage: %s input-json-file", sys.argv[0]
sys.exit(3)
input_path = sys.argv[1]
base_path = os.path.splitext(input_path)[0]
actual_path = base_path ... | [
[
1,
0,
0.0469,
0.0156,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0625,
0.0156,
0,
0.66,
0.0588,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0781,
0.0156,
0,
0.... | [
"import sys",
"import os.path",
"import json",
"import types",
"if len(sys.argv) != 2:\n print(\"Usage: %s input-json-file\", sys.argv[0])\n sys.exit(3)",
" print(\"Usage: %s input-json-file\", sys.argv[0])",
" sys.exit(3)",
"input_path = sys.argv[1]",
"base_path = os.path.splitext(input... |
# -*- coding:utf8 -*-
import pymongo
import hashlib
import sys
class pagedbLogic(object):
def __init__(self, mongodb_config):
self.connection = pymongo.MongoClient(mongodb_config['host'], mongodb_config['port'])
self.database = self.connection[mongodb_config['database']]
self.collection ... | [
[
1,
0,
0.0345,
0.0172,
0,
0.66,
0,
19,
0,
1,
0,
0,
19,
0,
0
],
[
1,
0,
0.0517,
0.0172,
0,
0.66,
0.3333,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.069,
0.0172,
0,
0.6... | [
"import pymongo",
"import hashlib",
"import sys",
"class pagedbLogic(object):\n\n def __init__(self, mongodb_config):\n self.connection = pymongo.MongoClient(mongodb_config['host'], mongodb_config['port'])\n self.database = self.connection[mongodb_config['database']]\n self.collectio... |
# -*- coding:utf-8 -*-
import MySQLdb, json
import os, hashlib, time
import logging
import sys
import linkdbLogic
from constants import *
if __name__ == '__main__':
url = sys.argv[1]
head = 'http://'
if not url.startswith(head):
print 'url:%s must start with %s' % (url, head)
sys.exit(1)
... | [
[
1,
0,
0.0274,
0.0137,
0,
0.66,
0,
838,
0,
2,
0,
0,
838,
0,
0
],
[
1,
0,
0.0411,
0.0137,
0,
0.66,
0.1667,
688,
0,
3,
0,
0,
688,
0,
0
],
[
1,
0,
0.0548,
0.0137,
0,
... | [
"import MySQLdb, json",
"import os, hashlib, time",
"import logging",
"import sys",
"import linkdbLogic",
"from constants import *",
"if __name__ == '__main__':\n url = sys.argv[1]\n head = 'http://'\n if not url.startswith(head):\n print('url:%s must start with %s' % (url, head))\n ... |
# error code
# GENERAL
E_VALUE_NONE = 1
E_KEY_NOT_EXIST = 2
E_VALUE_TYPE_ERROR = 3
E_VALUE_IS_EMPTY = 4
E_MYSQL_FAIL = 5
E_DUP_OPERATION = 6
E_DUP_CONTENT = 7
E_METHOD_NOT_EXIST = 8
# USER
E_REGISTER_BASE64_DECODE_FAIL = 10000
E_REGISTER_BASE64_STRING_INVALID = 10001
E_REGISTER_ALREADY_EXIS... | [
[
14,
0,
0.0727,
0.0182,
0,
0.66,
0,
598,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.0909,
0.0182,
0,
0.66,
0.0244,
890,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1091,
0.0182,
0,
0... | [
"E_VALUE_NONE = 1",
"E_KEY_NOT_EXIST = 2",
"E_VALUE_TYPE_ERROR = 3",
"E_VALUE_IS_EMPTY = 4",
"E_MYSQL_FAIL = 5",
"E_DUP_OPERATION = 6",
"E_DUP_CONTENT = 7",
"E_METHOD_NOT_EXIST = 8",
"E_REGISTER_BASE64_DECODE_FAIL = 10000",
"E_REGISTER_BASE64_STRING_INVALID = 10001",
... |
#!/home/xurui/opensource/python2.7/bin/python2.7
# -*- coding:utf8 -*-
# -1- 向evcrawler查询当前的抓取状态
# -2- 根据各个host的抓取队列情况,开始选取1个小时左右的url列表(根据配额进行计算)
# -3- 发送url列表
import socket, struct, sys, json, time
import utils, linkdbLogic
import logging, copy
FMT_XHEAD = "I16sIIHHI"
def is_valid_url(url):
d = {}
d['url'] =... | [
[
1,
0,
0.0345,
0.0057,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
1,
0,
0.0402,
0.0057,
0,
0.66,
0.125,
970,
0,
2,
0,
0,
970,
0,
0
],
[
1,
0,
0.046,
0.0057,
0,
0.... | [
"import socket, struct, sys, json, time",
"import utils, linkdbLogic",
"import logging, copy",
"FMT_XHEAD = \"I16sIIHHI\"",
"def is_valid_url(url):\n d = {}\n d['url'] = url\n try:\n json.dumps(d)\n return True\n except:\n return False",
" d = {}",
" d['url'] = url... |
#!/home/xurui/opensource/python2.7/bin/python2.7
# -*- coding:utf8 -*-
# -1- 向evcrawler查询当前的抓取状态
# -2- 根据各个host的抓取队列情况,开始选取1个小时左右的url列表(根据配额进行计算)
# -3- 发送url列表
import socket, struct, sys, json, time
import utils, linkdbLogic
import logging
FMT_XHEAD = "I16sIIHHI"
def xRequest(sock, log_id, status, dd = []):
jsons... | [
[
1,
0,
0.1429,
0.0238,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
1,
0,
0.1667,
0.0238,
0,
0.66,
0.2,
970,
0,
2,
0,
0,
970,
0,
0
],
[
1,
0,
0.1905,
0.0238,
0,
0.6... | [
"import socket, struct, sys, json, time",
"import utils, linkdbLogic",
"import logging",
"FMT_XHEAD = \"I16sIIHHI\"",
"def xRequest(sock, log_id, status, dd = []):\n jsonstr = ''\n if dd:\n jsonstr = json.dumps(dd)\n sbuf = struct.pack(FMT_XHEAD, log_id, \"stator\", 0, 0, status, 0, len(json... |
# -*- coding:utf8 -*-
from tornado.tcpserver import TCPServer
from tornado.ioloop import IOLoop
import struct, sys
import json
import time
import logging
import hashlib
import utils, linkdbLogic
import os
os.sys.path.append('../utils/diskset/')
import diskset
class Connection(object):
def __init__(self, stream, a... | [
[
1,
0,
0.01,
0.005,
0,
0.66,
0,
370,
0,
1,
0,
0,
370,
0,
0
],
[
1,
0,
0.0149,
0.005,
0,
0.66,
0.0769,
730,
0,
1,
0,
0,
730,
0,
0
],
[
1,
0,
0.0199,
0.005,
0,
0.66,... | [
"from tornado.tcpserver import TCPServer",
"from tornado.ioloop import IOLoop",
"import struct, sys",
"import json",
"import time",
"import logging",
"import hashlib",
"import utils, linkdbLogic",
"import os",
"os.sys.path.append('../utils/diskset/')",
"import diskset",
"class Connection(obje... |
# -*- coding:utf8 -*-
from tornado.tcpserver import TCPServer
from tornado.ioloop import IOLoop
import struct, sys
import json
import time
import bson
import pymongo
import logging
import utils, pagedbLogic
class Connection(object):
def __init__(self, stream, address, mongo_handler):
self.FMT_XHEAD = "I16... | [
[
1,
0,
0.0217,
0.0109,
0,
0.66,
0,
370,
0,
1,
0,
0,
370,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
0.66,
0.0909,
730,
0,
1,
0,
0,
730,
0,
0
],
[
1,
0,
0.0435,
0.0109,
0,
... | [
"from tornado.tcpserver import TCPServer",
"from tornado.ioloop import IOLoop",
"import struct, sys",
"import json",
"import time",
"import bson",
"import pymongo",
"import logging",
"import utils, pagedbLogic",
"class Connection(object):\n def __init__(self, stream, address, mongo_handler):\n... |
#!/home/xurui/opensource/python2.7/bin/python2.7
# -*- coding:utf8 -*-
# -1- 向evcrawler查询当前的抓取状态
# -2- 根据各个host的抓取队列情况,开始选取1个小时左右的url列表(根据配额进行计算)
# -3- 发送url列表
import socket, struct, sys, json, time
import utils, linkdbLogic
import logging, copy
FMT_XHEAD = "I16sIIHHI"
def is_valid_url(url):
d = {}
d['url'] =... | [
[
1,
0,
0.0345,
0.0057,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
1,
0,
0.0402,
0.0057,
0,
0.66,
0.125,
970,
0,
2,
0,
0,
970,
0,
0
],
[
1,
0,
0.046,
0.0057,
0,
0.... | [
"import socket, struct, sys, json, time",
"import utils, linkdbLogic",
"import logging, copy",
"FMT_XHEAD = \"I16sIIHHI\"",
"def is_valid_url(url):\n d = {}\n d['url'] = url\n try:\n json.dumps(d)\n return True\n except:\n return False",
" d = {}",
" d['url'] = url... |
# -*- coding:utf8 -*-
import gzip
import json
import re, sys, time
def get_links(page_content, host = None, inhost = True, base_url = None):
# 将正则表达式编译成Pattern对象
filter_head = None
if host: filter_head = 'http://%s' % host
pattern = re.compile(r'<a.+?href=(.+?)>\s*(.+?)\s*</a>')
#follow_url_list =... | [
[
1,
0,
0.0088,
0.0044,
0,
0.66,
0,
967,
0,
1,
0,
0,
967,
0,
0
],
[
1,
0,
0.0132,
0.0044,
0,
0.66,
0.1,
463,
0,
1,
0,
0,
463,
0,
0
],
[
1,
0,
0.0175,
0.0044,
0,
0.6... | [
"import gzip",
"import json",
"import re, sys, time",
"def get_links(page_content, host = None, inhost = True, base_url = None):\n # 将正则表达式编译成Pattern对象\n filter_head = None\n if host: filter_head = 'http://%s' % host\n\n pattern = re.compile(r'<a.+?href=(.+?)>\\s*(.+?)\\s*</a>')\n #follow_url_l... |
# -*- coding:utf8 -*-
import sys
# 只能在python3下才能执行
class chinese_number_convertor(object):
def __init__(self,):
self.__key_map_list = {'万':10000, \
'千':1000, \
'百':100, \
'十':10, \
'一... | [
[
1,
0,
0.0153,
0.0076,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
3,
0,
0.458,
0.8473,
0,
0.66,
0.5,
939,
0,
3,
0,
0,
186,
0,
23
],
[
2,
1,
0.1489,
0.2137,
1,
0.8... | [
"import sys",
"class chinese_number_convertor(object):\n def __init__(self,):\n self.__key_map_list = {'万':10000, \\\n '千':1000, \\\n '百':100, \\\n '十':10, \\\n '一':1, \\\n ... |
#!/home/xurui/opensource/python2.7/bin/python2.7
# -*- coding:utf8 -*-
# -1- 向evcrawler查询当前的抓取状态
# -2- 根据各个host的抓取队列情况,开始选取1个小时左右的url列表(根据配额进行计算)
# -3- 发送url列表
import socket, struct, sys, json, time
import utils, linkdbLogic
import logging
FMT_XHEAD = "I16sIIHHI"
def xRequest(sock, log_id, status, dd = []):
jsons... | [
[
1,
0,
0.1429,
0.0238,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
1,
0,
0.1667,
0.0238,
0,
0.66,
0.2,
970,
0,
2,
0,
0,
970,
0,
0
],
[
1,
0,
0.1905,
0.0238,
0,
0.6... | [
"import socket, struct, sys, json, time",
"import utils, linkdbLogic",
"import logging",
"FMT_XHEAD = \"I16sIIHHI\"",
"def xRequest(sock, log_id, status, dd = []):\n jsonstr = ''\n if dd:\n jsonstr = json.dumps(dd)\n sbuf = struct.pack(FMT_XHEAD, log_id, \"stator\", 0, 0, status, 0, len(json... |
from pydiskset import *
class diskset(object):
def __init__(self, data_dir, clear_flag):
self._base = pydiskset(data_dir, clear_flag)
def select_key(self, sign1, sign2):
return select_key(self._base, sign1, sign2)
def insert_key(self, sign1, sign2):
return insert_key(self._base, sig... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
461,
0,
1,
0,
0,
461,
0,
0
],
[
3,
0,
0.6364,
0.8182,
0,
0.66,
1,
142,
0,
4,
0,
0,
186,
0,
4
],
[
2,
1,
0.4091,
0.1818,
1,
0.27,... | [
"from pydiskset import *",
"class diskset(object):\n def __init__(self, data_dir, clear_flag):\n self._base = pydiskset(data_dir, clear_flag)\n def select_key(self, sign1, sign2):\n return select_key(self._base, sign1, sign2)\n def insert_key(self, sign1, sign2):\n return insert_key(... |
import socket, struct, sys, json, time
#if len(sys.argv) != 2:
# print "python test.py query"
# sys.exit(1)
def send_all(sock, log_id, jsonstr):
sbuf = struct.pack(FMT_XHEAD, log_id, "selector", 0, 0, 0, len(jsonstr))
sbuf += jsonstr
ret = sock.send(sbuf)
print "send %d bytes" % ret
rbuf = s... | [
[
1,
0,
0.0167,
0.0167,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
2,
0,
0.225,
0.2333,
0,
0.66,
0.0909,
145,
0,
3,
0,
0,
0,
0,
13
],
[
14,
1,
0.1333,
0.0167,
1,
0... | [
"import socket, struct, sys, json, time",
"def send_all(sock, log_id, jsonstr):\n sbuf = struct.pack(FMT_XHEAD, log_id, \"selector\", 0, 0, 0, len(jsonstr))\n sbuf += jsonstr\n ret = sock.send(sbuf)\n print(\"send %d bytes\" % ret)\n rbuf = sock.recv(36)\n print(\"recv %d bytes\" % len(rbuf))\n ... |
import socket, struct, sys, json, time
#if len(sys.argv) != 2:
# print "python test.py query"
# sys.exit(1)
def send_all(sock, log_id, dd):
jsonstr = json.dumps(dd)
sbuf = struct.pack(FMT_XHEAD, log_id, "selector", 0, 0, 0, len(jsonstr))
sbuf += jsonstr
ret = sock.send(sbuf)
print "send %d b... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
2,
0,
0.2015,
0.209,
0,
0.66,
0.1,
145,
0,
3,
0,
0,
0,
0,
12
],
[
14,
1,
0.1194,
0.0149,
1,
0.12... | [
"import socket, struct, sys, json, time",
"def send_all(sock, log_id, dd):\n jsonstr = json.dumps(dd)\n sbuf = struct.pack(FMT_XHEAD, log_id, \"selector\", 0, 0, 0, len(jsonstr))\n sbuf += jsonstr\n ret = sock.send(sbuf)\n print(\"send %d bytes\" % ret)\n rbuf = sock.recv(36)\n log_id, srvnam... |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | [
[
1,
0,
0.0588,
0.0118,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0706,
0.0118,
0,
0.66,
0.125,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0824,
0.0118,
0,
0... | [
"import logging",
"import shutil",
"import sys",
"import urlparse",
"import SimpleHTTPServer",
"import BaseHTTPServer",
"class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n \"\"\"Handle playfoursquare.com requests, for testing.\"\"\"\n\n def do_GET(self):\n logging.warn('do_GET: %s, %s',... |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | [
[
1,
0,
0.0201,
0.0067,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0268,
0.0067,
0,
0.66,
0.0769,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0336,
0.0067,
0,
... | [
"import datetime",
"import sys",
"import textwrap",
"import common",
"from xml.dom import pulldom",
"PARSER = \"\"\"\\\n/**\n * Copyright 2009 Joe LaPenna\n */\n\npackage com.joelapenna.foursquare.parsers;\n\nimport com.joelapenna.foursquare.Foursquare;",
"BOOLEAN_STANZA = \"\"\"\\\n } else i... |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | [
[
8,
0,
0.0631,
0.0991,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1261,
0.009,
0,
0.66,
0.05,
2,
0,
1,
0,
0,
2,
0,
0
],
[
1,
0,
0.1351,
0.009,
0,
0.66,
0.... | [
"\"\"\"\nPull a oAuth protected page from foursquare.\n\nExpects ~/.oget to contain (one on each line):\nCONSUMER_KEY\nCONSUMER_KEY_SECRET\nUSERNAME\nPASSWORD",
"import httplib",
"import os",
"import re",
"import sys",
"import urllib",
"import urllib2",
"import urlparse",
"import user",
"from xml.... |
#!/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/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | [
[
1,
0,
0.0263,
0.0088,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0439,
0.0088,
0,
0.66,
0.0833,
290,
0,
1,
0,
0,
290,
0,
0
],
[
1,
0,
0.0526,
0.0088,
0,
... | [
"import logging",
"from xml.dom import minidom",
"from xml.dom import pulldom",
"BOOLEAN = \"boolean\"",
"STRING = \"String\"",
"GROUP = \"Group\"",
"DEFAULT_INTERFACES = ['FoursquareType']",
"INTERFACES = {\n}",
"DEFAULT_CLASS_IMPORTS = [\n]",
"CLASS_IMPORTS = {\n# 'Checkin': DEFAULT_CLASS_IMP... |
from distutils.core import setup
import os
from psshlib import version
long_description = """PSSH (Parallel SSH) provides parallel versions of OpenSSH and related tools, including pssh, pscp, prsync, pnuke, and pslurp. The project includes psshlib which can be used within custom applications."""
setup(
name = "p... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
152,
0,
1,
0,
0,
152,
0,
0
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0698,
0.0233,
0,
0.... | [
"from distutils.core import setup",
"import os",
"from psshlib import version",
"long_description = \"\"\"PSSH (Parallel SSH) provides parallel versions of OpenSSH and related tools, including pssh, pscp, prsync, pnuke, and pslurp. The project includes psshlib which can be used within custom applications.\"\... |
# Copyright (c) 2009-2012, Andrew McNabb
from errno import EINTR
from subprocess import Popen, PIPE
import os
import signal
import sys
import time
import traceback
from psshlib import askpass_client
from psshlib import color
BUFFER_SIZE = 1 << 16
try:
bytes
except NameError:
bytes = str
class Task(object)... | [
[
1,
0,
0.0104,
0.0035,
0,
0.66,
0,
546,
0,
1,
0,
0,
546,
0,
0
],
[
1,
0,
0.0139,
0.0035,
0,
0.66,
0.0909,
394,
0,
2,
0,
0,
394,
0,
0
],
[
1,
0,
0.0174,
0.0035,
0,
... | [
"from errno import EINTR",
"from subprocess import Popen, PIPE",
"import os",
"import signal",
"import sys",
"import time",
"import traceback",
"from psshlib import askpass_client",
"from psshlib import color",
"BUFFER_SIZE = 1 << 16",
"try:\n bytes\nexcept NameError:\n bytes = str",
" ... |
#!/usr/bin/env python
# -*- Mode: python -*-
# Copyright (c) 2009-2012, Andrew McNabb
"""Sends the password over a socket to askpass.
"""
import errno
import getpass
import os
import socket
import sys
import tempfile
import textwrap
from psshlib import psshutil
class PasswordServer(object):
"""Listens on a UN... | [
[
8,
0,
0.0644,
0.0198,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0891,
0.0099,
0,
0.66,
0.1111,
546,
0,
1,
0,
0,
546,
0,
0
],
[
1,
0,
0.099,
0.0099,
0,
0.66,... | [
"\"\"\"Sends the password over a socket to askpass.\n\"\"\"",
"import errno",
"import getpass",
"import os",
"import socket",
"import sys",
"import tempfile",
"import textwrap",
"from psshlib import psshutil",
"class PasswordServer(object):\n \"\"\"Listens on a UNIX domain socket for password r... |
# Copyright (c) 2009-2012, Andrew McNabb
# Copyright (c) 2003-2008, Brent N. Chun
import fcntl
import string
import sys
HOST_FORMAT = 'Host format is [user@]host[:port] [user]'
def read_host_files(paths, default_user=None, default_port=None):
"""Reads the given host files.
Returns a list of (host, port, us... | [
[
1,
0,
0.037,
0.0093,
0,
0.66,
0,
488,
0,
1,
0,
0,
488,
0,
0
],
[
1,
0,
0.0463,
0.0093,
0,
0.66,
0.1111,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0556,
0.0093,
0,
0... | [
"import fcntl",
"import string",
"import sys",
"HOST_FORMAT = 'Host format is [user@]host[:port] [user]'",
"def read_host_files(paths, default_user=None, default_port=None):\n \"\"\"Reads the given host files.\n\n Returns a list of (host, port, user) triples.\n \"\"\"\n hosts = []\n if paths:... |
# Copyright (c) 2009-2012, Andrew McNabb
# Copyright (c) 2003-2008, Brent N. Chun
def with_color(string, fg, bg=49):
'''Given foreground/background ANSI color codes, return a string that,
when printed, will format the supplied string using the supplied colors.
'''
return "\x1b[%dm\x1b[%dm%s\x1b[39m\x1b... | [
[
2,
0,
0.1538,
0.1282,
0,
0.66,
0,
528,
0,
3,
1,
0,
0,
0,
0
],
[
8,
1,
0.1538,
0.0769,
1,
0.51,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
13,
1,
0.2051,
0.0256,
1,
0.51,
... | [
"def with_color(string, fg, bg=49):\n '''Given foreground/background ANSI color codes, return a string that,\n when printed, will format the supplied string using the supplied colors.\n '''\n return \"\\x1b[%dm\\x1b[%dm%s\\x1b[39m\\x1b[49m\" % (fg, bg, string)",
" '''Given foreground/background ANS... |
VERSION = '2.3.1'
| [
[
14,
0,
1,
1,
0,
0.66,
0,
557,
1,
0,
0,
0,
0,
3,
0
]
] | [
"VERSION = '2.3.1'"
] |
#!/usr/bin/env python
# -*- Mode: python -*-
# Copyright (c) 2009-2012, Andrew McNabb
"""Implementation of SSH_ASKPASS to get a password to ssh from pssh.
The password is read from the socket specified by the environment variable
PSSH_ASKPASS_SOCKET. The other end of this socket is pssh.
The ssh man page discusses... | [
[
8,
0,
0.1225,
0.1373,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2059,
0.0098,
0,
0.66,
0.0909,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2157,
0.0098,
0,
0.66... | [
"\"\"\"Implementation of SSH_ASKPASS to get a password to ssh from pssh.\n\nThe password is read from the socket specified by the environment variable\nPSSH_ASKPASS_SOCKET. The other end of this socket is pssh.\n\nThe ssh man page discusses SSH_ASKPASS as follows:\n If ssh needs a passphrase, it will read the p... |
# Copyright (c) 2009-2012, Andrew McNabb
from errno import EINTR
import os
import select
import signal
import sys
import threading
try:
import queue
except ImportError:
import Queue as queue
from psshlib.askpass_server import PasswordServer
from psshlib import psshutil
READ_SIZE = 1 << 16
class FatalError... | [
[
1,
0,
0.0074,
0.0025,
0,
0.66,
0,
546,
0,
1,
0,
0,
546,
0,
0
],
[
1,
0,
0.0099,
0.0025,
0,
0.66,
0.0667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0123,
0.0025,
0,
... | [
"from errno import EINTR",
"import os",
"import select",
"import signal",
"import sys",
"import threading",
"try:\n import queue\nexcept ImportError:\n import Queue as queue",
" import queue",
" import Queue as queue",
"from psshlib.askpass_server import PasswordServer",
"from psshli... |
# Copyright (c) 2009-2012, Andrew McNabb
# Copyright (c) 2003-2008, Brent N. Chun
import optparse
import os
import shlex
import sys
import textwrap
from psshlib import version
_DEFAULT_PARALLELISM = 32
_DEFAULT_TIMEOUT = 0 # "infinity" by default
def common_parser():
"""
Create a basic OptionParser wit... | [
[
1,
0,
0.036,
0.009,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.045,
0.009,
0,
0.66,
0.1,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0541,
0.009,
0,
0.66,
... | [
"import optparse",
"import os",
"import shlex",
"import sys",
"import textwrap",
"from psshlib import version",
"_DEFAULT_PARALLELISM = 32",
"_DEFAULT_TIMEOUT = 0 # \"infinity\" by default",
"def common_parser():\n \"\"\"\n Create a basic OptionParser with arguments common to all pssh prog... |
#!/usr/bin/python
# Copyright (c) 2009, Andrew McNabb
# Copyright (c) 2003-2008, Brent N. Chun
import os
import sys
import shutil
import tempfile
import time
import unittest
basedir, bin = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0])))
sys.path.append("%s" % basedir)
if os.getenv("TEST_HOSTS") is Non... | [
[
1,
0,
0.0199,
0.0033,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0232,
0.0033,
0,
0.66,
0.0588,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0265,
0.0033,
0,
... | [
"import os",
"import sys",
"import shutil",
"import tempfile",
"import time",
"import unittest",
"basedir, bin = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0])))",
"sys.path.append(\"%s\" % basedir)",
"if os.getenv(\"TEST_HOSTS\") is None:\n raise Exception(\"Must define TEST_HOSTS\")... |
from utils import *
Clean()
HgUpdate21()
PatchAll()
Build_XCode_64()
RunAll()
Clean()
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
970,
0,
1,
0,
0,
970,
0,
0
],
[
8,
0,
0.3636,
0.0909,
0,
0.66,
0.1667,
416,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.5455,
0.0909,
0,
0.... | [
"from utils import *",
"Clean()",
"HgUpdate21()",
"PatchAll()",
"Build_XCode_64()",
"RunAll()",
"Clean()"
] |
from utils import *
Clean()
HgUpdate33()
PatchAll()
Build_VC10_64()
RunAll()
Clean()
HgUpdate33()
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
970,
0,
1,
0,
0,
970,
0,
0
],
[
8,
0,
0.2727,
0.0909,
0,
0.66,
0.1429,
416,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.4545,
0.0909,
0,
0.... | [
"from utils import *",
"Clean()",
"HgUpdate33()",
"PatchAll()",
"Build_VC10_64()",
"RunAll()",
"Clean()",
"HgUpdate33()"
] |
from utils import *
HgUpdate33()
version = raw_input("Enter version number (ex : 0003) :")
Package("OpenGL-tutorial_v"+version+"_33.zip");
HgUpdate21()
Package("OpenGL-tutorial_v"+version+"_21.zip");
HgUpdate33()
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
970,
0,
1,
0,
0,
970,
0,
0
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0.1667,
715,
3,
0,
0,
0,
0,
0,
1
],
[
14,
0,
0.5,
0.125,
0,
0.66,
... | [
"from utils import *",
"HgUpdate33()",
"version = raw_input(\"Enter version number (ex : 0003) :\")",
"Package(\"OpenGL-tutorial_v\"+version+\"_33.zip\");",
"HgUpdate21()",
"Package(\"OpenGL-tutorial_v\"+version+\"_21.zip\");",
"HgUpdate33()"
] |
from utils import *
Clean()
HgUpdate21()
PatchAll()
Build_VC10_64()
OptimusForceIntel()
RunAll()
OptimusForceNVIDIA()
RunAll()
Clean()
HgUpdate33()
PatchAll()
Build_VC10_64()
OptimusForceNVIDIA()
RunAll()
Clean()
HgUpdate33()
| [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
970,
0,
1,
0,
0,
970,
0,
0
],
[
8,
0,
0.1739,
0.0435,
0,
0.66,
0.0625,
416,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.2609,
0.0435,
0,
0.... | [
"from utils import *",
"Clean()",
"HgUpdate21()",
"PatchAll()",
"Build_VC10_64()",
"OptimusForceIntel()",
"RunAll()",
"OptimusForceNVIDIA()",
"RunAll()",
"Clean()",
"HgUpdate33()",
"PatchAll()",
"Build_VC10_64()",
"OptimusForceNVIDIA()",
"RunAll()",
"Clean()",
"HgUpdate33()"
] |
theLongDescription = """P4 does Bayesian and maximum likelihood phylogenetic analyses on
molecular sequences. It's specialty is that you can use heterogeneous
models, where the model parameters can differ in different parts of
the tree, or over different parts of the data.
"""
from distutils.core import setup, Extens... | [
[
14,
0,
0.0113,
0.0189,
0,
0.66,
0,
378,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0264,
0.0038,
0,
0.66,
0.0286,
152,
0,
2,
0,
0,
152,
0,
0
],
[
1,
0,
0.0302,
0.0038,
0,
0... | [
"theLongDescription = \"\"\"P4 does Bayesian and maximum likelihood phylogenetic analyses on\nmolecular sequences. It's specialty is that you can use heterogeneous\nmodels, where the model parameters can differ in different parts of\nthe tree, or over different parts of the data.\n\"\"\"",
"from distutils.core i... |
import func
from Var import var
class NodeBranchPart(object):
def __init__(self):
self.rMatrixNum = -1
self.gdasrvNum = -1
#self.bigP = None
class NodeBranch(object):
def __init__(self):
self.len = 0.1
#self.textDrawSymbol = '-' # See var.modelSymbols for some alterna... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
856,
0,
1,
0,
0,
856,
0,
0
],
[
1,
0,
0.0074,
0.0037,
0,
0.66,
0.1667,
135,
0,
1,
0,
0,
135,
0,
0
],
[
3,
0,
0.0202,
0.0147,
0,
... | [
"import func",
"from Var import var",
"class NodeBranchPart(object):\n def __init__(self):\n self.rMatrixNum = -1\n self.gdasrvNum = -1",
" def __init__(self):\n self.rMatrixNum = -1\n self.gdasrvNum = -1",
" self.rMatrixNum = -1",
" self.gdasrvNum = -1",
... |
import string
from Tree import Tree
from Node import Node
class Aho(object):
def isTripletCompatibleWithSet(self, set, triplet):
list = []
list.append(triplet)
for t in set:
list.append(t)
return self.isListCompatible(list)
def isSetCompatible(self, set):
... | [
[
1,
0,
0.004,
0.004,
0,
0.66,
0,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.008,
0.004,
0,
0.66,
0.2,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.012,
0.004,
0,
0.66,
0... | [
"import string",
"from Tree import Tree",
"from Node import Node",
"class Aho(object):\n\n\n def isTripletCompatibleWithSet(self, set, triplet):\n list = []\n list.append(triplet)\n for t in set:\n list.append(t)",
" def isTripletCompatibleWithSet(self, set, triplet):\n... |
#import string
import textwrap
import types
class Glitch(Exception):
"""A class for exceptions in p4.
You can raise this with a string, or a list of strings. If its
a single string, it gets wrapped. If its a list of 2 strings, the
first one is output flush and unwrapped, and the second is
indent... | [
[
1,
0,
0.0303,
0.0152,
0,
0.66,
0,
641,
0,
1,
0,
0,
641,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.5,
209,
0,
1,
0,
0,
209,
0,
0
],
[
3,
0,
0.5303,
0.9242,
0,
0.6... | [
"import textwrap",
"import types",
"class Glitch(Exception):\n \"\"\"A class for exceptions in p4.\n\n You can raise this with a string, or a list of strings. If its\n a single string, it gets wrapped. If its a list of 2 strings, the\n first one is output flush and unwrapped, and the second is\n ... |
"""Stuff to ignore when using p3rlcompleter.
The p3rlcompleter is meant to be for the user, to expose the user
interface. As such, it generally does not want to display all that
dir() can provide. This file is one way to tell the completer to
ignore. The other way is with ##Ignore comments in the method doc."""
co... | [
[
8,
0,
0.0729,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4167,
0.5208,
0,
0.66,
0.5,
373,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.8958,
0.2292,
0,
0.66,
... | [
"\"\"\"Stuff to ignore when using p3rlcompleter.\n\nThe p3rlcompleter is meant to be for the user, to expose the user\ninterface. As such, it generally does not want to display all that\ndir() can provide. This file is one way to tell the completer to\nignore. The other way is with ##Ignore comments in the metho... |
versionNumberString = '0.93' # a string that can be turned into a number
versionNumber = float(versionNumberString)
versionNumberModifier = ' [2015-04-08]' # a string
versionString = '%s%s' % (versionNumberString, versionNumberModifier)
dateString = "8 April, 2015"
| [
[
14,
0,
0.1667,
0.1667,
0,
0.66,
0,
512,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
901,
3,
1,
0,
0,
639,
10,
1
],
[
14,
0,
0.5,
0.1667,
0,
0.6... | [
"versionNumberString = '0.93' # a string that can be turned into a number",
"versionNumber = float(versionNumberString)",
"versionNumberModifier = ' [2015-04-08]' # a string",
"versionString = '%s%s' % (versionNumberString, versionNumberModifier)",
"dateString = \"8 April, 2015\""
] |
"""Maximum likelihood and Bayesian phylogenetic analysis.
P4 is a phylogenetic toolkit that does Bayesian and maximum likelihood
phylogenetic analyses of molecular sequences. It's specialty is that
you can use heterogeneous models, where the model parameters can
differ in different parts of the tree, or over differen... | [
[
8,
0,
0.106,
0.2053,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2185,
0.0066,
0,
0.66,
0.0435,
509,
0,
3,
0,
0,
509,
0,
0
],
[
1,
0,
0.4371,
0.0066,
0,
0.66,... | [
"\"\"\"Maximum likelihood and Bayesian phylogenetic analysis.\n\nP4 is a phylogenetic toolkit that does Bayesian and maximum likelihood\nphylogenetic analyses of molecular sequences. It's specialty is that\nyou can use heterogeneous models, where the model parameters can\ndiffer in different parts of the tree, or ... |
# Make the rst file scripts.rst
from p4.Glitch import Glitch
start = """
========================
Scripts for common tasks
========================
This is a cook book of reminders, suggestions, and points of departure
for customization. You can copy and paste these into your own files.
Or you can use the p4 recipes... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
179,
0,
1,
0,
0,
179,
0,
0
]
] | [
"from p4.Glitch import Glitch"
] |
def hook(self, theTree):
"""Write stuff during the MCMC.
You get the stuff from the Mcmc (which is self) or from the
current tree. Write whatever you like, however you like it. You
will need to know how to get it, tho ...
In this demo, I write out the gen number+1, the composition, and
the ... | [
[
2,
0,
0.2692,
0.4615,
0,
0.66,
0,
70,
0,
2,
0,
0,
0,
0,
3
],
[
8,
1,
0.2051,
0.2821,
1,
0.04,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.4103,
0.0256,
1,
0.04,
0.... | [
"def hook(self, theTree):\n \"\"\"Write stuff during the MCMC.\n\n You get the stuff from the Mcmc (which is self) or from the\n current tree. Write whatever you like, however you like it. You\n will need to know how to get it, tho ...\n\n In this demo, I write out the gen number+1, the composition... |
read("../d.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=1)
t.setPInvar(free=0, val=0.0)
m = Mcmc(t, nChains=1, runNum=0, sampleInterval=10, checkPointInterval=2000)
# Set up a strong prior on polytomi... | [
[
8,
0,
0.0455,
0.0455,
0,
0.66,
0,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.0909,
0.0455,
0,
0.66,
0.1,
355,
3,
0,
0,
0,
467,
10,
1
],
[
14,
0,
0.1364,
0.0455,
0,
0.... | [
"read(\"../d.nex\")",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"t.newComp(free=1, spec='empirical')",
"t.newRMatrix(free=1, spec='ones')",
"t.setNGammaCat(nGammaCat=1)",
"t.setPInvar(free=0, val=0.0)",
"m = Mcmc(t, nChains=1, runNum=0, sampleInterval=10, checkPointInte... |
tp = TreePartitions("mcmc_trees_0.nex", skip=200)
t = tp.consensus()
# put support on node.name's, for the text drawing
for n in t.iterInternalsNoRoot():
n.name = "%.0f" % (100. * n.br.support)
t.draw()
# Save it
t.writeNexus(fName='cons.nex')
| [
[
14,
0,
0.1,
0.1,
0,
0.66,
0,
53,
3,
2,
0,
0,
73,
10,
1
],
[
14,
0,
0.2,
0.1,
0,
0.66,
0.25,
15,
3,
0,
0,
0,
194,
10,
1
],
[
6,
0,
0.55,
0.2,
0,
0.66,
0.5,
... | [
"tp = TreePartitions(\"mcmc_trees_0.nex\", skip=200)",
"t = tp.consensus()",
"for n in t.iterInternalsNoRoot():\n n.name = \"%.0f\" % (100. * n.br.support)",
" n.name = \"%.0f\" % (100. * n.br.support)",
"t.draw()",
"t.writeNexus(fName='cons.nex')"
] |
read("../../K_thermus/noTRuberNoGapsNoAmbiguities.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=0.5)
t.setPInvar(free=0, val=0.0)
m = Mcmc(t, nChains=1, runNum=0, sampleInterv... | [
[
8,
0,
0.0714,
0.0714,
0,
0.66,
0,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1429,
0.0714,
0,
0.66,
0.0909,
355,
3,
0,
0,
0,
467,
10,
1
],
[
14,
0,
0.2143,
0.0714,
0,
... | [
"read(\"../../K_thermus/noTRuberNoGapsNoAmbiguities.nex\")",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"t.newComp(free=1, spec='empirical')",
"t.newRMatrix(free=1, spec='ones')",
"t.setNGammaCat(nGammaCat=4)",
"t.newGdasrv(free=1, val=0.5)",
"t.setPInvar(free=0, val=0.0... |
# Get the test quantity, X^2, from the original data.
read("../../K_thermus/noTRuberNoGapsNoAmbiguities.nex")
d = Data()
ret = d.compoChiSquaredTest()
#print ret
originalStat = ret[0][0]
# Get the sim stats
n = Numbers('mcmc_sims_0', col=1, skip=500)
# Evaluate the tail area probability
n.tailAreaProbability(original... | [
[
8,
0,
0.1538,
0.0769,
0,
0.66,
0,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.2308,
0.0769,
0,
0.66,
0.2,
355,
3,
0,
0,
0,
467,
10,
1
],
[
14,
0,
0.3077,
0.0769,
0,
0.... | [
"read(\"../../K_thermus/noTRuberNoGapsNoAmbiguities.nex\")",
"d = Data()",
"ret = d.compoChiSquaredTest()",
"originalStat = ret[0][0]",
"n = Numbers('mcmc_sims_0', col=1, skip=500)",
"n.tailAreaProbability(originalStat)"
] |
read("d.nex")
read('sets.nex')
a = var.alignments[0]
a.setCharPartition('p1')
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
pNum = 0
t.newComp(partNum=pNum, free=1, spec='empirical')
t.newRMatrix(partNum=pNum, free=0, spec='wag')
t.setNGammaCat(partNum=pNum, nGammaCat=4)
t.newGdasrv(partNum=pNum, free... | [
[
8,
0,
0.0333,
0.0333,
0,
0.66,
0,
453,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.0667,
0.0333,
0,
0.66,
0.0435,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1,
0.0333,
0,
0.66,
... | [
"read(\"d.nex\")",
"read('sets.nex')",
"a = var.alignments[0]",
"a.setCharPartition('p1')",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"pNum = 0",
"t.newComp(partNum=pNum, free=1, spec='empirical')",
"t.newRMatrix(partNum=pNum, free=0, spec='wag')",
"t.setNGammaCat(p... |
nTax = 5
taxNames = list(string.uppercase[:nTax])
a = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=200)
b = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=133)
d = Data([a,b])
t = func.randomTree(taxNames=taxNames)
t.data = d
pNum = 0
t.newComp(partNum=pNum, free=0, spec=... | [
[
14,
0,
0.0312,
0.0312,
0,
0.66,
0,
186,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.0625,
0.0312,
0,
0.66,
0.04,
585,
3,
1,
0,
0,
430,
10,
1
],
[
14,
0,
0.0938,
0.0312,
0,
... | [
"nTax = 5",
"taxNames = list(string.uppercase[:nTax])",
"a = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=200)",
"b = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=133)",
"d = Data([a,b])",
"t = func.randomTree(taxNames=taxNames)",
"t.data = d",
"pNum = 0... |
from p4.PosteriorSamples import PosteriorSamples
read("d.nex")
read('sets.nex')
a = var.alignments[0]
a.setCharPartition('p1')
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
pNum=0
t.newComp(partNum=pNum, free=1, spec='wag')
t.newRMatrix(partNum=pNum, free=0, spec='wag')
t.setNGammaCat(partNum=pNum, n... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
996,
0,
1,
0,
0,
996,
0,
0
],
[
8,
0,
0.0682,
0.0227,
0,
0.66,
0.037,
453,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.0909,
0.0227,
0,
0.6... | [
"from p4.PosteriorSamples import PosteriorSamples",
"read(\"d.nex\")",
"read('sets.nex')",
"a = var.alignments[0]",
"a.setCharPartition('p1')",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"pNum=0",
"t.newComp(partNum=pNum, free=1, spec='wag')",
"t.newRMatrix(partNum=p... |
read("d.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=0.5)
t.setPInvar(free=0, val=0.0)
m = Mcmc(t, nChains=1, runNum=0, sampleInterval=100, checkPointInterval=None)
m.run(200... | [
[
8,
0,
0.0714,
0.0714,
0,
0.66,
0,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1429,
0.0714,
0,
0.66,
0.1,
355,
3,
0,
0,
0,
467,
10,
1
],
[
14,
0,
0.2143,
0.0714,
0,
0.... | [
"read(\"d.nex\")",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"t.newComp(free=1, spec='empirical')",
"t.newRMatrix(free=1, spec='ones')",
"t.setNGammaCat(nGammaCat=4)",
"t.newGdasrv(free=1, val=0.5)",
"t.setPInvar(free=0, val=0.0)",
"m = Mcmc(t, nChains=1, runNum=0, sa... |
nTax = 11
taxNames = list(string.uppercase[:nTax])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=200)
d = Data([a])
t = func.randomTree(taxNames=taxNames)
t.data = d
t.newComp(free=0, spec='specified', val=[0.4, 0.3, 0.0])
t.newRMatrix(free=0, spec='specified', val=[2., 3., 4., 5., 6., 7.])
t.s... | [
[
14,
0,
0.0526,
0.0526,
0,
0.66,
0,
186,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1053,
0.0526,
0,
0.66,
0.0769,
585,
3,
1,
0,
0,
430,
10,
1
],
[
14,
0,
0.1579,
0.0526,
0,
... | [
"nTax = 11",
"taxNames = list(string.uppercase[:nTax])",
"a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=200)",
"d = Data([a])",
"t = func.randomTree(taxNames=taxNames)",
"t.data = d",
"t.newComp(free=0, spec='specified', val=[0.4, 0.3, 0.0])",
"t.newRMatrix(free=0, spec='specifi... |
from p4.PosteriorSamples import PosteriorSamples
read("d.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='specified', val=[2., 3., 4., 5., 6., 7.])
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=0, val=0.5)
t.setPInvar(free=0, val=0.0)
f... | [
[
1,
0,
0.0357,
0.0357,
0,
0.66,
0,
996,
0,
1,
0,
0,
996,
0,
0
],
[
8,
0,
0.1071,
0.0357,
0,
0.66,
0.0769,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1429,
0.0357,
0,
0... | [
"from p4.PosteriorSamples import PosteriorSamples",
"read(\"d.nex\")",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"t.newComp(free=1, spec='empirical')",
"t.newRMatrix(free=1, spec='specified', val=[2., 3., 4., 5., 6., 7.])",
"t.setNGammaCat(nGammaCat=4)",
"t.newGdasrv(fr... |
os.system("rm -f mcmc*")
read("recoded.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=0.5)
t.setPInvar(free=1, val=0.2)
m = Mcmc(t, nChains=4, runNum=0, sampleInterval=10, chec... | [
[
8,
0,
0.0455,
0.0455,
0,
0.66,
0,
856,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.0909,
0.0455,
0,
0.66,
0.0667,
453,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1364,
0.0455,
0,
0.6... | [
"os.system(\"rm -f mcmc*\")",
"read(\"recoded.nex\")",
"d = Data()",
"t = func.randomTree(taxNames=d.taxNames)",
"t.data = d",
"t.newComp(free=1, spec='empirical')",
"t.newRMatrix(free=1, spec='ones')",
"t.setNGammaCat(nGammaCat=4)",
"t.newGdasrv(free=1, val=0.5)",
"t.setPInvar(free=1, val=0.2)",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.